Free Hero Mesh

Check-in [8d8bcb34ca]
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:Add a few structures and stuff related to animation; not complete
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d8bcb34ca6163708a72f6348f5dbb61aa927f8f
User & Date: user on 2020-12-08 03:53:34
Other Links: manifest | tags
Context
2020-12-10
05:37
Start to implement object examination menu in game.c; this revealed that there are still some duplicate objects being loaded, though check-in: 76cf67a257 user: user tags: trunk
2020-12-08
03:53
Add a few structures and stuff related to animation; not complete check-in: 8d8bcb34ca user: user tags: trunk
2020-12-06
21:50
Add some corrected dealing with destroyed objects and other corrections in exec.c check-in: 35eb3bec31 user: user tags: trunk
Changes

Modified exec.c from [ef4de5943d] to [5d2316e35d].

142
143
144
145
146
147
148


149
150
151
152










153
154
155
156
157
158
159
160
161
162
163
164





165
166
167
168
169
170
171
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188







+
+




+
+
+
+
+
+
+
+
+
+












+
+
+
+
+







  }
  objects[n]=o;
  return n;
  bad:
  free(o);
  return VOIDLINK;
}

#define animfree free

void objtrash(Uint32 n) {
  Object*o=objects[n];
  if(!o) return;
  if(o->anim && !(o->oflags&(OF_INVISIBLE|OF_BIZARRO))) {
    //TODO: Check that the animation is actually playing
    // If there is an animation, continue to display it, but let it have no effect on the game behaviour
    // This may happen if the LASTIMAGE message destroys the object.
    o->oflags=OF_DESTROYED|OF_STEALTHY|OF_VISUALONLY;
    o->generation=0;
    //TODO
    return;
  }
  animfree(o->anim);
  if(o->down==VOIDLINK) playfield[o->x+o->y*64-65]=o->up;
  else objects[o->down]->up=o->up;
  if(o->up!=VOIDLINK) objects[o->up]->down=o->down;
  o->down=o->up=VOIDLINK;
  if(firstobj==n) firstobj=o->next;
  if(lastobj==n) lastobj=o->prev;
  if(o->prev!=VOIDLINK) objects[o->prev]->next=o->next;
  if(o->next!=VOIDLINK) objects[o->next]->prev=o->prev;
  free(o);
  objects[n]=0;
  generation_number_inc=1;
}

static void animate(Uint32 n,Uint32 f,Uint32 a0,Uint32 a1,Uint32 t) {
  objects[n]->image=a0;
  //TODO
}

static Uint32 obj_above(Uint32 i) {
  Object*o;
  if(i==VOIDLINK) return VOIDLINK;
  o=objects[i];
  i=o->up;
  while(i!=VOIDLINK) {
367
368
369
370
371
372
373

374
375
376
377
378
379
380
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398







+







    case 0x2800 ... 0x28FF: StackReq(0,1); Push(globals[code[ptr-1]&0x7FF]); break;
    case 0x3000 ... 0x37FF: NoIgnore(); StackReq(1,0); o->uservars[code[ptr-1]&0x7FF]=Pop(); break;
    case 0x3800 ... 0x38FF: NoIgnore(); StackReq(1,0); globals[code[ptr-1]&0x7FF]=Pop(); break;
    case 0x4000 ... 0x7FFF: StackReq(0,1); Push(CVALUE(code[ptr-1]-0x4000)); break;
    case 0x87E8 ... 0x87FF: StackReq(0,1); Push(NVALUE(1UL<<(code[ptr-1]&31))); break;
    case 0xC000 ... 0xFFFF: StackReq(0,1); Push(MVALUE((code[ptr-1]&0x3FFF)+256)); break;
    case OP_ADD: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u+t2.u)); break;
    case OP_ANIMATE: StackReq(4,0); t4=Pop(); Numeric(t4); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); animate(obj,t1.u,t2.u,t3.u,t4.u); break;
    case OP_BAND: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u&t2.u)); break;
    case OP_BNOT: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(~t1.u)); break;
    case OP_BOR: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u|t2.u)); break;
    case OP_BROADCAST: StackReq(4,1); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,NVALUE(0),0)); break;
    case OP_BROADCAST_D: StackReq(4,0); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_broadcast(obj,t1,t2,t3,t4,NVALUE(0),0); break;
    case OP_BROADCASTCLASS: StackReq(3,1); t4=Pop(); t3=Pop(); t2=Pop(); Push(v_broadcast(obj,CVALUE(code[ptr++]),t2,t3,t4,NVALUE(0),0)); break;
    case OP_BROADCASTEX: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,t5,0)); break;
527
528
529
530
531
532
533
534




535
536
537
538
539
540
541
545
546
547
548
549
550
551

552
553
554
555
556
557
558
559
560
561
562







-
+
+
+
+







}

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]);
  for(i=0;i<nobjects;i++) if(objects[i]) {
    animfree(objects[i]->anim);
    free(objects[i]);
  }
  nobjects=0;
  free(objects);
  objects=0;
  gameover=0;
}

const char*execute_turn(int key) {

Modified heromesh.h from [c9a54ecacf] to [431eca0830].

163
164
165
166
167
168
169





170
171
172
173
174
175
176
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181







+
+
+
+
+







// == function ==

void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1);

// == exec ==

#define VOIDLINK ((Uint32)(-1))

#define ANI_STOP 0x00
#define ANI_ONCE 0x01
#define ANI_LOOP 0x02
#define ANI_OSC 0x08

typedef struct {
  //TODO
} Animation;

typedef struct {
  Sint32 height,weight,climb,density,volume,strength,arrivals,departures,temperature;