]> icculus.org git repositories - divverent/darkplaces.git/blob - prvm_execprogram.h
changed blaze.mindphukd.org back to an ip address because the hostname isn't resolvin...
[divverent/darkplaces.git] / prvm_execprogram.h
1
2 // This code isn't #ifdef/#define protectable, don't try.
3
4                 while (1)
5                 {
6                         st++;
7                         if (++profile > 10000000) // LordHavoc: increased runaway loop limit 100x
8                         {
9                                 // LordHavoc: update profile counter for debugging reasons
10                                 // (identifying erroneous loops and recursion patterns)
11                                 prog->xfunction->profile += profile - startprofile;
12                                 startprofile = profile;
13                                 // update the statement number before we error out
14                                 prog->xstatement = st - prog->statements;
15                                 PRVM_ERROR("runaway loop counter hit limit of %d opcodes\ntip: if having trouble identifying the problem, try typing profile now in %s", profile, PRVM_NAME);
16                         }
17
18 #if PRVMTRACE
19                         prog->xfunction->profile += profile - startprofile;
20                         startprofile = profile;
21                         prog->xstatement = st - prog->statements;
22                         PRVM_PrintStatement(st);
23 #endif
24
25                         switch (st->op)
26                         {
27                         case OP_ADD_F:
28                                 OPC->_float = OPA->_float + OPB->_float;
29                                 break;
30                         case OP_ADD_V:
31                                 OPC->vector[0] = OPA->vector[0] + OPB->vector[0];
32                                 OPC->vector[1] = OPA->vector[1] + OPB->vector[1];
33                                 OPC->vector[2] = OPA->vector[2] + OPB->vector[2];
34                                 break;
35                         case OP_SUB_F:
36                                 OPC->_float = OPA->_float - OPB->_float;
37                                 break;
38                         case OP_SUB_V:
39                                 OPC->vector[0] = OPA->vector[0] - OPB->vector[0];
40                                 OPC->vector[1] = OPA->vector[1] - OPB->vector[1];
41                                 OPC->vector[2] = OPA->vector[2] - OPB->vector[2];
42                                 break;
43                         case OP_MUL_F:
44                                 OPC->_float = OPA->_float * OPB->_float;
45                                 break;
46                         case OP_MUL_V:
47                                 OPC->_float = OPA->vector[0]*OPB->vector[0] + OPA->vector[1]*OPB->vector[1] + OPA->vector[2]*OPB->vector[2];
48                                 break;
49                         case OP_MUL_FV:
50                                 OPC->vector[0] = OPA->_float * OPB->vector[0];
51                                 OPC->vector[1] = OPA->_float * OPB->vector[1];
52                                 OPC->vector[2] = OPA->_float * OPB->vector[2];
53                                 break;
54                         case OP_MUL_VF:
55                                 OPC->vector[0] = OPB->_float * OPA->vector[0];
56                                 OPC->vector[1] = OPB->_float * OPA->vector[1];
57                                 OPC->vector[2] = OPB->_float * OPA->vector[2];
58                                 break;
59                         case OP_DIV_F:
60                                 OPC->_float = OPA->_float / OPB->_float;
61                                 break;
62                         case OP_BITAND:
63                                 OPC->_float = (int)OPA->_float & (int)OPB->_float;
64                                 break;
65                         case OP_BITOR:
66                                 OPC->_float = (int)OPA->_float | (int)OPB->_float;
67                                 break;
68                         case OP_GE:
69                                 OPC->_float = OPA->_float >= OPB->_float;
70                                 break;
71                         case OP_LE:
72                                 OPC->_float = OPA->_float <= OPB->_float;
73                                 break;
74                         case OP_GT:
75                                 OPC->_float = OPA->_float > OPB->_float;
76                                 break;
77                         case OP_LT:
78                                 OPC->_float = OPA->_float < OPB->_float;
79                                 break;
80                         case OP_AND:
81                                 OPC->_float = OPA->_float && OPB->_float;
82                                 break;
83                         case OP_OR:
84                                 OPC->_float = OPA->_float || OPB->_float;
85                                 break;
86                         case OP_NOT_F:
87                                 OPC->_float = !OPA->_float;
88                                 break;
89                         case OP_NOT_V:
90                                 OPC->_float = !OPA->vector[0] && !OPA->vector[1] && !OPA->vector[2];
91                                 break;
92                         case OP_NOT_S:
93                                 OPC->_float = !OPA->string || !*PRVM_GetString(OPA->string);
94                                 break;
95                         case OP_NOT_FNC:
96                                 OPC->_float = !OPA->function;
97                                 break;
98                         case OP_NOT_ENT:
99                                 OPC->_float = (OPA->edict == 0);
100                                 break;
101                         case OP_EQ_F:
102                                 OPC->_float = OPA->_float == OPB->_float;
103                                 break;
104                         case OP_EQ_V:
105                                 OPC->_float = (OPA->vector[0] == OPB->vector[0]) && (OPA->vector[1] == OPB->vector[1]) && (OPA->vector[2] == OPB->vector[2]);
106                                 break;
107                         case OP_EQ_S:
108                                 OPC->_float = !strcmp(PRVM_GetString(OPA->string),PRVM_GetString(OPB->string));
109                                 break;
110                         case OP_EQ_E:
111                                 OPC->_float = OPA->_int == OPB->_int;
112                                 break;
113                         case OP_EQ_FNC:
114                                 OPC->_float = OPA->function == OPB->function;
115                                 break;
116                         case OP_NE_F:
117                                 OPC->_float = OPA->_float != OPB->_float;
118                                 break;
119                         case OP_NE_V:
120                                 OPC->_float = (OPA->vector[0] != OPB->vector[0]) || (OPA->vector[1] != OPB->vector[1]) || (OPA->vector[2] != OPB->vector[2]);
121                                 break;
122                         case OP_NE_S:
123                                 OPC->_float = strcmp(PRVM_GetString(OPA->string),PRVM_GetString(OPB->string));
124                                 break;
125                         case OP_NE_E:
126                                 OPC->_float = OPA->_int != OPB->_int;
127                                 break;
128                         case OP_NE_FNC:
129                                 OPC->_float = OPA->function != OPB->function;
130                                 break;
131
132                 //==================
133                         case OP_STORE_F:
134                         case OP_STORE_ENT:
135                         case OP_STORE_FLD:              // integers
136                         case OP_STORE_S:
137                         case OP_STORE_FNC:              // pointers
138                                 OPB->_int = OPA->_int;
139                                 break;
140                         case OP_STORE_V:
141                                 OPB->ivector[0] = OPA->ivector[0];
142                                 OPB->ivector[1] = OPA->ivector[1];
143                                 OPB->ivector[2] = OPA->ivector[2];
144                                 break;
145
146                         case OP_STOREP_F:
147                         case OP_STOREP_ENT:
148                         case OP_STOREP_FLD:             // integers
149                         case OP_STOREP_S:
150                         case OP_STOREP_FNC:             // pointers
151 #if PRVMBOUNDSCHECK
152                                 if (OPB->_int < 0 || OPB->_int + 4 > prog->edictareasize)
153                                 {
154                                         prog->xfunction->profile += profile - startprofile;
155                                         startprofile = profile;
156                                         prog->xstatement = st - prog->statements;
157                                         PRVM_ERROR("%s attempted to write to an out of bounds edict (%i)\n", PRVM_NAME, OPB->_int);
158                                         return;
159                                 }
160 #endif
161                                 ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int);
162                                 ptr->_int = OPA->_int;
163                                 break;
164                         case OP_STOREP_V:
165 #if PRVMBOUNDSCHECK
166                                 if (OPB->_int < 0 || OPB->_int + 12 > prog->edictareasize)
167                                 {
168                                         prog->xfunction->profile += profile - startprofile;
169                                         startprofile = profile;
170                                         prog->xstatement = st - prog->statements;
171                                         PRVM_ERROR("%s attempted to write to an out of bounds edict (%i)\n", PRVM_NAME, OPB->_int);
172                                         return;
173                                 }
174 #endif
175                                 ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int);
176                                 ptr->vector[0] = OPA->vector[0];
177                                 ptr->vector[1] = OPA->vector[1];
178                                 ptr->vector[2] = OPA->vector[2];
179                                 break;
180
181                         case OP_ADDRESS:
182 #if PRVMBOUNDSCHECK
183                                 if ((unsigned int)(OPB->_int) >= (unsigned int)(prog->progs->entityfields))
184                                 {
185                                         prog->xfunction->profile += profile - startprofile;
186                                         startprofile = profile;
187                                         prog->xstatement = st - prog->statements;
188                                         PRVM_ERROR("%s attempted to address an invalid field (%i) in an edict\n", PRVM_NAME, OPB->_int);
189                                         return;
190                                 }
191 #endif
192                                 /*if (OPA->edict == 0 && sv.state == ss_active)
193                                 {
194                                         prog->xfunction->profile += profile - startprofile;
195                                         startprofile = profile;
196                                         prog->xstatement = st - prog->statements;
197                                         Host_Error("assignment to world entity in %s", PRVM_NAME);
198                                         return;
199                                 }*/
200                                 ed = PRVM_PROG_TO_EDICT(OPA->edict);
201                                 OPC->_int = (qbyte *)((int *)ed->v + OPB->_int) - (qbyte *)prog->edictsfields;
202                                 break;
203
204                         case OP_LOAD_F:
205                         case OP_LOAD_FLD:
206                         case OP_LOAD_ENT:
207                         case OP_LOAD_S:
208                         case OP_LOAD_FNC:
209 #if PRVMBOUNDSCHECK
210                                 if ((unsigned int)(OPB->_int) >= (unsigned int)(prog->progs->entityfields))
211                                 {
212                                         prog->xfunction->profile += profile - startprofile;
213                                         startprofile = profile;
214                                         prog->xstatement = st - prog->statements;
215                                         PRVM_ERROR("%s attempted to read an invalid field in an edict (%i)\n", PRVM_NAME, OPB->_int);
216                                         return;
217                                 }
218 #endif
219                                 ed = PRVM_PROG_TO_EDICT(OPA->edict);
220                                 OPC->_int = ((prvm_eval_t *)((int *)ed->v + OPB->_int))->_int;
221                                 break;
222
223                         case OP_LOAD_V:
224 #if PRVMBOUNDSCHECK
225                                 if (OPB->_int < 0 || OPB->_int + 2 >= prog->progs->entityfields)
226                                 {
227                                         prog->xfunction->profile += profile - startprofile;
228                                         startprofile = profile;
229                                         prog->xstatement = st - prog->statements;
230                                         PRVM_ERROR("%s attempted to read an invalid field in an edict (%i)\n", PRVM_NAME, OPB->_int);
231                                         return;
232                                 }
233 #endif
234                                 ed = PRVM_PROG_TO_EDICT(OPA->edict);
235                                 OPC->vector[0] = ((prvm_eval_t *)((int *)ed->v + OPB->_int))->vector[0];
236                                 OPC->vector[1] = ((prvm_eval_t *)((int *)ed->v + OPB->_int))->vector[1];
237                                 OPC->vector[2] = ((prvm_eval_t *)((int *)ed->v + OPB->_int))->vector[2];
238                                 break;
239
240                 //==================
241
242                         case OP_IFNOT:
243                                 if (!OPA->_int)
244                                         st += st->b - 1;        // offset the s++
245                                 break;
246
247                         case OP_IF:
248                                 if (OPA->_int)
249                                         st += st->b - 1;        // offset the s++
250                                 break;
251
252                         case OP_GOTO:
253                                 st += st->a - 1;        // offset the s++
254                                 break;
255
256                         case OP_CALL0:
257                         case OP_CALL1:
258                         case OP_CALL2:
259                         case OP_CALL3:
260                         case OP_CALL4:
261                         case OP_CALL5:
262                         case OP_CALL6:
263                         case OP_CALL7:
264                         case OP_CALL8:
265                                 prog->xfunction->profile += profile - startprofile;
266                                 startprofile = profile;
267                                 prog->xstatement = st - prog->statements;
268                                 prog->argc = st->op - OP_CALL0;
269                                 if (!OPA->function)
270                                         PRVM_ERROR("NULL function in %s", PRVM_NAME);
271
272                                 newf = &prog->functions[OPA->function];
273
274                                 if (newf->first_statement < 0)
275                                 {
276                                         // negative statements are built in functions
277                                         int builtinnumber = -newf->first_statement;
278                                         prog->xfunction->builtinsprofile++;
279                                         if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
280                                                 prog->builtins[builtinnumber]();
281                                         else
282                                                 PRVM_ERROR("No such builtin #%i in %s", builtinnumber, PRVM_NAME);
283                                 }
284                                 else
285                                         st = prog->statements + PRVM_EnterFunction(newf);
286                                 break;
287
288                         case OP_DONE:
289                         case OP_RETURN:
290                                 prog->xfunction->profile += profile - startprofile;
291                                 startprofile = profile;
292                                 prog->xstatement = st - prog->statements;
293
294                                 prog->globals[OFS_RETURN] = prog->globals[(unsigned short) st->a];
295                                 prog->globals[OFS_RETURN+1] = prog->globals[(unsigned short) st->a+1];
296                                 prog->globals[OFS_RETURN+2] = prog->globals[(unsigned short) st->a+2];
297
298                                 st = prog->statements + PRVM_LeaveFunction();
299                                 if (prog->depth <= exitdepth)
300                                         return;         // all done
301                                 if (prog->trace != cachedpr_trace)
302                                         goto chooseexecprogram;
303                                 break;
304
305                         case OP_STATE:
306                                 if(prog->flag & PRVM_OP_STATE) 
307                                 {
308                                         prog->xfunction->profile += profile - startprofile;
309                                         startprofile = profile;
310                                         prog->xstatement = st - prog->statements;
311                                         ed = PRVM_PROG_TO_EDICT(PRVM_G_INT(prog->self->ofs));
312                                         PRVM_E_FLOAT(ed,PRVM_ED_FindFieldOffset ("nextthink")) = *prog->time + 0.1;
313                                         PRVM_E_FLOAT(ed,PRVM_ED_FindFieldOffset ("frame")) = OPA->_float;
314                                         *(func_t *)((qbyte*)ed->v + PRVM_ED_FindFieldOffset ("think")) = OPB->function;
315                                 }
316                                 else
317                                         PRVM_ERROR("OP_STATE not supported by %s\n", PRVM_NAME);
318                                 break;
319                                 
320 // LordHavoc: to be enabled when Progs version 7 (or whatever it will be numbered) is finalized
321 /*
322                         case OP_ADD_I:
323                                 OPC->_int = OPA->_int + OPB->_int;
324                                 break;
325                         case OP_ADD_IF:
326                                 OPC->_int = OPA->_int + (int) OPB->_float;
327                                 break;
328                         case OP_ADD_FI:
329                                 OPC->_float = OPA->_float + (float) OPB->_int;
330                                 break;
331                         case OP_SUB_I:
332                                 OPC->_int = OPA->_int - OPB->_int;
333                                 break;
334                         case OP_SUB_IF:
335                                 OPC->_int = OPA->_int - (int) OPB->_float;
336                                 break;
337                         case OP_SUB_FI:
338                                 OPC->_float = OPA->_float - (float) OPB->_int;
339                                 break;
340                         case OP_MUL_I:
341                                 OPC->_int = OPA->_int * OPB->_int;
342                                 break;
343                         case OP_MUL_IF:
344                                 OPC->_int = OPA->_int * (int) OPB->_float;
345                                 break;
346                         case OP_MUL_FI:
347                                 OPC->_float = OPA->_float * (float) OPB->_int;
348                                 break;
349                         case OP_MUL_VI:
350                                 OPC->vector[0] = (float) OPB->_int * OPA->vector[0];
351                                 OPC->vector[1] = (float) OPB->_int * OPA->vector[1];
352                                 OPC->vector[2] = (float) OPB->_int * OPA->vector[2];
353                                 break;
354                         case OP_DIV_VF:
355                                 {
356                                         float temp = 1.0f / OPB->_float;
357                                         OPC->vector[0] = temp * OPA->vector[0];
358                                         OPC->vector[1] = temp * OPA->vector[1];
359                                         OPC->vector[2] = temp * OPA->vector[2];
360                                 }
361                                 break;
362                         case OP_DIV_I:
363                                 OPC->_int = OPA->_int / OPB->_int;
364                                 break;
365                         case OP_DIV_IF:
366                                 OPC->_int = OPA->_int / (int) OPB->_float;
367                                 break;
368                         case OP_DIV_FI:
369                                 OPC->_float = OPA->_float / (float) OPB->_int;
370                                 break;
371                         case OP_CONV_IF:
372                                 OPC->_float = OPA->_int;
373                                 break;
374                         case OP_CONV_FI:
375                                 OPC->_int = OPA->_float;
376                                 break;
377                         case OP_BITAND_I:
378                                 OPC->_int = OPA->_int & OPB->_int;
379                                 break;
380                         case OP_BITOR_I:
381                                 OPC->_int = OPA->_int | OPB->_int;
382                                 break;
383                         case OP_BITAND_IF:
384                                 OPC->_int = OPA->_int & (int)OPB->_float;
385                                 break;
386                         case OP_BITOR_IF:
387                                 OPC->_int = OPA->_int | (int)OPB->_float;
388                                 break;
389                         case OP_BITAND_FI:
390                                 OPC->_float = (int)OPA->_float & OPB->_int;
391                                 break;
392                         case OP_BITOR_FI:
393                                 OPC->_float = (int)OPA->_float | OPB->_int;
394                                 break;
395                         case OP_GE_I:
396                                 OPC->_float = OPA->_int >= OPB->_int;
397                                 break;
398                         case OP_LE_I:
399                                 OPC->_float = OPA->_int <= OPB->_int;
400                                 break;
401                         case OP_GT_I:
402                                 OPC->_float = OPA->_int > OPB->_int;
403                                 break;
404                         case OP_LT_I:
405                                 OPC->_float = OPA->_int < OPB->_int;
406                                 break;
407                         case OP_AND_I:
408                                 OPC->_float = OPA->_int && OPB->_int;
409                                 break;
410                         case OP_OR_I:
411                                 OPC->_float = OPA->_int || OPB->_int;
412                                 break;
413                         case OP_GE_IF:
414                                 OPC->_float = (float)OPA->_int >= OPB->_float;
415                                 break;
416                         case OP_LE_IF:
417                                 OPC->_float = (float)OPA->_int <= OPB->_float;
418                                 break;
419                         case OP_GT_IF:
420                                 OPC->_float = (float)OPA->_int > OPB->_float;
421                                 break;
422                         case OP_LT_IF:
423                                 OPC->_float = (float)OPA->_int < OPB->_float;
424                                 break;
425                         case OP_AND_IF:
426                                 OPC->_float = (float)OPA->_int && OPB->_float;
427                                 break;
428                         case OP_OR_IF:
429                                 OPC->_float = (float)OPA->_int || OPB->_float;
430                                 break;
431                         case OP_GE_FI:
432                                 OPC->_float = OPA->_float >= (float)OPB->_int;
433                                 break;
434                         case OP_LE_FI:
435                                 OPC->_float = OPA->_float <= (float)OPB->_int;
436                                 break;
437                         case OP_GT_FI:
438                                 OPC->_float = OPA->_float > (float)OPB->_int;
439                                 break;
440                         case OP_LT_FI:
441                                 OPC->_float = OPA->_float < (float)OPB->_int;
442                                 break;
443                         case OP_AND_FI:
444                                 OPC->_float = OPA->_float && (float)OPB->_int;
445                                 break;
446                         case OP_OR_FI:
447                                 OPC->_float = OPA->_float || (float)OPB->_int;
448                                 break;
449                         case OP_NOT_I:
450                                 OPC->_float = !OPA->_int;
451                                 break;
452                         case OP_EQ_I:
453                                 OPC->_float = OPA->_int == OPB->_int;
454                                 break;
455                         case OP_EQ_IF:
456                                 OPC->_float = (float)OPA->_int == OPB->_float;
457                                 break;
458                         case OP_EQ_FI:
459                                 OPC->_float = OPA->_float == (float)OPB->_int;
460                                 break;
461                         case OP_NE_I:
462                                 OPC->_float = OPA->_int != OPB->_int;
463                                 break;
464                         case OP_NE_IF:
465                                 OPC->_float = (float)OPA->_int != OPB->_float;
466                                 break;
467                         case OP_NE_FI:
468                                 OPC->_float = OPA->_float != (float)OPB->_int;
469                                 break;
470                         case OP_STORE_I:
471                                 OPB->_int = OPA->_int;
472                                 break;
473                         case OP_STOREP_I:
474 #if PRBOUNDSCHECK
475                                 if (OPB->_int < 0 || OPB->_int + 4 > pr_edictareasize)
476                                 {
477                                         pr_xfunction->profile += profile - startprofile;
478                                         startprofile = profile;
479                                         pr_xstatement = st - pr_statements;
480                                         Host_Error("Progs attempted to write to an out of bounds edict\n");
481                                         return;
482                                 }
483 #endif
484                                 ptr = (eval_t *)((qbyte *)sv.edictsfields + OPB->_int);
485                                 ptr->_int = OPA->_int;
486                                 break;
487                         case OP_LOAD_I:
488 #if PRBOUNDSCHECK
489                                 if (OPA->edict < 0 || OPA->edict >= pr_edictareasize)
490                                 {
491                                         pr_xfunction->profile += profile - startprofile;
492                                         startprofile = profile;
493                                         pr_xstatement = st - pr_statements;
494                                         Host_Error("Progs attempted to read an out of bounds edict number\n");
495                                         return;
496                                 }
497                                 if (OPB->_int < 0 || OPB->_int >= progs->entityfields)
498                                 {
499                                         pr_xfunction->profile += profile - startprofile;
500                                         startprofile = profile;
501                                         pr_xstatement = st - pr_statements;
502                                         Host_Error("Progs attempted to read an invalid field in an edict\n");
503                                         return;
504                                 }
505 #endif
506                                 ed = PROG_TO_EDICT(OPA->edict);
507                                 OPC->_int = ((eval_t *)((int *)ed->v + OPB->_int))->_int;
508                                 break;
509
510                         case OP_GSTOREP_I:
511                         case OP_GSTOREP_F:
512                         case OP_GSTOREP_ENT:
513                         case OP_GSTOREP_FLD:            // integers
514                         case OP_GSTOREP_S:
515                         case OP_GSTOREP_FNC:            // pointers
516 #if PRBOUNDSCHECK
517                                 if (OPB->_int < 0 || OPB->_int >= pr_globaldefs)
518                                 {
519                                         pr_xfunction->profile += profile - startprofile;
520                                         startprofile = profile;
521                                         pr_xstatement = st - pr_statements;
522                                         Host_Error("Progs attempted to write to an invalid indexed global\n");
523                                         return;
524                                 }
525 #endif
526                                 pr_globals[OPB->_int] = OPA->_float;
527                                 break;
528                         case OP_GSTOREP_V:
529 #if PRBOUNDSCHECK
530                                 if (OPB->_int < 0 || OPB->_int + 2 >= pr_globaldefs)
531                                 {
532                                         pr_xfunction->profile += profile - startprofile;
533                                         startprofile = profile;
534                                         pr_xstatement = st - pr_statements;
535                                         Host_Error("Progs attempted to write to an invalid indexed global\n");
536                                         return;
537                                 }
538 #endif
539                                 pr_globals[OPB->_int  ] = OPA->vector[0];
540                                 pr_globals[OPB->_int+1] = OPA->vector[1];
541                                 pr_globals[OPB->_int+2] = OPA->vector[2];
542                                 break;
543
544                         case OP_GADDRESS:
545                                 i = OPA->_int + (int) OPB->_float;
546 #if PRBOUNDSCHECK
547                                 if (i < 0 || i >= pr_globaldefs)
548                                 {
549                                         pr_xfunction->profile += profile - startprofile;
550                                         startprofile = profile;
551                                         pr_xstatement = st - pr_statements;
552                                         Host_Error("Progs attempted to address an out of bounds global\n");
553                                         return;
554                                 }
555 #endif
556                                 OPC->_float = pr_globals[i];
557                                 break;
558
559                         case OP_GLOAD_I:
560                         case OP_GLOAD_F:
561                         case OP_GLOAD_FLD:
562                         case OP_GLOAD_ENT:
563                         case OP_GLOAD_S:
564                         case OP_GLOAD_FNC:
565 #if PRBOUNDSCHECK
566                                 if (OPA->_int < 0 || OPA->_int >= pr_globaldefs)
567                                 {
568                                         pr_xfunction->profile += profile - startprofile;
569                                         startprofile = profile;
570                                         pr_xstatement = st - pr_statements;
571                                         Host_Error("Progs attempted to read an invalid indexed global\n");
572                                         return;
573                                 }
574 #endif
575                                 OPC->_float = pr_globals[OPA->_int];
576                                 break;
577
578                         case OP_GLOAD_V:
579 #if PRBOUNDSCHECK
580                                 if (OPA->_int < 0 || OPA->_int + 2 >= pr_globaldefs)
581                                 {
582                                         pr_xfunction->profile += profile - startprofile;
583                                         startprofile = profile;
584                                         pr_xstatement = st - pr_statements;
585                                         Host_Error("Progs attempted to read an invalid indexed global\n");
586                                         return;
587                                 }
588 #endif
589                                 OPC->vector[0] = pr_globals[OPA->_int  ];
590                                 OPC->vector[1] = pr_globals[OPA->_int+1];
591                                 OPC->vector[2] = pr_globals[OPA->_int+2];
592                                 break;
593
594                         case OP_BOUNDCHECK:
595                                 if (OPA->_int < 0 || OPA->_int >= st->b)
596                                 {
597                                         pr_xfunction->profile += profile - startprofile;
598                                         startprofile = profile;
599                                         pr_xstatement = st - pr_statements;
600                                         Host_Error("Progs boundcheck failed at line number %d, value is < 0 or >= %d\n", st->b, st->c);
601                                         return;
602                                 }
603                                 break;
604
605 */
606
607                         default:
608                                 prog->xfunction->profile += profile - startprofile;
609                                 startprofile = profile;
610                                 prog->xstatement = st - prog->statements;
611                                 PRVM_ERROR ("Bad opcode %i in %s", st->op, PRVM_NAME);
612                         }
613                 }
614