diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 6d02c3862..d3f02f283 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2244,11 +2244,11 @@ DETONATE: if (x < 2048) { if (SP == 1) - camsprite = i; + g_curViewscreen = i; } - else if (camsprite != -1 && T1 == 1) + else if (g_curViewscreen != -1 && T1 == 1) { - camsprite = -1; + g_curViewscreen = -1; T1 = 0; //loadtile(s->picnum); //invalidatetile(s->picnum,-1,255); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 93d9836c7..5210286b4 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -7339,14 +7339,14 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo continue; case VIEWSCREEN__STATIC: case VIEWSCREEN2__STATIC: - if (camsprite >= 0 && actor[OW].t_data[0] == 1) + if (g_curViewscreen >= 0 && actor[OW].t_data[0] == 1) { t->picnum = STATIC; t->cstat |= (rand()&12); t->xrepeat += 8; t->yrepeat += 8; } - else if (camsprite >= 0 && waloff[TILE_VIEWSCR] && walock[TILE_VIEWSCR] > 200) + else if (g_curViewscreen >= 0 && waloff[TILE_VIEWSCR] && walock[TILE_VIEWSCR] > 200) { t->picnum = TILE_VIEWSCR; } diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index b0f01ff05..faeb1582b 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -75,7 +75,7 @@ G_EXTERN input_t loc; G_EXTERN input_t recsync[RECSYNCBUFSIZ]; G_EXTERN int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos; G_EXTERN int16_t animatesect[MAXANIMATES]; -G_EXTERN int16_t camsprite; +G_EXTERN int16_t g_curViewscreen; G_EXTERN int16_t cyclers[MAXCYCLERS][6],g_numCyclers; G_EXTERN int16_t g_globalRandom; G_EXTERN int16_t g_mirrorWall[64],g_mirrorSector[64],g_mirrorCount; diff --git a/polymer/eduke32/source/lunatic/test.lua b/polymer/eduke32/source/lunatic/test.lua index 6bd0b6db1..338bd6edb 100644 --- a/polymer/eduke32/source/lunatic/test.lua +++ b/polymer/eduke32/source/lunatic/test.lua @@ -606,11 +606,14 @@ gameevent { "DISPLAYROOMS", - function() + function(aci, pli) + local ps = player[pli] local cam = gv.cam - cam.pos.z = cam.pos.z + 64*16*math.sin(gv.totalclock/30) - local ps = player[0] + if (ps.newowner < 0) then + cam.pos.z = cam.pos.z + 64*16*math.sin(gv.totalclock/30) + end + if (ps.cursectnum >= 0) then local hit = sector[ps.cursectnum]:zrangeat(cam.pos) if (gv.totalclock%200==0) then diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 8afbe2467..7eed5b6ae 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -936,7 +936,7 @@ static void resetprestat(int32_t snum,int32_t g) ud.camerasprite =-1; ud.eog = 0; tempwallptr = 0; - camsprite =-1; + g_curViewscreen =-1; g_earthquakeTime = 0; g_numInterpolations = 0; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 95cd055d3..e98785e94 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -1017,7 +1017,7 @@ static const dataspec_t svgm_anmisc[] = { DS_SAVEFN, (void *)&sv_preanimateptrsave, 0, 1 }, { 0, &animateptr[0], sizeof(animateptr[0]), MAXANIMATES }, { DS_SAVEFN|DS_LOADFN , (void *)&sv_postanimateptr, 0, 1 }, - { 0, &camsprite, sizeof(camsprite), 1 }, + { 0, &g_curViewscreen, sizeof(g_curViewscreen), 1 }, { 0, &msx[0], sizeof(msx[0]), sizeof(msx)/sizeof(msx[0]) }, { 0, &msy[0], sizeof(msy[0]), sizeof(msy)/sizeof(msy[0]) }, { 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 }, diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index bcdf57cad..e214631f7 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -345,25 +345,28 @@ int32_t SetAnimation(int32_t animsect,int32_t *animptr, int32_t thegoal, int32_t void G_AnimateCamSprite(void) { - int32_t i = camsprite; + int32_t i = g_curViewscreen; #ifdef DEBUG_VALGRIND_NO_SMC return; #endif - if (camsprite < 0) + if (g_curViewscreen < 0) return; if (T1 >= 4) { + const DukePlayer_t *ps = g_player[screenpeek].ps; T1 = 0; - if (g_player[screenpeek].ps->newowner >= 0) - OW = g_player[screenpeek].ps->newowner; - else if (OW >= 0 && dist(&sprite[g_player[screenpeek].ps->i],&sprite[i]) < 8192) + if (ps->newowner >= 0) + OW = ps->newowner; + else if (OW >= 0 && dist(&sprite[ps->i], &sprite[i]) < 8192) { if (waloff[TILE_VIEWSCR] == 0) allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]); - else walock[TILE_VIEWSCR] = 255; + else + walock[TILE_VIEWSCR] = 255; + G_SetupCamTile(OW, TILE_VIEWSCR); #ifdef POLYMER // HACK: force texture update on viewscreen sprite in Polymer!