From 14e97b2a577a0999700ea918427e7b083febc2a4 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 1 Feb 2013 13:05:08 +0000 Subject: [PATCH] Don't set spriteext[].tspr when creating tsprites from the engine. Its only use is to have a actor -> tsprite mapping for the EVENT_ANIMATESPRITE event and .tspr will be set before it is run. git-svn-id: https://svn.eduke32.com/eduke32@3448 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 4 +--- polymer/eduke32/source/game.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 1d9d2a6d3..a87e7ce1a 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -814,7 +814,6 @@ static void yax_copytsprites() break; Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype)); - spriteext[spritenum].tspr = &tsprite[spritesortcnt]; tsprite[spritesortcnt].owner = spritenum; tsprite[spritesortcnt].sectnum = sectnum; // potentially tweak sectnum! @@ -2435,8 +2434,7 @@ int32_t engine_addtsprite(int16_t z, int16_t sectnum) if (spritesortcnt >= MAXSPRITESONSCREEN) return 1; - copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype)); - spriteext[z].tspr = (spritetype *)&tsprite[spritesortcnt]; + Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype)); tsprite[spritesortcnt++].owner = z; #ifdef YAX_ENABLE diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 657973c16..8cf9a6828 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -6223,11 +6223,15 @@ static int32_t G_CheckAdultTile(int32_t pic) static void G_DoEventAnimSprites(int32_t j) { - if (display_mirror) tsprite[j].statnum = TSPR_MIRROR; - if ((unsigned)tsprite[j].owner < MAXSPRITES && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) + const int32_t ow = tsprite[j].owner; + + if (display_mirror) + tsprite[j].statnum = TSPR_MIRROR; + + if ((unsigned)ow < MAXSPRITES && spriteext[ow].flags & SPREXT_TSPRACCESS) { - spriteext[tsprite[j].owner].tspr = &tsprite[j]; - VM_OnEvent(EVENT_ANIMATESPRITES, tsprite[j].owner, myconnectindex, -1, 0); + spriteext[ow].tspr = &tsprite[j]; + VM_OnEvent(EVENT_ANIMATESPRITES, ow, myconnectindex, -1, 0); } }