From 7daf4fdcd3b3ecc5236cec08618949c53d5a0a0e Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 12 Jan 2015 09:28:46 +0000 Subject: [PATCH] Fix tdupsprite in m32script. git-svn-id: https://svn.eduke32.com/eduke32@4911 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/astub.c | 2 +- polymer/eduke32/source/m32def.h | 2 +- polymer/eduke32/source/m32exec.c | 48 +++++++++++++++++--------------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 8d6d644d5..59b77fb10 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8929,7 +8929,7 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm) if (in3dmode() && AIMING_AT_SPRITE) { vm.g_i = searchwall; - vm.g_sp = &sprite[vm.g_i]; + vm.g_sp = (tspritetype *)&sprite[vm.g_i]; } // If OSD is down, that would interfere with user input, so don't consider diff --git a/polymer/eduke32/source/m32def.h b/polymer/eduke32/source/m32def.h index 05d2d0bbb..cd622f482 100644 --- a/polymer/eduke32/source/m32def.h +++ b/polymer/eduke32/source/m32def.h @@ -111,7 +111,7 @@ typedef struct { // VM state: either ==0 (top-level), >=1 and < MAXEVENTS+1 (event), // or >= MAXEVENTS+1 and < MAXEVENTS+1+g_stateCount (state) int32_t g_st; - spritetype *g_sp; + tspritetype *g_sp; uint32_t flags; //g_errorFlag, g_returnFlag; // 1:updatehighlight, 2:updatehighlightsector, 4:interactive (from menu)? diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index 728b1ec05..df977e57b 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -155,7 +155,7 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor) vm.g_i = iActor; // current sprite ID if (vm.g_i >= 0) - vm.g_sp = &sprite[vm.g_i]; + vm.g_sp = (tspritetype *)&sprite[vm.g_i]; vm.g_st = 1+iEventID; @@ -237,12 +237,12 @@ static int X_DoSort(const void *lv, const void *rv) } // in interactive execution, allow the current sprite index to be the aimed-at sprite (in 3d mode) -#define X_ERROR_INVALIDCI() \ - if ((vm.g_i < 0 || vm.g_i>=MAXSPRITES) && \ - (vm.g_st!=0 || searchstat!=3 || (vm.g_i=searchwall, vm.g_sp=&sprite[vm.g_i], 0))) \ - { \ - M32_ERROR("Current sprite index invalid!"); \ - continue; \ +#define X_ERROR_INVALIDCI() \ + if ((vm.g_i < 0 || vm.g_i >= MAXSPRITES) && \ + (vm.g_st != 0 || searchstat != 3 || (vm.g_i = searchwall, vm.g_sp = (tspritetype *)&sprite[vm.g_i], 0))) \ + { \ + M32_ERROR("Current sprite index invalid!"); \ + continue; \ } #define X_ERROR_INVALIDSPRI(dasprite) \ @@ -259,11 +259,11 @@ static int X_DoSort(const void *lv, const void *rv) continue; \ } -#define X_ERROR_INVALIDSP() \ - if (!vm.g_sp && (vm.g_st!=0 || searchstat!=3 || (vm.g_sp=&sprite[searchwall], 0))) \ - { \ - M32_ERROR("Current sprite invalid!"); \ - continue; \ +#define X_ERROR_INVALIDSP() \ + if (!vm.g_sp && (vm.g_st != 0 || searchstat != 3 || (vm.g_sp = (tspritetype *)&sprite[searchwall], 0))) \ + { \ + M32_ERROR("Current sprite invalid!"); \ + continue; \ } #define X_ERROR_INVALIDQUOTE(q, array) \ @@ -1269,7 +1269,7 @@ skip_check: int32_t parm2 = how<=ITER_DRAWNSPRITES ? 0 : Gv_GetVarX(*insptr++); instype *end = insptr + *insptr, *beg = ++insptr; int32_t vm_i_bak = vm.g_i; - spritetype *vm_sp_bak = vm.g_sp; + tspritetype *vm_sp_bak = vm.g_sp; int16_t endwall; if (vm.flags&VMFLAG_ERROR) continue; @@ -1283,7 +1283,7 @@ skip_check: continue; Gv_SetVarX(var, jj); vm.g_i = jj; - vm.g_sp = &sprite[jj]; + vm.g_sp = (tspritetype *)&sprite[jj]; insptr = beg; VM_Execute(1); } @@ -1329,7 +1329,7 @@ skip_check: jj &= (MAXSPRITES-1); Gv_SetVarX(var, jj); vm.g_i = jj; - vm.g_sp = &sprite[jj]; + vm.g_sp = (tspritetype *)&sprite[jj]; insptr = beg; VM_Execute(1); } @@ -1358,7 +1358,7 @@ skip_check: case ITER_DRAWNSPRITES: for (ii=0; iixrepeat = (uint8_t) Gv_GetVarX(*(insptr-2)); vm.g_sp->yrepeat = (uint8_t) Gv_GetVarX(*(insptr-1)); + if (vm.g_i != -1) spritechanged[vm.g_i]++; continue; case CON_CSTAT: insptr += 2; X_ERROR_INVALIDSP(); vm.g_sp->cstat = (int16_t) *(insptr-1); + if (vm.g_i != -1) spritechanged[vm.g_i]++; continue; case CON_CSTATOR: insptr += 2; X_ERROR_INVALIDSP(); vm.g_sp->cstat |= (int16_t) Gv_GetVarX(*(insptr-1)); + if (vm.g_i != -1) spritechanged[vm.g_i]++; continue; case CON_CLIPDIST: insptr += 2; X_ERROR_INVALIDSP(); vm.g_sp->clipdist = (uint8_t) Gv_GetVarX(*(insptr-1)); + if (vm.g_i != -1) spritechanged[vm.g_i]++; continue; case CON_SPRITEPAL: insptr += 2; X_ERROR_INVALIDSP(); vm.g_sp->pal = Gv_GetVarX(*(insptr-1)); + if (vm.g_i != -1) spritechanged[vm.g_i]++; continue; case CON_CACTOR: insptr += 2; X_ERROR_INVALIDSP(); vm.g_sp->picnum = Gv_GetVarX(*(insptr-1)); + if (vm.g_i != -1) spritechanged[vm.g_i]++; continue; case CON_SPGETLOTAG: