62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
+
|
if(m!=VOIDLINK) objects[m]->down=n;
}
}
#define OBJECT_ARRAY_BLOCK 256
Uint32 objalloc(Uint16 c) {
// Allocates a new object of the given class; links into the event list but not into the playfield.
// All fields are initialized by the class or to zero.
// Does not send any messages or otherwise notify anyone that it has been created.
// Returns VOIDLINK if object cannot be created.
Uint32 n;
Class*cl=classes[c];
Object*o=calloc(1,sizeof(Object)+cl->uservars*sizeof(Value));
if(!c || !cl || cl->cflags&(CF_GROUP|CF_NOCLASS1|CF_NOCLASS2)) goto bad;
if(!o) fatal("Allocation failed\n");
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
+
+
-
-
|
execute_program(code,p,to);
msgvars=saved;
}
void annihilate(void) {
Uint32 i;
for(i=0;i<64*64;i++) playfield[i]=VOIDLINK;
firstobj=lastobj=VOIDLINK;
if(!objects) return;
for(i=0;i<nobjects;i++) free(objects[i]);
nobjects=0;
free(objects);
objects=0;
firstobj=lastobj=VOIDLINK;
for(i=0;i<64*64;i++) playfield[i]=VOIDLINK;
}
const char*execute_turn(int key) {
if(setjmp(my_env)) return my_error;
lastimage_processing=0;
return 0;
}
|