Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [a0ee5dcd19]:

To Artifact [4c5452cf58]:


3597
3598
3599
3600
3601
3602
3603

3604
3605
3606
3607
3608
3609
3610

3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637


3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651






















3652
3653
3654

3655
3656
3657
3658
3659
3660
3661

const char*execute_turn(int key) {
  Uint8 busy,clock,x,y;
  Uint32 m,n,turn,tc;
  Object*o;
  Value v;
  int i;

  if(!key) {
    // This is part of initialization; if anything triggered, it must be executed now
    all_flushed=1;
    goto trig;
  }
  if(setjmp(my_env)) return my_error;
  if(quiz_text) {

    sqlite3_free(quiz_text);
    quiz_text=0;
    if(key_ignored) {
      if(quiz_obj.t) quiz_obj=NVALUE(0); else return 0;
    } else if(!quiz_obj.t) {
      move_number++;
      return 0;
    }
  }
  changed=0;
  key_ignored=0;
  all_flushed=0;
  lastimage_processing=0;
  vstackptr=0;
  current_key=key;
  tc=0;
  for(n=0;n<nobjects;n++) if(o=objects[n]) {
    o->distance=0;
    o->oflags&=~(OF_KEYCLEARED|OF_DONE|OF_MOVING);
    if(o->anim) {
      o->anim->count=0;
      if(o->anim->status==ANISTAT_VISUAL) o->anim->status=0;
    }
  }
  // Input phase
  m=VOIDLINK;
  v=NVALUE(0);


  if(!quiz_obj.t) {
    n=lastobj;
    while(n!=VOIDLINK) {
      i=classes[objects[n]->class]->cflags;
      if(i&CF_INPUT) v=send_message(VOIDLINK,n,MSG_KEY,NVALUE(key),v,NVALUE(0));
      if(i&CF_PLAYER) m=n;
      n=objects[n]->prev;
    }
  } else {
    n=quiz_obj.u;
    if(objects[n]->generation!=quiz_obj.t) n=VOIDLINK;
    quiz_obj=NVALUE(0);
    if(classes[objects[n]->class]->cflags&CF_COMPATIBLE) all_flushed=1;
    v=send_message(VOIDLINK,n,MSG_KEY,NVALUE(key),NVALUE(0),NVALUE(1));






















  }
  current_key=0;
  if(key_ignored) {

    quiz_obj=NVALUE(0);
    return changed?"Invalid use of IgnoreKey":0;
  }
  move_number++;
  // Beginning phase
  if(!all_flushed) {
    if(m==VOIDLINK) x=0,y=0; else x=objects[m]->x,y=objects[m]->y;







>







>














<
<











>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>







3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626


3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686

const char*execute_turn(int key) {
  Uint8 busy,clock,x,y;
  Uint32 m,n,turn,tc;
  Object*o;
  Value v;
  int i;
  tc=0;
  if(!key) {
    // This is part of initialization; if anything triggered, it must be executed now
    all_flushed=1;
    goto trig;
  }
  if(setjmp(my_env)) return my_error;
  if(quiz_text) {
    if(key>256 && !key_ignored) return 0;
    sqlite3_free(quiz_text);
    quiz_text=0;
    if(key_ignored) {
      if(quiz_obj.t) quiz_obj=NVALUE(0); else return 0;
    } else if(!quiz_obj.t) {
      move_number++;
      return 0;
    }
  }
  changed=0;
  key_ignored=0;
  all_flushed=0;
  lastimage_processing=0;
  vstackptr=0;


  for(n=0;n<nobjects;n++) if(o=objects[n]) {
    o->distance=0;
    o->oflags&=~(OF_KEYCLEARED|OF_DONE|OF_MOVING);
    if(o->anim) {
      o->anim->count=0;
      if(o->anim->status==ANISTAT_VISUAL) o->anim->status=0;
    }
  }
  // Input phase
  m=VOIDLINK;
  v=NVALUE(0);
  if(key>=8 && key<256) {
    current_key=key;
    if(!quiz_obj.t) {
      n=lastobj;
      while(n!=VOIDLINK) {
        i=classes[objects[n]->class]->cflags;
        if(i&CF_INPUT) v=send_message(VOIDLINK,n,MSG_KEY,NVALUE(key),v,NVALUE(0));
        if(i&CF_PLAYER) m=n;
        n=objects[n]->prev;
      }
    } else {
      n=quiz_obj.u;
      if(objects[n]->generation!=quiz_obj.t) n=VOIDLINK;
      quiz_obj=NVALUE(0);
      if(classes[objects[n]->class]->cflags&CF_COMPATIBLE) all_flushed=1;
      v=send_message(VOIDLINK,n,MSG_KEY,NVALUE(key),NVALUE(0),NVALUE(1));
    }
  } else if(has_xy_input && key>=0x8000 && key<=0x8FFF) {
    x=((key>>6)&63)+1; y=(key&63)+1;
    if(x>pfwidth || y>pfheight) return "Illegal move";
    current_key=KEY_XY;
    if(control_obj!=VOIDLINK) {
      quiz_obj=NVALUE(0);
      v=send_message(VOIDLINK,control_obj,MSG_CLICK,NVALUE(x),NVALUE(y),NVALUE(0));
      if(key_ignored) goto ignored;
    }
    m=n=playfield[x+y*64-65];
    while(m!=VOIDLINK) {
      m=objects[m]->up;
      if(m!=VOIDLINK) n=m;
    }
    while(n!=VOIDLINK) {
      if(objects[n]->x!=x || objects[n]->y!=y) break;
      if(v_bool(send_message(VOIDLINK,n,MSG_CLICK,NVALUE(x),NVALUE(y),v))) break;
      n=objects[n]->down;
    }
  } else {
    return "Illegal move";
  }
  current_key=0;
  if(key_ignored) {
    ignored:
    quiz_obj=NVALUE(0);
    return changed?"Invalid use of IgnoreKey":0;
  }
  move_number++;
  // Beginning phase
  if(!all_flushed) {
    if(m==VOIDLINK) x=0,y=0; else x=objects[m]->x,y=objects[m]->y;