Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | pmbaty | 1 | ### What is the difference between autocontrol, control and anim? |
| 2 | |||
| 3 | Autocontrol: where keypresses are generated. (guards, demo) |
||
| 4 | Control: where sequences are activated based on keystrokes and other things. |
||
| 5 | Anim: where sequences are interpreted. |
||
| 6 | |||
| 7 | ### What is the difference between frame, image and resource? |
||
| 8 | |||
| 9 | frame: An index into the frame table. |
||
| 10 | Also an unit of time = 1/12 seconds. (1/10 s when fighting.) |
||
| 11 | image: 0-based index within a chtab |
||
| 12 | resource: ID in DAT file, image + palette_resource_id + 1 |
||
| 13 | |||
| 14 | ### What is a chtab? |
||
| 15 | |||
| 16 | It's a collection of images, with a common palette. |
||
| 17 | The game uses these chtabs: |
||
| 18 | 0: sword (in someone's hand) (PRINCE, 700) |
||
| 19 | 1: flame, sword (on floor), potion (PRINCE, 150) |
||
| 20 | 2: kid (KID, 400) |
||
| 21 | 3: princess in intro (PV, 800) |
||
| 22 | 4: Jaffar in intro (PV, 850), princess in cutscenes (PV, 900) |
||
| 23 | 5: guard (GUARD/SKEL/FAT/SHADOW/VIZIER, 750) |
||
| 24 | 6: environment (except wall) (VDUNGEON/VPALACE, 200) |
||
| 25 | 7: environment wall (VDUNGEON/VPALACE, 360) |
||
| 26 | 8: princess room (PV, 950) |
||
| 27 | 9: princess bed (PV, 980) |
||
| 28 | |||
| 29 | ### What tables are there? |
||
| 30 | |||
| 31 | seqtbl[]: contains the sequence codes |
||
| 32 | seqtbl_offsets[]: contains the offsets (addresses) of the various sequences |
||
| 33 | frame_table_kid[]: contains the data of the kid's frames |
||
| 34 | frame_tbl_guard[]: contains the data of the guards' frames |
||
| 35 | frame_tbl_cuts[]: contains the data of the cutscenes' frames (princess, Jaffar) |
||
| 36 | sword_tbl[]: contains the data of the sword's frames |
||
| 37 | |||
| 38 | ### What's in the frame tables? |
||
| 39 | |||
| 40 | (used in load_frame()) |
||
| 41 | For each frame: |
||
| 42 | image |
||
| 43 | 0-based index |
||
| 44 | sword |
||
| 45 | bits 0..5: sword frame (0-based index into the sword table) |
||
| 46 | bits 6..7: chtab (add 2: 00=2, 01=3, 10=4, 11=5) |
||
| 47 | dx |
||
| 48 | delta x from char's position to image's position (+ = forward) |
||
| 49 | dy |
||
| 50 | delta y from char's position to image's position (+ = down) |
||
| 51 | flags |
||
| 52 | bits 0..4: x-position of weight (backward, that is right on the image) |
||
| 53 | bit 5: "thin" this frame for collision detection (used in set_char_collision()) |
||
| 54 | bit 6: needs floor (used in check_on_floor() and check_press()) |
||
| 55 | bit 7: even/odd pixel (used in load_frame_to_obj()) |
||
| 56 | |||
| 57 | ### What's in the sequence table? |
||
| 58 | |||
| 59 | The sequence table is a list of frame indexes and commands. |
||
| 60 | |||
| 61 | sequence codes: (used in play_seq()) |
||
| 62 | 0x00..0xF0: show frame with this index |
||
| 63 | 0xF1: end level |
||
| 64 | 0xF2 n: play sound |
||
| 65 | 0xF3 n: get item if n=1 |
||
| 66 | 0xF4: knock down (loose floors will shake in char's row) |
||
| 67 | 0xF5: knock up (loose floors will shake in row above char's row) |
||
| 68 | 0xF6: nothing |
||
| 69 | 0xF7 l h: jump to hl if slow-fall is active |
||
| 70 | 0xF8 x y: set falling speed (x: + = forward, y: + = down) |
||
| 71 | 0xF9 n: set action |
||
| 72 | 0xFA y: move y pixels (+ = down) |
||
| 73 | 0xFB x: move x pixels (+ = forward) |
||
| 74 | 0xFC: go down one row (does not change y coordinate) |
||
| 75 | 0xFD: go up one row (does not change y coordinate) |
||
| 76 | 0xFE: flip |
||
| 77 | 0xFF l h: jump to hl |
||
| 78 | |||
| 79 | ### What's in the sequence offset table? |
||
| 80 | |||
| 81 | sequence indexes: |
||
| 82 | See internals_sequence-index.csv |
||
| 83 | |||
| 84 | ### How are images drawn at given coordinates? |
||
| 85 | |||
| 86 | Coordinates give the bottom left of the image. |
||
| 87 | For flipped images, it's the bottom right of the flipped image. |
||
| 88 | |||
| 89 | ### How are x coordinates counted? |
||
| 90 | |||
| 91 | Char: |
||
| 92 | 58=left |
||
| 93 | 198=right |
||
| 94 | one tile is 14 units wide |
||
| 95 | | |
||
| 96 | |load_frame_to_obj() |
||
| 97 | V |
||
| 98 | Object: |
||
| 99 | 0=left |
||
| 100 | 280=right |
||
| 101 | one tile is 28 units wide |
||
| 102 | | |
||
| 103 | |calc_screen_x_coord() |
||
| 104 | V |
||
| 105 | Screen: |
||
| 106 | 0=left |
||
| 107 | 320=right |
||
| 108 | one tile is 32 units wide |
||
| 109 | |||
| 110 | ### What is stored about characters? |
||
| 111 | |||
| 112 | (struct char_type) |
||
| 113 | frame |
||
| 114 | Index of current frame. |
||
| 115 | The used frame table depends on charid. |
||
| 116 | x |
||
| 117 | x-position in the Char coordinate system. |
||
| 118 | y |
||
| 119 | y-position |
||
| 120 | direction |
||
| 121 | 0x00 (>=0): right (image is flipped) |
||
| 122 | 0x56: none (for guards) |
||
| 123 | 0xFF (<0): left (image is not flipped) |
||
| 124 | curr_col |
||
| 125 | Current column, 0..9 is in the current room. |
||
| 126 | curr_row |
||
| 127 | Current row, 0..2 is in the current room. |
||
| 128 | action |
||
| 129 | 0: stand |
||
| 130 | 1: run, jump |
||
| 131 | 2: hang, climb |
||
| 132 | 3: in midair |
||
| 133 | 4: in freefall |
||
| 134 | 5: bumped |
||
| 135 | 6: hang straight |
||
| 136 | 7: turn |
||
| 137 | 99: char is hurt by sword |
||
| 138 | fall_x |
||
| 139 | x-speed of falling (+ = forward) |
||
| 140 | fall_y |
||
| 141 | y-speed of falling (+ = down) |
||
| 142 | room |
||
| 143 | Current room. |
||
| 144 | repeat |
||
| 145 | (used in safe_step()) |
||
| 146 | 0: may step off edge |
||
| 147 | 1: won't step off edge |
||
| 148 | charid |
||
| 149 | Who is this? |
||
| 150 | Its value decides which frame table to use (in load_frame()), and various things about char's behaviour. |
||
| 151 | 0: kid |
||
| 152 | 1: shadow |
||
| 153 | 2: guard |
||
| 154 | 4: skeleton |
||
| 155 | 5: princess |
||
| 156 | 6: vizier (in intro) |
||
| 157 | 0x18: mouse |
||
| 158 | sword |
||
| 159 | 0: not holding sword |
||
| 160 | 2: holding sword |
||
| 161 | alive |
||
| 162 | <0: is alive |
||
| 163 | >=0: is dead |
||
| 164 | curr_seq |
||
| 165 | Current position (address) in the sequence table. |