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 set [endgame_layer_proc], endgame_layer_dead
52 jmp game_wait_and_restart
56 proc: game_wait_and_restart
63 bsr [endgame_layer_proc]
65 jne .dorestart, [key_use], 0
66 jne .dorestart, [key_start], 0
67 jne .dorestart, [key_take], 0
71 jmp entry_game_restart_level
72 endp: game_wait_and_restart
75 /* thread: prof blinks and falls dead */
78 jeq .facing, [spr_num], PSPR_FACING
80 set [spr_num], PSPR_TURNING
83 set [spr_dir], DIR_LEFT
84 set [spr_num], PSPR_FACING
91 set [spr_num], PSPR_CLOSED_EYES
94 set [spr_num], PSPR_FACING
98 jgt .deadloop, [.f], 0
100 set [spr_num], PSPR_CLOSED_EYES
105 jle .animloop, [spr_num], PSPR_LYING_DEAD
107 set spr_num, PSPR_LYING_DEAD, 0
108 rst FRST_PLAY_SOUND, SND_PROF_FALLS_DEAD
113 /* thread: prof eaten by Harry */
114 proc: entry_die_monster
115 rst FRST_PLAY_SOUND, SND_HARRY_EATS_PROF
116 jeq .facing, [spr_num], PSPR_FACING
118 set [spr_num], PSPR_TURNING
121 set [spr_dir], DIR_LEFT
122 set [spr_num], PSPR_FACING
126 ; suspend monster thread (so Harry will not be drawn)
129 set [spr_num], PSPR_HARRY_EATS_PROF_START
135 jle .animloop, [spr_num], PSPR_HARRY_EATS_PROF_END
136 ; resume monster thread (so Harry will be drawn again)
139 endp: entry_die_monster
142 proc: wait_some_frames
151 endp: wait_some_frames