Routines |
Prev: 29619 | Up: Map | Next: 30001 |
Used by the routine at 55726.
|
||||
29756 | CALL 33834 | Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty | ||
29759 | JP Z,29482 | If Magic Knight's inventory (carrying) is empty then return to game | ||
29762 | LD IX,25164 | Point IX at Magic Knight's current inventory (carrying) | ||
29766 | LD B,5 | Load B with 5 (five inventory slots) | ||
29768 | LD HL,39065 | Point HL at "GIVE WHICH OBJECT ?" text | ||
29771 | LD DE,39077 | Point DE at "GIVE THE " text | ||
29774 | CALL 33952 | Show list of objects in Magic Knight's inventory (carrying) as a menu and load A with selected item index | ||
29777 | LD HL,25164 | Point HL at start of characters' current inventories table | ||
29780 | CALL 33911 | Print name of object in inventory slot A of inventory data at HL in command summary window | ||
29783 | LD DE,39082 | Point DE at "TO" text... | ||
29786 | CALL 54283 | ...and print in command summary window at top of screen | ||
29789 | LD HL,38658 | Point HL at "GIVE AN OBJECT TO ?" text | ||
29792 | LD DE,0 | Load DE with zero (i.e. no command summary text) | ||
29795 | CALL 34122 | Display and process input for character selection menu (current room's characters only), setting Current Character | ||
29798 | JP Z,29482 | If there are no characters in the room then return to game | ||
29801 | CALL 55115 | Display execute / reject command window and return here if execute chosen, else exit to main game loop | ||
29804 | LD IX,44251 | Point IX at table of characters' unwanted objects | ||
29808 | CALL 33863 | If Current Character does not want Current Object... | ||
29811 | JP Z,55222 | ...then display "[Character] DOES NOT WANT THE [Object]" window (13) and return to game | ||
29814 | LD A,4 | Increase Current Character's happiness by 4... | ||
29816 | CALL 33569 | ... | ||
29819 | LD A,(29526) | Load A with index of Current Object | ||
29822 | CP 14 | If the selected object is the McTablet Food... | ||
29824 | JP Z,29907 | ...then skip ahead to 29907 | ||
29827 | LD A,(29632) | Point IX at current inventory of Current Character... | ||
29830 | CALL 33585 | ... | ||
29833 | LD A,(IX+4) | If last inventory slot of character is not zero... | ||
29836 | OR A | ...(i.e. last inventory slot is occupied)... | ||
29837 | JP NZ,55212 | ...then display "[Character]'S HANDS ARE FULL" window (13) and return to game | ||
29840 | LD BC,1280 | Load B with 5 (five inventory slots) and C with zero | ||
29843 | LD A,(IX+0) | Load content of current inventory slot into A | ||
29846 | OR A | If this inventory slot is empty... | ||
29847 | JR Z,29858 | ...then skip ahead to 29858 | ||
29849 | CALL 33487 | Load A with weight of object in current slot... | ||
29852 | ADD A,C | ...and add to C (running total weight)... | ||
29853 | LD C,A | ... | ||
29854 | INC IX | Advance to next inventory slot | ||
29856 | DJNZ 29843 | Loop back to 29843 for next slot | ||
29858 | LD A,(29526) | Load A with index of Current Object | ||
29861 | CALL 33487 | Load A with weight of object being given... | ||
29864 | ADD A,C | ...and add this to total in C also... | ||
29865 | LD C,A | ... | ||
29866 | LD A,(29632) | Load A with index of Current Character | ||
29869 | LD E,0 | Point HL at character's current strength... | ||
29871 | CALL 33541 | ... | ||
29874 | LD A,(HL) | Load strength into A... | ||
29875 | AND 127 | ...and reset bit 7 (unused) | ||
29877 | CP C | If character's strength is less than total weight of objects... | ||
29878 | JP C,55217 | ...then display "[Character] IS NOT STRONG ENOUGH" window (13) and return to game | ||
29881 | CALL 33500 | Load A with Current Character's happiness level... | ||
29884 | CP 25 | ...and if this is less than 25... | ||
29886 | JP C,55222 | ...then display "[Character] DOES NOT WANT THE [Object]" window (13) and return to game | ||
29889 | LD A,(29526) | Load A with index of Current Object... | ||
29892 | LD (IX+0),A | ...and load this object into the character's first empty slot | ||
29895 | LD C,A | Load index of object into C | ||
29896 | LD B,5 | Remove object C from Magic Knight's current inventory (carrying)... | ||
29898 | LD HL,25164 | ... | ||
29901 | CALL 36254 | ... | ||
29904 | JP 29467 | Show Magic Knight's current inventory and jump back to main game loop | ||
29907 | CALL 33546 | Point IX at Current Character's current stats | ||
29910 | BIT 7,(IX+6) | If character's asleep flag is reset... | ||
29914 | JR Z,29930 | ...then skip ahead to 29930 | ||
29916 | LD A,28 | Draw window 28... | ||
29918 | CALL 34990 | ... | ||
29921 | LD HL,38361 | Point HL at "[Current Character's name] IS ASLEEP" text... | ||
29924 | CALL 34762 | ...and print to screen | ||
29927 | JP 29479 | Display "PRESS FIRE TO CONTINUE" window and wait for input and return to main game loop | ||
29930 | LD C,25 | Set strength increment to 25 | ||
29932 | LD A,(IX+0) | Load character's current strength into A... | ||
29935 | AND 127 | ... | ||
29937 | CALL 53703 | Increase value by 25, up to maximum of 100 | ||
29940 | LD C,A | Load updated strength value into C | ||
29941 | LD A,(IX+0) | Load updated strength back into character's stats... | ||
29944 | AND 128 | ...preserving bit 7 (see trivia) | ||
29946 | ADD A,C | ... | ||
29947 | LD (IX+0),A | ... | ||
29950 | LD C,20 | Set stamina increment to 20 | ||
29952 | LD A,(IX+2) | Load character's current stamina into A... | ||
29955 | AND 127 | ... | ||
29957 | CALL 53703 | Increase value by 20, up to maximum of 100 | ||
29960 | LD C,A | Load updated stamina value into C | ||
29961 | LD A,(IX+2) | Load updated stamina back into character's stats... | ||
29964 | AND 128 | ...preserving bit 7 (see trivia) | ||
29966 | ADD A,C | ... | ||
29967 | LD (IX+2),A | ... | ||
29970 | LD A,(23672) | Load A with LSB of frame counter (pseudo-random number) | ||
29973 | AND 3 | Discard all but lower two bits, leaving a random number between 0 - 3 (inclusive) | ||
29975 | LD B,A | Load this number into B | ||
29976 | LD HL,44276 | Point HL at start of character's responses to McTablet flavours | ||
29979 | CALL 54269 | Advance HL to B-th entry in list of zero-terminated strings starting at HL | ||
29982 | LD DE,37195 | Adjust height of window 13 to accommodate text... | ||
29985 | CALL 33774 | ... | ||
29988 | PUSH HL | Store HL (pointer to start of text to print) | ||
29989 | LD A,13 | Draw window 13... | ||
29991 | CALL 34990 | ... | ||
29994 | POP HL | Restore HL (pointer to start of text to print) | ||
29995 | CALL 34762 | Print text to screen | ||
29998 | JP 29479 | Display "PRESS FIRE TO CONTINUE" window and wait for input and return to main game loop |
Prev: 29619 | Up: Map | Next: 30001 |