1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#if 0
gcc ${CFLAGS:--s -O2} -c exec.c `sdl-config --cflags`
exit
#endif
#include "SDL.h"
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sqlite3.h"
#include "smallxrm.h"
#include "heromesh.h"
Uint32 generation_number;
Object**objects;
Uint32 nobjects;
Value globals[0x800];
Uint32 firstobj=VOIDLINK;
Uint32 lastobj=VOIDLINK;
|
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#if 0
gcc ${CFLAGS:--s -O2} -c exec.c `sdl-config --cflags`
exit
#endif
#include "SDL.h"
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sqlite3.h"
#include "smallxrm.h"
#include "heromesh.h"
#include "instruc.h"
Uint32 generation_number;
Object**objects;
Uint32 nobjects;
Value globals[0x800];
Uint32 firstobj=VOIDLINK;
Uint32 lastobj=VOIDLINK;
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
case OP_RET: return;
default: Throw("Internal error: Unrecognized opcode");
}
}
static Value send_message(Uint32 from,Uint32 to,Uint16 msg,Value arg1,Value arg2,Value arg3) {
MessageVars saved=msgvars;
Uint16 c=classes[objects[to]->class];
Uint16 p=get_message_ptr(c,msg);
Uint16*code;
if(p==0xFFFF) {
p=get_message_ptr(0,msg);
if(!p) return NVALUE(0);
code=classes[0]->codes;
} else {
code=classes[c]->codes;
}
msgvars={msg,from,arg1,arg2,arg3};
execute_program(code,p,to);
msgvars=saved;
}
void annihilate(void) {
Uint32 i;
|
|
|
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
case OP_RET: return;
default: Throw("Internal error: Unrecognized opcode");
}
}
static Value send_message(Uint32 from,Uint32 to,Uint16 msg,Value arg1,Value arg2,Value arg3) {
MessageVars saved=msgvars;
Uint16 c=objects[to]->class;
Uint16 p=get_message_ptr(c,msg);
Uint16*code;
if(p==0xFFFF) {
p=get_message_ptr(0,msg);
if(!p) return NVALUE(0);
code=classes[0]->codes;
} else {
code=classes[c]->codes;
}
msgvars=(MessageVars){msg,from,arg1,arg2,arg3};
execute_program(code,p,to);
msgvars=saved;
}
void annihilate(void) {
Uint32 i;
|