fixed game logic bug with jumping; fixed demo saving
[awish.git] / asm / game / jumps.awa
blob8de900d3b389b068c621d05f9ad603cce6324a33
1 /*
2  * This program is free software: you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
14  */
15 prof_jump_coords:
16   db: 1, 4
17   db: 3, 6
18   db: 5, 8
19   db: 7, 10
20   db: 9, 12
21   db: 11, 14
22   db: 13, 16
23   db: 15, 14
24   db: 17, 12
25   db: 19, 10
26   db: 255
29 proc: game_jump_animation
30 locals: .ptr, .dx, .dy
31   set [spr_num], PSPR_JUMPING
32   set [.ptr], prof_jump_coords
33 .loop:
34   rxc [.ptr], [.dx]
35   jeq .done, [.dx], 255
36   add [.ptr], 1
37   rxc [.ptr], [.dy]
38   add [.ptr], 1
39   ;
40   mul [.dx], [prof_dir]
41   mul [.dy], -1
42   ;
43   set [pos_tx], [.dx]
44   set [pos_ty], [.dy]
45   bsr game_next_frame
46   jmp .loop
47   ;
48 .done:
49   set [spr_num], PSPR_STANDING
50   set [pos_tx], 0
51   set [pos_ty], 0
52   add [pos_x], [prof_dir]
53   sub [pos_y], 1
54   bsr prof_fix_position
55   bsr game_check_fall
56   ; returns only on succesfull landing
57   bsr game_do_scrolls
58   ret
59 endp: game_jump_animation
62 proc: game_do_jump
63   bsr prof_allowed_move_in_dir
64   bsr game_can_jump
65   jeq .nojump, 0
66   ; jump is allowed
67   bsr game_do_down_brick
68   bsr game_jump_animation
69   ; slide?
70   bsr game_check_do_slide
71   ret 1
72 .nojump:
73   ret 0
74 endp: game_do_jump