| Dun Darach | Routines |
| Prev: 9DC1 | Up: Map |
|
Used by the routine at Game_Main.
|
|||||||
| Hero_Drop | 9E51 | LD HL,$1000 | Standard amount when adding to account. | ||||
| 9E54 | LD A,(CurrentRoom_Type) | ||||||
| 9E57 | CP $09 | Bank | |||||
| 9E59 | JR Z,Hero_Drop_0 | ||||||
| 9E5B | CP $05 | Gambling | |||||
| 9E5D | JR NZ,Hero_Drop_2 | ||||||
|
Gambling
|
|||||||
| 9E5F | LD A,(Room_Flags) | ||||||
| 9E62 | AND A | ||||||
| 9E63 | RET NZ | ||||||
| 9E64 | LD HL,(Account_Cost) | Get the cost of the object / amount per bet. | |||||
|
Bank / Gambling.
|
|||||||
| Hero_Drop_0 | 9E67 | LD (Account_Cost),HL | Store amount of money to shift onto account. | ||||
| 9E6A | LD HL,(Bg_ItemTableMid) | Check that we have something behind the hero to put the object onto. | |||||
| 9E6D | LD A,L | ||||||
| 9E6E | AND H | ||||||
| 9E6F | AND $0F | ||||||
| 9E71 | RET Z | ||||||
| 9E72 | LD DE,(Account_Cost) | Get difference between amount carried and the amount to put down. | |||||
| 9E76 | LD HL,IridiValue | ||||||
| 9E79 | CALL BCD_SubDE | ||||||
| 9E7C | RET C | Not enough carried, do nothing. | |||||
| 9E7D | LD HL,BankAccountLow | Deal wit the bank account if in a bank. | |||||
| 9E80 | LD A,(CurrentRoom_Type) | ||||||
| 9E83 | CP $09 | ||||||
| 9E85 | JR Z,Hero_Drop_1 | ||||||
| 9E87 | LD A,(Bg_ItemTableMid) | Workout which plinth the hero next to. | |||||
| 9E8A | AND $0F | ||||||
| 9E8C | LD L,A | ||||||
| 9E8D | LD H,$00 | ||||||
| 9E8F | ADD HL,HL | ||||||
| 9E90 | ADD HL,HL | ||||||
| 9E91 | LD DE,Event_NumDoors | ||||||
| 9E94 | ADD HL,DE | ||||||
| Hero_Drop_1 | 9E95 | LD DE,(Account_Cost) | Add amount to plinth. | ||||
| 9E99 | CALL BCD_AddDE | ||||||
| 9E9C | LD HL,_9dc0 | ||||||
| 9E9F | LD (HL),$01 | ||||||
| 9EA1 | JR Hero_Drop_3 | ||||||
|
Other type of room.
|
|||||||
| Hero_Drop_2 | 9EA3 | LD A,(Inv_Select) | Check for money selected. | ||||
| 9EA6 | AND A | ||||||
| 9EA7 | RET Z | ||||||
| 9EA8 | LD (HL),$01 | ||||||
| 9EAA | LD L,A | Offset select index to pocket address. | |||||
| 9EAB | LD H,$00 | ||||||
| 9EAD | LD DE,_b14e | ||||||
| 9EB0 | ADD HL,DE | ||||||
| 9EB1 | LD A,(HL) | Get index of object being carried and check is valid. | |||||
| 9EB2 | AND A | ||||||
| 9EB3 | RET Z | ||||||
| Hero_Drop_3 | 9EB4 | EX DE,HL | |||||
| 9EB5 | LD HL,(Bg_ItemTableMid) | Calculate which plinth hero is near | |||||
| 9EB8 | LD A,L | ||||||
| 9EB9 | AND H | ||||||
| 9EBA | AND $0F | End if not near one. | |||||
| 9EBC | RET Z | ||||||
| 9EBD | LD C,A | Get address of plinth within room data. | |||||
| 9EBE | LD B,$00 | ||||||
| 9EC0 | LD HL,(Room_CurrentInfoDataPtr) | ||||||
| 9EC3 | ADD HL,BC | ||||||
| 9EC4 | LD A,(HL) | See if plinth is empty. | |||||
| 9EC5 | AND A | ||||||
| 9EC6 | JR Z,Hero_Drop_5 | ||||||
| 9EC8 | LD A,(CurrentRoom_Type) | If not check for bank / gambling which can have money already on plinth. | |||||
| 9ECB | CP $09 | ||||||
| 9ECD | JR Z,Hero_Drop_4 | ||||||
| 9ECF | CP $05 | ||||||
| 9ED1 | RET NZ | Any other type of room, just do nothing. | |||||
|
Money drop.
|
|||||||
| Hero_Drop_4 | 9ED2 | LD DE,$0005 | Beep. | ||||
| 9ED5 | LD HL,$0190 | ||||||
| 9ED8 | CALL $03B5 | ||||||
| 9EDB | JP Inv_Update | ||||||
|
Object drop.
|
|||||||
| Hero_Drop_5 | 9EDE | EX DE,HL | |||||
| 9EDF | LD A,(HL) | Move the object (index value) from pocket onto plinth. | |||||
| 9EE0 | LD (DE),A | ||||||
| 9EE1 | LD (HL),$00 | ||||||
| 9EE3 | PUSH AF | ||||||
| 9EE4 | LD A,$01 | Reset select to first object. | |||||
| 9EE6 | LD (Inv_Select),A | ||||||
| 9EE9 | LD DE,$0005 | Beep. | |||||
| 9EEC | LD HL,$0190 | ||||||
| 9EEF | CALL $03B5 | ||||||
| 9EF2 | POP AF | ||||||
| 9EF3 | JP Obj_DrawOrClearByIndex | ||||||
| Prev: 9DC1 | Up: Map |