496
497
498
499
500
501
502
503
504
505
506
507
508
509
|
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
return x.s>y.s;
}
static inline int v_unsigned_greater(Value x,Value y) {
if(x.t!=TY_NUMBER || y.t!=TY_NUMBER) Throw("Type mismatch");
return x.u>y.u;
}
static Uint32 v_is(Value x,Value y) {
Uint32 n;
if(x.t==TY_NUMBER && !x.u) {
return 0;
} else if(x.t>TY_MAXTYPE && y.t==TY_CLASS) {
n=v_object(x);
return (objects[n]->class==y.u)?1:0;
//TODO: subclassing (using CF_GROUP)
} else if((x.t>TY_MAXTYPE || x.t==TY_CLASS) && y.t==TY_NUMBER && !y.u) {
return 1;
} else if(x.t==TY_CLASS && y.t==TY_CLASS) {
return (x.u==y.u)?1:0;
//TODO: subclassing (using CF_GROUP)
} else {
Throw("Type mismatch");
}
}
static Uint8 collisions_at(Uint32 x,Uint32 y) {
Uint8 c=0;
Uint32 n;
if(x<1 || y<1 || x>pfwidth || y>pfheight) return 0;
n=playfield[x+y*64-65];
while(n!=VOIDLINK) {
|
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
|
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
|
-
+
|
if(o->oflags&OF_DESTROYED) return VOIDLINK;
for(i=25;i>=0;i--) {
xx=x+Xbit(i); yy=y+Ybit(i);
if(xx<1 || xx>pfwidth || yy<1 || yy>pfheight) continue;
m=playfield[xx+yy*64-65];
while(m!=VOIDLINK) {
p=objects[m];
if(p->arrivals&(1<<i)) send_message(n,m,MSG_CREATED,NVALUE(x),NVALUE(y),v);
if(p->arrivals&(1<<i)) if(m!=n) send_message(n,m,MSG_CREATED,NVALUE(x),NVALUE(y),v);
m=p->up;
}
}
if(o->oflags&OF_DESTROYED) return VOIDLINK;
m=objects[n]->up;
if(m!=VOIDLINK) {
v=send_message(VOIDLINK,n,MSG_SUNK,NVALUE(0),NVALUE(0),v);
|
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
|
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
|
+
|
case OP_INTMOVE_C: NoIgnore(); StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(move_dir(obj,i,t1.u))); break;
case OP_INTMOVE_D: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); move_dir(obj,obj,t1.u); break;
case OP_INTMOVE_CD: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) move_dir(obj,i,t1.u); break;
case OP_INVISIBLE: StackReq(0,1); if(o->oflags&OF_INVISIBLE) Push(NVALUE(1)); else Push(NVALUE(0)); break;
case OP_INVISIBLE_C: StackReq(1,1); GetFlagOf(OF_INVISIBLE); break;
case OP_INVISIBLE_E: NoIgnore(); StackReq(1,0); if(v_bool(Pop())) o->oflags|=OF_INVISIBLE; else o->oflags&=~OF_INVISIBLE; break;
case OP_INVISIBLE_EC: NoIgnore(); StackReq(2,0); SetFlagOf(OF_INVISIBLE); break;
case OP_IS: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_is(t1,t2))); break;
case OP_JUMPTO: NoIgnore(); StackReq(2,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); Push(NVALUE(jump_to(obj,obj,t2.u,t3.u))); break;
case OP_JUMPTO_C: NoIgnore(); StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); i=v_object(Pop()); Push(NVALUE(jump_to(obj,i,t2.u,t3.u))); break;
case OP_JUMPTO_D: NoIgnore(); StackReq(2,0); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); jump_to(obj,obj,t2.u,t3.u); break;
case OP_JUMPTO_CD: NoIgnore(); StackReq(3,0); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); i=v_object(Pop()); jump_to(obj,i,t2.u,t3.u); break;
case OP_KEY: StackReq(0,1); Push(NVALUE(current_key)); break;
case OP_KEYCLEARED: StackReq(0,1); if(o->oflags&OF_KEYCLEARED) Push(NVALUE(1)); else Push(NVALUE(0)); break;
case OP_KEYCLEARED_C: StackReq(1,1); GetFlagOf(OF_KEYCLEARED); break;
|