Free Hero Mesh

Check-in [8f8397ce1b]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Implement NewX and NewY
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8f8397ce1bde49b95af1327ff0a9f30b09c09acd
User & Date: user on 2020-12-20 21:17:11
Other Links: manifest | tags
Context
2020-12-20
21:40
Implement '^d' and horizontal lines in popup texts check-in: 0770ad617e user: user tags: trunk
21:17
Implement NewX and NewY check-in: 8f8397ce1b user: user tags: trunk
18:49
Implement level strings and quiz buttons check-in: 5d19455a9e user: user tags: trunk
Changes

Modified class.doc from [f2091cdda2] to [396397d9a5].

1010
1011
1012
1013
1014
1015
1016
1017


1018
1019
1020
1021
1022
1023
1024
1010
1011
1012
1013
1014
1015
1016

1017
1018
1019
1020
1021
1022
1023
1024
1025







-
+
+








neg  ( in -- out )
  Multiply by negative one.

NewX  ( oldx dir -- newx )
  Advance the number in the direction as though it is a X coordinate. If
  the direction is north or south, leaves it alone, but if it is east or
  west then it is increased or decreased by one.
  west then it is increased or decreased by one. The output is never less
  than zero nor exceeding the playfield width by more than one.

NewY  ( oldx dir -- newy )
  Advance the number in the direction as though it is a Y coordinate.

nip  ( x y -- y )

ObjAbove  ( -- obj )

Modified exec.c from [160b4b6c27] to [cc4f9d7707].

395
396
397
398
399
400
401










402
403
404
405
406
407
408
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418







+
+
+
+
+
+
+
+
+
+







}

static Uint32 obj_dir(Uint32 n,Uint32 d) {
  if(n==VOIDLINK) return VOIDLINK;
  d=resolve_dir(n,d);
  return obj_top_at(objects[n]->x+x_delta[d],objects[n]->y+y_delta[d]);
}

static Sint16 new_x(Sint16 n,Uint8 d) {
  n+=x_delta[d];
  return n<0?0:n>pfwidth?pfwidth+1:n;
}

static Sint16 new_y(Sint16 n,Uint8 d) {
  n+=y_delta[d];
  return n<0?0:n>pfheight?pfheight+1:n;
}

static void change_shape(Uint32 n,int d,int v) {
  v&=3;
  v<<=d+d;
  v|=objects[n]->shape&~(3<<(d+d));
  objects[n]->shape=v;
}
1343
1344
1345
1346
1347
1348
1349


1350
1351
1352
1353
1354
1355
1356
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368







+
+







    case OP_MOVETO_D: NoIgnore(); StackReq(2,0); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); move_to(obj,obj,t2.u,t3.u); break;
    case OP_MOVETO_CD: NoIgnore(); StackReq(3,0); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); i=v_object(Pop()); move_to(obj,i,t2.u,t3.u); break;
    case OP_MSG: StackReq(0,1); Push(MVALUE(msgvars.msg)); break;
    case OP_MUL: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u*t2.u)); break;
    case OP_MUL_C: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.s*t2.s)); break;
    case OP_NE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?0:1)); break;
    case OP_NEG: StackReq(1,1); t1=Pop(); Numeric(t1); t1.s=-t1.s; Push(t1); break;
    case OP_NEWX: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_x(t1.u,resolve_dir(obj,t2.u)))); break;
    case OP_NEWY: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_y(t1.u,resolve_dir(obj,t2.u)))); break;
    case OP_NEXT: StackReq(0,1); ptr=v_next(code,ptr); break;
    case OP_NIP: StackReq(2,1); t1=Pop(); Pop(); Push(t1); break;
    case OP_OBJABOVE: StackReq(0,1); i=obj_above(obj); Push(OVALUE(i)); break;
    case OP_OBJABOVE_C: StackReq(1,1); i=obj_above(v_object(Pop())); Push(OVALUE(i)); break;
    case OP_OBJBELOW: StackReq(0,1); i=obj_below(obj); Push(OVALUE(i)); break;
    case OP_OBJBELOW_C: StackReq(1,1); i=obj_below(v_object(Pop())); Push(OVALUE(i)); break;
    case OP_OBJBOTTOMAT: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); i=obj_bottom_at(t1.u,t2.u); Push(OVALUE(i)); break;