From 83ab50d66e0f93249f0bd22dfce84e776ff2b0e1 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 26 Jun 2011 21:59:42 +0000 Subject: [PATCH] * Make destructable ceilings and floors (SE 13 pointing down) behave well with TROR; also carry sprites and players on the roof of a subway. The latter uses t_data[9] on the pivot sprite. * Make the minimum resolution possible 640x480. Sometimes you'd accidentally enter something like 'vidmode 800 60' and crashes would ensue... * fix a warning git-svn-id: https://svn.eduke32.com/eduke32@1921 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/build.c | 3 +- polymer/eduke32/build/src/engine.c | 3 + polymer/eduke32/source/actors.c | 94 +++++++++++++++++++++++------- polymer/eduke32/source/game.c | 44 +++++++++++++- 4 files changed, 119 insertions(+), 25 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 76e0af268..904bcd73b 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -3411,10 +3411,9 @@ void overheadeditor(void) ulz[0] &= ~255; ulz[1] = ulz[0] + swsecheight; - if (maxceilz >= ulz[0] || ulz[0] >= ulz[1] || ulz[1] >= minfloorz) + if (maxceilz >= ulz[0] || ulz[1] >= minfloorz) { message("Too little z headroom for sandwiching"); -// message("Internal error while sandwiching: z values wrong"); goto end_yax; } } diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index a37a55fee..a63b63a29 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -9740,6 +9740,9 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da { int32_t i, j; + daxdim = max(640, daxdim); + daydim = max(480, daydim); + #ifdef USE_OPENGL extern char nogl; diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 34c892223..e2b409f0d 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -5696,6 +5696,9 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 if (s->xvel) { +#ifdef YAX_ENABLE + int32_t firstrun = 1; +#endif x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); q = G_GetAngleDelta(s->ang,x)>>3; @@ -5749,38 +5752,52 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 x = (s->xvel*sintable[s->ang&2047])>>14; TRAVERSE_CONNECT(p) - if (sector[g_player[p].ps->cursectnum].lotag != 2) { - if (g_playerSpawnPoints[p].os == s->sectnum) + if (g_player[p].ps->cursectnum < 0) { - g_playerSpawnPoints[p].ox += m; - g_playerSpawnPoints[p].oy += x; + // might happen when squished into void space +// initprintf("cursectnum < 0!\n"); + break; } - if (s->sectnum == sprite[g_player[p].ps->i].sectnum) + if (sector[g_player[p].ps->cursectnum].lotag != 2) { - rotatepoint(s->x,s->y,g_player[p].ps->pos.x,g_player[p].ps->pos.y,q,&g_player[p].ps->pos.x,&g_player[p].ps->pos.y); - - g_player[p].ps->pos.x += m; - g_player[p].ps->pos.y += x; - - g_player[p].ps->bobposx += m; - g_player[p].ps->bobposy += x; - - g_player[p].ps->ang += q; - - if (g_netServer || numplayers > 1) + if (g_playerSpawnPoints[p].os == s->sectnum) { - g_player[p].ps->opos.x = g_player[p].ps->pos.x; - g_player[p].ps->opos.y = g_player[p].ps->pos.y; + g_playerSpawnPoints[p].ox += m; + g_playerSpawnPoints[p].oy += x; } - if (sprite[g_player[p].ps->i].extra <= 0) + + if (s->sectnum == sprite[g_player[p].ps->i].sectnum +#ifdef YAX_ENABLE + || (t[9]>=0 && t[9] == sprite[g_player[p].ps->i].sectnum) +#endif + ) { - sprite[g_player[p].ps->i].x = g_player[p].ps->pos.x; - sprite[g_player[p].ps->i].y = g_player[p].ps->pos.y; + rotatepoint(s->x,s->y,g_player[p].ps->pos.x,g_player[p].ps->pos.y,q,&g_player[p].ps->pos.x,&g_player[p].ps->pos.y); + + g_player[p].ps->pos.x += m; + g_player[p].ps->pos.y += x; + + g_player[p].ps->bobposx += m; + g_player[p].ps->bobposy += x; + + g_player[p].ps->ang += q; + + if (g_netServer || numplayers > 1) + { + g_player[p].ps->opos.x = g_player[p].ps->pos.x; + g_player[p].ps->opos.y = g_player[p].ps->pos.y; + } + if (sprite[g_player[p].ps->i].extra <= 0) + { + sprite[g_player[p].ps->i].x = g_player[p].ps->pos.x; + sprite[g_player[p].ps->i].y = g_player[p].ps->pos.y; + } } } } + j = headspritesect[s->sectnum]; while (j >= 0) { @@ -5811,6 +5828,16 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 } } j = nextspritesect[j]; +#ifdef YAX_ENABLE + if (j < 0) + { + if (t[9]>=0 && firstrun) + { + firstrun = 0; + j = headspritesect[t[9]]; + } + } +#endif } A_MoveSector(i); @@ -6526,6 +6553,11 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 case 13: if (t[2]) { + // t[0]: ceiling z + // t[1]: floor z + // s->owner: 1 if affect ceiling, 0 if affect floor + // t[3]: 1 if ceiling was parallaxed at premap, 0 else + j = (SP<<5)|1; if (s->ang == 512) @@ -6552,7 +6584,27 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; sc->ceilingz = t[0]; } +#ifdef YAX_ENABLE + if (s->ang == 512) + { + int16_t cf=!s->owner, bn=yax_getbunch(sc-sector, cf); + int32_t jj, daz=SECTORFLD(sc-sector,z, cf); + if (bn >= 0) + { + for (SECTORS_OF_BUNCH(bn, cf, jj)) + { + SECTORFLD(jj,z, cf) = daz; + SECTORFLD(jj,stat, cf) &= ~(128+256 + 512+2048); + } + for (SECTORS_OF_BUNCH(bn, !cf, jj)) + { + SECTORFLD(jj,z, !cf) = daz; + SECTORFLD(jj,stat, !cf) &= ~(128+256 + 512+2048); + } + } + } +#endif if (t[3] == 1) { //Change the shades diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index ee8072b69..d2ae60ca6 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -5212,6 +5212,28 @@ int32_t A_Spawn(int32_t j, int32_t pn) sector[sect].ceilingz = sp->z; else sector[sect].floorz = sp->z; +#ifdef YAX_ENABLE + { + int16_t cf=!sp->owner, bn=yax_getbunch(sect, cf); + int32_t jj, daz=SECTORFLD(sect,z, cf); + + if (bn >= 0) + { + for (SECTORS_OF_BUNCH(bn, cf, jj)) + { + SECTORFLD(jj,z, cf) = daz; + SECTORFLD(jj,stat, cf) &= ~256; + SECTORFLD(jj,stat, cf) |= 128 + 512+2048; + } + for (SECTORS_OF_BUNCH(bn, !cf, jj)) + { + SECTORFLD(jj,z, !cf) = daz; + SECTORFLD(jj,stat, !cf) &= ~256; + SECTORFLD(jj,stat, !cf) |= 128 + 512+2048; + } + } + } +#endif } else sector[sect].ceilingz = sector[sect].floorz = sp->z; @@ -5422,7 +5444,6 @@ int32_t A_Spawn(int32_t j, int32_t pn) case 16://That rotating blocker reactor thing case 26://ESCELATOR case 30://No rotational subways - if (sp->lotag == 0) { if (sector[sect].lotag == 30) @@ -5477,9 +5498,12 @@ int32_t A_Spawn(int32_t j, int32_t pn) G_GameExit(tempbuf); } } + if (sp->lotag == 30 || sp->lotag == 6 || sp->lotag == 14 || sp->lotag == 5) { - +#ifdef YAX_ENABLE + int32_t outerwall=-1; +#endif startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; @@ -5497,12 +5521,28 @@ int32_t A_Spawn(int32_t j, int32_t pn) sector[ wall[ s ].nextsector].hitag == 0 && sector[ wall[ s ].nextsector].lotag < 3) { +#ifdef YAX_ENABLE + outerwall = wall[s].nextwall; +#endif s = wall[s].nextsector; j = 1; break; } } +#ifdef YAX_ENABLE + actor[i].t_data[9] = -1; + if (outerwall >= 0) + { + int32_t upperwall = yax_getnextwall(outerwall, YAX_CEILING); + + if (upperwall>=0 && wall[upperwall].nextsector>=0) + { + Sect_SetInterpolation(wall[upperwall].nextsector); + actor[i].t_data[9] = wall[upperwall].nextsector; + } + } +#endif if (j == 0) { Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y);