Blame | Last modification | View Log | Download | RSS feed
### What is the difference between autocontrol, control and anim?Autocontrol: where keypresses are generated. (guards, demo)Control: where sequences are activated based on keystrokes and other things.Anim: where sequences are interpreted.### What is the difference between frame, image and resource?frame: An index into the frame table.Also an unit of time = 1/12 seconds. (1/10 s when fighting.)image: 0-based index within a chtabresource: ID in DAT file, image + palette_resource_id + 1### What is a chtab?It's a collection of images, with a common palette.The game uses these chtabs:0: sword (in someone's hand) (PRINCE, 700)1: flame, sword (on floor), potion (PRINCE, 150)2: kid (KID, 400)3: princess in intro (PV, 800)4: Jaffar in intro (PV, 850), princess in cutscenes (PV, 900)5: guard (GUARD/SKEL/FAT/SHADOW/VIZIER, 750)6: environment (except wall) (VDUNGEON/VPALACE, 200)7: environment wall (VDUNGEON/VPALACE, 360)8: princess room (PV, 950)9: princess bed (PV, 980)### What tables are there?seqtbl[]: contains the sequence codesseqtbl_offsets[]: contains the offsets (addresses) of the various sequencesframe_table_kid[]: contains the data of the kid's framesframe_tbl_guard[]: contains the data of the guards' framesframe_tbl_cuts[]: contains the data of the cutscenes' frames (princess, Jaffar)sword_tbl[]: contains the data of the sword's frames### What's in the frame tables?(used in load_frame())For each frame:image0-based indexswordbits 0..5: sword frame (0-based index into the sword table)bits 6..7: chtab (add 2: 00=2, 01=3, 10=4, 11=5)dxdelta x from char's position to image's position (+ = forward)dydelta y from char's position to image's position (+ = down)flagsbits 0..4: x-position of weight (backward, that is right on the image)bit 5: "thin" this frame for collision detection (used in set_char_collision())bit 6: needs floor (used in check_on_floor() and check_press())bit 7: even/odd pixel (used in load_frame_to_obj())### What's in the sequence table?The sequence table is a list of frame indexes and commands.sequence codes: (used in play_seq())0x00..0xF0: show frame with this index0xF1: end level0xF2 n: play sound0xF3 n: get item if n=10xF4: knock down (loose floors will shake in char's row)0xF5: knock up (loose floors will shake in row above char's row)0xF6: nothing0xF7 l h: jump to hl if slow-fall is active0xF8 x y: set falling speed (x: + = forward, y: + = down)0xF9 n: set action0xFA y: move y pixels (+ = down)0xFB x: move x pixels (+ = forward)0xFC: go down one row (does not change y coordinate)0xFD: go up one row (does not change y coordinate)0xFE: flip0xFF l h: jump to hl### What's in the sequence offset table?sequence indexes:See internals_sequence-index.csv### How are images drawn at given coordinates?Coordinates give the bottom left of the image.For flipped images, it's the bottom right of the flipped image.### How are x coordinates counted?Char:58=left198=rightone tile is 14 units wide||load_frame_to_obj()VObject:0=left280=rightone tile is 28 units wide||calc_screen_x_coord()VScreen:0=left320=rightone tile is 32 units wide### What is stored about characters?(struct char_type)frameIndex of current frame.The used frame table depends on charid.xx-position in the Char coordinate system.yy-positiondirection0x00 (>=0): right (image is flipped)0x56: none (for guards)0xFF (<0): left (image is not flipped)curr_colCurrent column, 0..9 is in the current room.curr_rowCurrent row, 0..2 is in the current room.action0: stand1: run, jump2: hang, climb3: in midair4: in freefall5: bumped6: hang straight7: turn99: char is hurt by swordfall_xx-speed of falling (+ = forward)fall_yy-speed of falling (+ = down)roomCurrent room.repeat(used in safe_step())0: may step off edge1: won't step off edgecharidWho is this?Its value decides which frame table to use (in load_frame()), and various things about char's behaviour.0: kid1: shadow2: guard4: skeleton5: princess6: vizier (in intro)0x18: mousesword0: not holding sword2: holding swordalive<0: is alive>=0: is deadcurr_seqCurrent position (address) in the sequence table.