Free Hero Mesh

Check-in [2b0b74d47a]
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:Implementation of order of execution overriding is probably corrected now.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2b0b74d47a60f0a1c3f0cedee583c90527469532
User & Date: user on 2022-07-10 00:55:02
Other Links: manifest | tags
Context
2022-07-10
21:51
Allow the (Order) list to contain class names and message names. check-in: 874c691fca user: user tags: trunk
00:55
Implementation of order of execution overriding is probably corrected now. check-in: 2b0b74d47a user: user tags: trunk
2022-07-09
22:20
Add a paragraph in PORTING file, about alternative implementations that do not use SQLite and X resource manager. check-in: 80ab5a543a user: user tags: trunk
Changes

Modified TODO from [8666aa5000] to [a0896e1a69].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
* Option to auto display level titles
* Option to use a separate solution file
* Multiuser scoring within one computer system (optional capability)
* Testing
  * Bizarro world
  * Connection movement (it is partially tested, already)
  * Sweep, SweepEx, HitMe
  * Overriding order of execution
* Conversion from other games
  * DOS Hero Hearts
  * Berusky
  * PC Wanderer
  * Escape
  * Chroma
  * Xsok







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
* Option to auto display level titles
* Option to use a separate solution file
* Multiuser scoring within one computer system (optional capability)
* Testing
  * Bizarro world
  * Connection movement (it is partially tested, already)
  * Sweep, SweepEx, HitMe
  * Overriding order of execution (partially tested)
* Conversion from other games
  * DOS Hero Hearts
  * Berusky
  * PC Wanderer
  * Escape
  * Chroma
  * Xsok

Modified class.c from [23e8cf302b] to [cc0a42cded].

2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
}

static void parse_order_block(void) {
  // OP_MISC1, OP_MISC1_C, etc = properties (_C=reverse)
  // 0x1000...0x10FF = Have flag
  // OP_RET = end of block
  Uint16 beg,ptr;
  if(!main_options['U']) ParseError("Experimental/unstable feature\n"); //TODO: remove this when it is implemented properly in exec.c too
  orders=malloc(0x4000*sizeof(Uint16));
  if(!orders) fatal("Allocation failed\n");
  nxttok();
  if(tokent==TF_INT) {
    if(tokenv<1 || tokenv>254) ParseError("Order number out of range\n");
    beg=ptr=tokenv;
    nxttok();







<







2207
2208
2209
2210
2211
2212
2213

2214
2215
2216
2217
2218
2219
2220
}

static void parse_order_block(void) {
  // OP_MISC1, OP_MISC1_C, etc = properties (_C=reverse)
  // 0x1000...0x10FF = Have flag
  // OP_RET = end of block
  Uint16 beg,ptr;

  orders=malloc(0x4000*sizeof(Uint16));
  if(!orders) fatal("Allocation failed\n");
  nxttok();
  if(tokent==TF_INT) {
    if(tokenv<1 || tokenv>254) ParseError("Order number out of range\n");
    beg=ptr=tokenv;
    nxttok();

Modified exec.c from [4c5452cf58] to [259ff81012].

721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737

738
739
740
741
742
743
744
  return r;
}

static void set_order(Uint32 obj) {
  // To avoid confusing order of execution at the wrong time,
  // calling this function is limited to only certain times.
  Object*o=objects[obj];
  Uint8 ord=classes[objects[obj]->class]->order;
  Uint8 u;
  Sint32 v0,v1;
  Uint16 p=orders[ord]+1;
  Uint32 n=firstobj;
  for(;;) {
    if(n==obj || n==VOIDLINK) goto notfound;
    u=classes[objects[n]->class]->order;
    if(u<ord) goto found;
    if(u==ord) {

      criteria: switch(orders[p]) {
        case OP_RET: goto found;
        case OP_DENSITY: v0=o->density; v1=objects[n]->density; goto compare;
        case OP_DENSITY_C: v1=o->density; v0=objects[n]->density; goto compare;
        case OP_IMAGE: v0=o->image; v1=objects[n]->image; goto compare;
        case OP_IMAGE_C: v1=o->image; v0=objects[n]->image; goto compare;
        case OP_MISC1:







|


|




|

>







721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
  return r;
}

static void set_order(Uint32 obj) {
  // To avoid confusing order of execution at the wrong time,
  // calling this function is limited to only certain times.
  Object*o=objects[obj];
  Uint8 ord=classes[o->class]->order;
  Uint8 u;
  Sint32 v0,v1;
  Uint16 p;
  Uint32 n=firstobj;
  for(;;) {
    if(n==obj || n==VOIDLINK) goto notfound;
    u=classes[objects[n]->class]->order;
    if(u<ord || !(objects[n]->oflags&OF_ORDERED)) goto found;
    if(u==ord) {
      p=orders[ord]+1;
      criteria: switch(orders[p]) {
        case OP_RET: goto found;
        case OP_DENSITY: v0=o->density; v1=objects[n]->density; goto compare;
        case OP_DENSITY_C: v1=o->density; v0=objects[n]->density; goto compare;
        case OP_IMAGE: v0=o->image; v1=objects[n]->image; goto compare;
        case OP_IMAGE_C: v1=o->image; v0=objects[n]->image; goto compare;
        case OP_MISC1:
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
      }
    }
    n=objects[n]->next;
  }
  found:
  // Now it has been found; insert this object previous to the found object, removing from its existing slot.
  // (Objects are executed in reverse order, so previous in the linked list means executed next)
  if(firstobj==obj) firstobj=o->next;
  if(lastobj==obj) lastobj=o->prev;
  if(o->prev!=VOIDLINK) objects[o->prev]->next=o->next;
  if(o->next!=VOIDLINK) objects[o->next]->prev=o->prev;
  o->prev=objects[n]->prev;
  o->next=n;
  objects[n]->prev=obj;
  if(o->prev==VOIDLINK) firstobj=obj;
  if(objects[n]->next==VOIDLINK) lastobj=n;
  notfound:
  objects[obj]->oflags|=OF_ORDERED;
}

static Uint32 create(Uint32 from,Uint16 c,Uint32 x,Uint32 y,Uint32 im,Uint32 d) {
  Uint32 m,n;
  int i,xx,yy;







|
|
|
<

<

|
<







801
802
803
804
805
806
807
808
809
810

811

812
813

814
815
816
817
818
819
820
      }
    }
    n=objects[n]->next;
  }
  found:
  // Now it has been found; insert this object previous to the found object, removing from its existing slot.
  // (Objects are executed in reverse order, so previous in the linked list means executed next)
  if(o->prev==VOIDLINK) firstobj=o->next; else objects[o->prev]->next=o->next;
  if(o->next==VOIDLINK) lastobj=o->prev; else objects[o->next]->prev=o->prev;
  o->next=n;

  o->prev=objects[n]->prev;

  objects[n]->prev=obj;
  if(o->prev==VOIDLINK) firstobj=obj; else objects[o->prev]->next=obj;

  notfound:
  objects[obj]->oflags|=OF_ORDERED;
}

static Uint32 create(Uint32 from,Uint16 c,Uint32 x,Uint32 y,Uint32 im,Uint32 d) {
  Uint32 m,n;
  int i,xx,yy;