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.
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.
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/>.
16 ; monster_tid: monster tid
18 set [rst_result], entry_die_monster
24 set [rst_result], entry_die_fall
29 ; monster_tid: monster thread id or -1
30 ; rst_result: new thread PC
34 ; create and init animation thread
35 new [rst_result], [.tid]
36 set monster_tid, [monster_tid], [.tid]
37 set pos_x, [pos_x], [.tid]
38 set pos_y, [pos_y], [.tid]
39 set spr_bank, [spr_bank], [.tid]
40 set spr_num, [spr_num], [.tid]
41 set spr_dir, [spr_dir], [.tid]
43 set [spr_num], -1 ; hide 'original' prof
48 jeq .waitthread, THREAD_STATE_RUNNING
50 set [game_state], GAME_STATE_DEAD
51 jmp game_wait_and_restart
55 proc: game_wait_and_restart
63 jne .dorestart, [key_use], 0
64 jne .dorestart, [key_start], 0
65 jne .dorestart, [key_take], 0
69 jmp entry_game_restart_level
70 endp: game_wait_and_restart
73 /* thread: prof blinks and falls dead */
76 jeq .facing, [spr_num], PSPR_FACING
78 set [spr_num], PSPR_TURNING
81 set [spr_dir], DIR_LEFT
82 set [spr_num], PSPR_FACING
89 set [spr_num], PSPR_CLOSED_EYES
92 set [spr_num], PSPR_FACING
96 jgt .deadloop, [.f], 0
98 set [spr_num], PSPR_CLOSED_EYES
103 jle .animloop, [spr_num], PSPR_LYING_DEAD
105 set spr_num, PSPR_LYING_DEAD, 0
106 rst FRST_PLAY_SOUND, SND_PROF_FALLS_DEAD
111 /* thread: prof eaten by Harry */
112 proc: entry_die_monster
113 rst FRST_PLAY_SOUND, SND_HARRY_EATS_PROF
114 jeq .facing, [spr_num], PSPR_FACING
116 set [spr_num], PSPR_TURNING
119 set [spr_dir], DIR_LEFT
120 set [spr_num], PSPR_FACING
124 ; suspend monster thread (so Harry will not be drawn)
127 set [spr_num], PSPR_HARRY_EATS_PROF_START
133 jle .animloop, [spr_num], PSPR_HARRY_EATS_PROF_END
134 ; resume monster thread (so Harry will be drawn again)
137 endp: entry_die_monster
140 proc: wait_some_frames
149 endp: wait_some_frames