33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
Uint32 move_number;
unsigned char*quiz_text;
Inventory*inventory;
Uint32 ninventory;
char**levelstrings;
Uint16 nlevelstrings;
Value*array_data;
typedef struct {
Uint16 msg;
Uint32 from;
Value arg1,arg2,arg3;
} MessageVars;
|
>
>
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
Uint32 move_number;
unsigned char*quiz_text;
Inventory*inventory;
Uint32 ninventory;
char**levelstrings;
Uint16 nlevelstrings;
Value*array_data;
Uint16 ndeadanim;
DeadAnimation*deadanim;
typedef struct {
Uint16 msg;
Uint32 from;
Value arg1,arg2,arg3;
} MessageVars;
|
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
return n;
bad:
free(o);
return VOIDLINK;
}
#define animfree free
void objtrash(Uint32 n) {
Object*o=objects[n];
if(!o) return;
if(n==traced_obj.u && o->generation==traced_obj.t && main_options['t'] && !main_options['e']) {
printf("# Object traced at (%d,%d)\n",o->x,o->y);
Throw("Object traced");
}
animfree(o->anim);
if(o->down==VOIDLINK) playfield[o->x+o->y*64-65]=o->up;
else objects[o->down]->up=o->up;
if(o->up!=VOIDLINK) objects[o->up]->down=o->down;
if(!(o->oflags&OF_DESTROYED)) {
if(firstobj==n) firstobj=o->next;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>
>
|
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
return n;
bad:
free(o);
return VOIDLINK;
}
#define animfree free
static void set_dead_animation(const Object*o) {
DeadAnimation*d;
deadanim=realloc(deadanim,(ndeadanim+1)*sizeof(DeadAnimation));
if(!deadanim) fatal("Allocation failed\n");
d=deadanim+ndeadanim++;
d->class=o->class;
d->x=o->x;
d->y=o->y;
d->s=o->anim->step[o->anim->vstep];
d->vtime=o->anim->vtime;
d->vimage=o->anim->vimage;
}
void objtrash(Uint32 n) {
Object*o=objects[n];
if(!o) return;
if(!main_options['e']) {
if(n==traced_obj.u && o->generation==traced_obj.t && main_options['t']) {
printf("# Object traced at (%d,%d)\n",o->x,o->y);
Throw("Object traced");
} else if(ndeadanim<0x1000 && o->anim && o->anim->status==ANISTAT_VISUAL && !(o->oflags&OF_INVISIBLE)) {
if(o->up==VOIDLINK || (objects[o->up]->oflags&OF_DESTROYED)) set_dead_animation(o);
}
}
animfree(o->anim);
if(o->down==VOIDLINK) playfield[o->x+o->y*64-65]=o->up;
else objects[o->down]->up=o->up;
if(o->up!=VOIDLINK) objects[o->up]->down=o->down;
if(!(o->oflags&OF_DESTROYED)) {
if(firstobj==n) firstobj=o->next;
|
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
|
nobjects=0;
free(objects);
objects=0;
gameover=0;
clear_inventory();
for(i=0;i<nlevelstrings;i++) free(levelstrings[i]);
nlevelstrings=0;
}
static void execute_animation(Uint32 obj) {
Object*o=objects[obj];
Animation*a=o->anim;
if(!(a->step[a->lstep].flag&ANI_ONCE)) return;
if(a->ltime>=a->step[a->lstep].speed) {
|
>
>
>
|
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
|
nobjects=0;
free(objects);
objects=0;
gameover=0;
clear_inventory();
for(i=0;i<nlevelstrings;i++) free(levelstrings[i]);
nlevelstrings=0;
free(deadanim);
deadanim=0;
ndeadanim=0;
}
static void execute_animation(Uint32 obj) {
Object*o=objects[obj];
Animation*a=o->anim;
if(!(a->step[a->lstep].flag&ANI_ONCE)) return;
if(a->ltime>=a->step[a->lstep].speed) {
|