Prev: 46106 Up: Map Next: 46315
46183: Set Magic Knight's available action flags
Used by the routines at 38024, 39393, 41578, 42494 and 43636.
Input
IY 23610
46183 LD HL,0 Reset all available in-game menu command flags...
46186 LD (23698),HL ...
46189 LD A,3 If Magic Knight is not carrying the Wand of Command...
46191 CALL 45510 ...
46194 JR NZ,46200 ...then skip ahead to 46200
46196 SET 0,(IY+88) Set command-a-character-enabled menu command flag
46200 LD A,(24771) Load A with Magic Knight's current magic level...
46203 AND 127 ...stripping out unused bit
46205 JR Z,46211 If magic level is zero then skip ahead to 46211
46207 SET 5,(IY+88) Set cast-a-spell-enabled menu command flag
46211 LD A,(23702) If Magic Knight's current room is 1 (Outdoors, 0, Bearwoolf's Hoard)...
46214 CP 1 ...
46216 JR Z,46233 ...then skip ahead to 46233
46218 CP 2 If Magic Knight's current room is 2 (Outdoors, 1, Bearwoolf's Cave)...
46220 JR Z,46233 ...then skip ahead to 46233
46222 LD A,31 If Magic Knight is not carrying the Teleport Key...
46224 CALL 45510 ...
46227 JR NZ,46233 ...then skip ahead to 46233
46229 SET 2,(IY+88) Set teleport-enabled menu command flag
46233 LD A,10 If Magic Knight is not carrying the Horse Feather...
46235 CALL 45510 ...
46238 JR NZ,46244 ...then skip ahead to 46244
46240 SET 0,(IY+89) Set tickle-a-character-enabled menu command flag
46244 XOR A Load C with weights / flags of all Magic Knight's carried objects, OR-ed together...
46245 CALL 46380 ...
46248 BIT 5,C ...and if can-be-read flag is not set for any of the objects...
46250 JR Z,46256 ...then skip ahead to 46256
46252 SET 3,(IY+88) Set read-something-enabled menu command flag
46256 BIT 6,C If can-be-blown flag is not set for any of the objects...
46258 JR Z,46264 ...then skip ahead to 46264
46260 SET 6,(IY+88) Set blow-something-enabled menu command flag
46264 LD A,1 Load C with flags (2) of all Magic Knight's carried objects, OR-ed together...
46266 CALL 46380 ...
46269 BIT 3,C ...and if can-be-worn flag is set for at least one of the objects...
46271 JR NZ,46279 ...then skip ahead to 46279
46273 LD A,(24853) If Magic Knight's first inventory slot (wearing) is empty...
46276 OR A ...
46277 JR Z,46283 ...then skip ahead to 46283
46279 SET 7,(IY+88) Set wear/unwear-object-enabled menu command flag
46283 LD A,1 Load A with flags (2) of all Magic Knight's carried objects, OR-ed together...
46285 CALL 46380 ...
46288 LD A,C ...
46289 AND 224 If bits 5 (first can-be-thrown flag) 6 (can-be-thrown-and-is-lethal flag) and 7 (second can-be-thrown flag) are all reset...
46291 JR Z,46297 ...then skip ahead to 46297
46293 SET 4,(IY+88) Set throw-something-enabled menu command flag
46297 LD A,(23702) Load B with Magic Knight's current room...
46300 LD B,A ...
46301 LD HL,46315 Load HL with start address of list of indices of rooms with levers
46304 LD A,(HL) If current index is the same as Magic Knight's current room...
46305 CP B ...
46306 JR Z,46326 ...then set additional action flags including pull-lever-enabled and return
46308 CP 255 If current index is 255 (end marker)...
46310 JR Z,46330 ...then set additional action flags excluding pull-lever-enabled and return
46312 INC HL Advance HL to next room in list
46313 JR 46304 Loop back to 46304
Prev: 46106 Up: Map Next: 46315