diff --git a/polymer/eduke32/ror.map b/polymer/eduke32/ror.map new file mode 100644 index 000000000..684ec6ae9 Binary files /dev/null and b/polymer/eduke32/ror.map differ diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 36a5ad670..f91e96d09 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -365,7 +365,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) if (sprite[spritenum].statnum == 4) retval = - clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype); + clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype); else retval = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype); @@ -380,8 +380,60 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) daz = sprite[spritenum].z + ((change->z*TICSPERFRAME)>>3); if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz)) sprite[spritenum].z = daz; - else if (retval == 0) - return(16384+dasectnum); + else if (retval == 0) retval = 16384+dasectnum; + + if (retval == (16384+dasectnum)) + if (sprite[spritenum].statnum == STAT_PROJECTILE) + { + int32_t i, nexti; + + TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRANSPORT], i, nexti) + if (sprite[i].sectnum == dasectnum) + { + switch (sector[dasectnum].lotag) + { + case 1: + if (daz >= ActorExtra[spritenum].floorz) + { + if (totalclock > ActorExtra[spritenum].temp_data[9]) + { + ActorExtra[spritenum].temp_data[9] = totalclock + (TICSPERFRAME<<2); + + sprite[spritenum].x += (sprite[OW].x-SX); + sprite[spritenum].y += (sprite[OW].y-SY); + sprite[spritenum].z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz; + + ActorExtra[spritenum].bposx = sprite[spritenum].x; + ActorExtra[spritenum].bposy = sprite[spritenum].y; + ActorExtra[spritenum].bposz = sprite[spritenum].z; + + changespritesect(spritenum,sprite[OW].sectnum); + } + + return 0; + } + case 2: + if (daz <= ActorExtra[spritenum].ceilingz) + { + if (totalclock > ActorExtra[spritenum].temp_data[9]) + { + ActorExtra[spritenum].temp_data[9] = totalclock + (TICSPERFRAME<<2); + sprite[spritenum].x += (sprite[OW].x-SX); + sprite[spritenum].y += (sprite[OW].y-SY); + sprite[spritenum].z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz; + + ActorExtra[spritenum].bposx = sprite[spritenum].x; + ActorExtra[spritenum].bposy = sprite[spritenum].y; + ActorExtra[spritenum].bposz = sprite[spritenum].z; + + changespritesect(spritenum,sprite[OW].sectnum); + } + + return 0; + } + } + } + } return(retval); } @@ -2788,7 +2840,7 @@ static void G_MoveWeapons(void) } - if (s->picnum == RPG && s->yvel >= 0 && sprite[s->yvel].sectnum < MAXSECTORS) + if (s->picnum == RPG && s->yvel >= 0) if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) j = 49152|s->yvel; @@ -3136,7 +3188,7 @@ static void G_MoveTransports(void) k = 0; if (onfloorz && sectlotag == 1 && g_player[p].ps->on_ground && - g_player[p].ps->posz > (sector[sect].floorz-1080) && + g_player[p].ps->posz >= sector[sect].floorz && (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH) || g_player[p].ps->poszv > 2048)) // if( onfloorz && sectlotag == 1 && g_player[p].ps->posz > (sector[sect].floorz-(6<<8)) ) { @@ -3151,12 +3203,15 @@ static void G_MoveTransports(void) g_player[p].ps->oposz = g_player[p].ps->posz = sector[sprite[OW].sectnum].ceilingz; - g_player[p].ps->posxv = 4096-(krand()&8192); - g_player[p].ps->posyv = 4096-(krand()&8192); - // g_player[p].ps->poszv += 1080; + /* + g_player[p].ps->posxv = 4096-(krand()&8192); + g_player[p].ps->posyv = 4096-(krand()&8192); + */ + if (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH)) + g_player[p].ps->poszv += 512; } - if (onfloorz && sectlotag == 2 && g_player[p].ps->posz < (sector[sect].ceilingz+1080) && g_player[p].ps->poszv == 0) + if (onfloorz && sectlotag == 2 && g_player[p].ps->posz <= sector[sect].ceilingz /*&& g_player[p].ps->poszv == 0*/) { k = 1; // if( sprite[j].extra <= 0) break; @@ -3172,14 +3227,15 @@ static void G_MoveTransports(void) g_player[p].ps->jumping_toggle = 1; g_player[p].ps->jumping_counter = 0; + g_player[p].ps->poszv = 0; // g_player[p].ps->poszv += 1024; } if (k == 1) { vec3_t vect; - g_player[p].ps->oposx = g_player[p].ps->posx += sprite[OW].x-SX; - g_player[p].ps->oposy = g_player[p].ps->posy += sprite[OW].y-SY; + g_player[p].ps->bobposx = g_player[p].ps->oposx = g_player[p].ps->posx += sprite[OW].x-SX; + g_player[p].ps->bobposy = g_player[p].ps->oposy = g_player[p].ps->posy += sprite[OW].y-SY; if (sprite[OW].owner != OW) g_player[p].ps->transporter_hold = -2; @@ -3215,13 +3271,14 @@ static void G_MoveTransports(void) if (sprite[j].extra > 0) goto JBOLT; } - case 4: +// case 4: case 5: case 12: case 13: ll = klabs(sprite[j].zvel); + if (totalclock > ActorExtra[j].temp_data[9]) { warpspriteto = 0; if (ll && sectlotag == 2 && sprite[j].z < (sector[sect].ceilingz+ll)) @@ -3259,7 +3316,7 @@ static void G_MoveTransports(void) case PLAYERONWATER__STATIC: if (sectlotag == 2) { - sprite[j].cstat &= 32767; + sprite[j].cstat &= 32768; break; } default: @@ -3329,9 +3386,11 @@ static void G_MoveTransports(void) } break; case 1: + ActorExtra[j].temp_data[9] = totalclock + (TICSPERFRAME<<2); + sprite[j].x += (sprite[OW].x-SX); sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sector[sprite[OW].sectnum].ceilingz+ll; + sprite[j].z = sector[sprite[OW].sectnum].ceilingz; ActorExtra[j].bposx = sprite[j].x; ActorExtra[j].bposy = sprite[j].y; @@ -3341,9 +3400,10 @@ static void G_MoveTransports(void) break; case 2: + ActorExtra[j].temp_data[9] = totalclock + (TICSPERFRAME<<2); sprite[j].x += (sprite[OW].x-SX); sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sector[sprite[OW].sectnum].floorz-ll; + sprite[j].z = sector[sprite[OW].sectnum].floorz; ActorExtra[j].bposx = sprite[j].x; ActorExtra[j].bposy = sprite[j].y; @@ -4302,7 +4362,7 @@ static void G_MoveActors(void) if (j >= 0) { t[3] = 1; - t[4] = 0; + t[2] = 0; l = 0; s->xvel = 0; goto DETONATEB; @@ -4354,7 +4414,7 @@ static void G_MoveActors(void) if (t[3] == 0 && (s->picnum == BOUNCEMINE || s->picnum == MORTER) && (j || x < 844)) { t[3] = 1; - t[4] = 0; + t[2] = 0; l = 0; s->xvel = 0; goto DETONATEB; @@ -4423,9 +4483,9 @@ DETONATEB: if (t[6] == 3) { - t[4]++; + t[2]++; - if (t[4] == 2) + if (t[2] == 2) { x = s->extra; m = 0; @@ -4457,7 +4517,7 @@ DETONATEB: goto BOLT; } - if (t[4] > 20) + if (t[2] > 20) { if (s->owner != i || ud.respawn_items == 0) { @@ -7861,171 +7921,173 @@ void G_MoveWorld(void) ActorExtra[i].lightId = -1; ActorExtra[i].lightptr = NULL; } - break; } - - if (ActorExtra[i].lightptr != NULL && ActorExtra[i].lightcount) + else { - if (!(--ActorExtra[i].lightcount)) + + if (ActorExtra[i].lightptr != NULL && ActorExtra[i].lightcount) { - polymer_deletelight(ActorExtra[i].lightId); - ActorExtra[i].lightId = -1; - ActorExtra[i].lightptr = NULL; - } - } - - switch (DynamicTileMap[sprite[i].picnum-1]) - { - case DIPSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - case PULLSWITCH__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case TECHSWITCH__STATIC: - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - { - int32_t x, y; - - if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) - { - if (ActorExtra[i].lightptr != NULL) + if (!(--ActorExtra[i].lightcount)) { polymer_deletelight(ActorExtra[i].lightId); ActorExtra[i].lightId = -1; ActorExtra[i].lightptr = NULL; } - break; } - x = ((sintable[(s->ang+512)&2047])>>7); - y = ((sintable[(s->ang)&2047])>>7); - - s->x += x; - s->y += y; - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 48+(255<<8)+(48<<16),PR_LIGHT_PRIO_LOW); - s->x -= x; - s->y -= y; - } - break; - } - switch (DynamicTileMap[sprite[i].picnum]) - { - case ATOMICHEALTH__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case FIRE__STATIC: - case FIRE2__STATIC: - /* - if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; - if (s->z > ActorExtra[i].floorz+2048) break; - */ - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case BURNING__STATIC: - case BURNING2__STATIC: - /* - if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; - if (s->z > ActorExtra[i].floorz + 2048) break; - */ - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case OOZFILTER__STATIC: - if (s->xrepeat > 4) - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 6144, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - case FLOORFLAME__STATIC: - case FIREBARREL__STATIC: - case FIREVASE__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case EXPLOSION2__STATIC: - if (!ActorExtra[i].lightcount) - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8), - s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME); - break; - case FORCERIPPLE__STATIC: - // case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME); - break; - case SHRINKEREXPLOSION__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - case FREEZEBLAST__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case COOLEXPLOSION1__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<3, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case SHRINKSPARK__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - case FIRELASER__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); - break; - case RPG__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); - break; - - case DIPSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - case PULLSWITCH__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case TECHSWITCH__STATIC: - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - { - int32_t x, y; - - if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) + switch (DynamicTileMap[sprite[i].picnum-1]) { - if (ActorExtra[i].lightptr != NULL) + case DIPSWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + case PULLSWITCH__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case TECHSWITCH__STATIC: + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: + { + int32_t x, y; + + if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) { - polymer_deletelight(ActorExtra[i].lightId); - ActorExtra[i].lightId = -1; - ActorExtra[i].lightptr = NULL; + if (ActorExtra[i].lightptr != NULL) + { + polymer_deletelight(ActorExtra[i].lightId); + ActorExtra[i].lightId = -1; + ActorExtra[i].lightptr = NULL; + } + break; } - break; + + x = ((sintable[(s->ang+512)&2047])>>7); + y = ((sintable[(s->ang)&2047])>>7); + + s->x += x; + s->y += y; + + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 48+(255<<8)+(48<<16),PR_LIGHT_PRIO_LOW); + s->x -= x; + s->y -= y; + } + break; } - x = ((sintable[(s->ang+512)&2047])>>7); - y = ((sintable[(s->ang)&2047])>>7); + switch (DynamicTileMap[sprite[i].picnum]) + { + case ATOMICHEALTH__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); + break; - s->x += x; - s->y += y; + case FIRE__STATIC: + case FIRE2__STATIC: + /* + if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; + if (s->z > ActorExtra[i].floorz+2048) break; + */ + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); + break; - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW); - s->x -= x; - s->y -= y; - } - break; + case BURNING__STATIC: + case BURNING2__STATIC: + /* + if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; + if (s->z > ActorExtra[i].floorz + 2048) break; + */ + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); + break; + + case OOZFILTER__STATIC: + if (s->xrepeat > 4) + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 6144, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); + break; + case FLOORFLAME__STATIC: + case FIREBARREL__STATIC: + case FIREVASE__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); + break; + + case EXPLOSION2__STATIC: + if (!ActorExtra[i].lightcount) + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8), + s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME); + break; + case FORCERIPPLE__STATIC: + // case TRANSPORTERSTAR__STATIC: + case TRANSPORTERBEAM__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME); + break; + case SHRINKEREXPLOSION__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); + break; + case FREEZEBLAST__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); + break; + + case COOLEXPLOSION1__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<3, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); + break; + + case SHRINKSPARK__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); + break; + case FIRELASER__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); + break; + case RPG__STATIC: + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); + break; + + case DIPSWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + case PULLSWITCH__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case TECHSWITCH__STATIC: + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: + { + int32_t x, y; + + if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) + { + if (ActorExtra[i].lightptr != NULL) + { + polymer_deletelight(ActorExtra[i].lightId); + ActorExtra[i].lightId = -1; + ActorExtra[i].lightptr = NULL; + } + break; + } + + x = ((sintable[(s->ang+512)&2047])>>7); + y = ((sintable[(s->ang)&2047])>>7); + + s->x += x; + s->y += y; + + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW); + s->x -= x; + s->y -= y; + } + break; + } } } #endif - if (!apScriptGameEvent[EVENT_GAME] || A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE)) { i = nextspritestat[i]; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index f25ffcb3d..5cd7bd5ad 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -223,7 +223,7 @@ void create_map_snapshot(void) { mapstate->sectors = (sectortype *)Bcalloc(1, sizeof(sectortype) * numsectors); mapstate->sectsiz = j = lzf_compress(§or[0], sizeof(sectortype) * numsectors, - &mapstate->sectors[0], sizeof(sectortype) * numsectors); + &mapstate->sectors[0], sizeof(sectortype) * numsectors); mapstate->sectors = (sectortype *)Brealloc(mapstate->sectors, j); mapstate->sectcrc = tempcrc; } @@ -244,7 +244,7 @@ void create_map_snapshot(void) { mapstate->walls = (walltype *)Bcalloc(1, sizeof(walltype) * numwalls); mapstate->wallsiz = j = lzf_compress(&wall[0], sizeof(walltype) * numwalls, - &mapstate->walls[0], sizeof(walltype) * numwalls); + &mapstate->walls[0], sizeof(walltype) * numwalls); mapstate->walls = (walltype *)Brealloc(mapstate->walls, j); mapstate->wallcrc = tempcrc; } @@ -265,7 +265,7 @@ void create_map_snapshot(void) { int32_t i = 0; spritetype *tspri = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites), - *spri = &tspri[0]; + *spri = &tspri[0]; mapstate->sprites = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites); for (j=0; jspritesiz = j = lzf_compress(&tspri[0], sizeof(spritetype) * numsprites, - &mapstate->sprites[0], sizeof(spritetype) * numsprites); + &mapstate->sprites[0], sizeof(spritetype) * numsprites); mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j); mapstate->spritecrc = tempcrc; Bfree(tspri); @@ -1164,8 +1164,8 @@ void ExtShowWallData(int16_t wallnum) //F6 { if (sprite[i].statnum==0) switch (sprite[i].picnum) - { - //LOTAG + { + //LOTAG case ACTIVATOR: case ACTIVATORLOCKED: case TOUCHPLATE: @@ -1202,7 +1202,7 @@ void ExtShowWallData(int16_t wallnum) //F6 default: break; - } + } } // end sprite loop @@ -1215,7 +1215,7 @@ void ExtShowWallData(int16_t wallnum) //F6 { if (sprite[i].pal!=0) switch (sprite[i].picnum) - { + { case LIZTROOP : case LIZTROOPRUNNING : case LIZTROOPSTAYPUT : @@ -1241,10 +1241,10 @@ void ExtShowWallData(int16_t wallnum) //F6 default: break; - } + } else switch (sprite[i].picnum) - { + { case LIZTROOP : case LIZTROOPRUNNING : case LIZTROOPSTAYPUT : @@ -1297,7 +1297,7 @@ void ExtShowWallData(int16_t wallnum) //F6 default: break; - }// end switch + }// end switch }// end if }//end for total=0; @@ -1894,14 +1894,14 @@ ENDFOR1: } for (i=0; j=(curhp==0)?(i+curline+1):(i+curline), - inumlines; i++) + inumlines; i++) { if (ydim-overridepm16y+28+i*9+32 >= ydim) break; Bmemcpy(disptext[i], helppage[curhp]->line[j], 80); printext16(8,ydim-overridepm16y+28+i*9,editorcolors[10], - (j==highlightline && curhp==highlighthp - && totalclock-lasthighlighttime<120*5)?editorcolors[1]:-1, - disptext[i],0); + (j==highlightline && curhp==highlighthp + && totalclock-lasthighlighttime<120*5)?editorcolors[1]:-1, + disptext[i],0); } showframe(1); @@ -2071,7 +2071,7 @@ static void SoundDisplay() // SoundToggle = 1; while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0 - && keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode + && keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode { if (handleevents()) { @@ -2202,7 +2202,7 @@ static void SoundDisplay() if (keystatus[1]) bad = 1; else if (ch == 's' || ch == 'd' || ch == 'f' || ch == 'g' || - ch == '1' || ch == '2' || ch == '3' || ch == '4' || ch == '5') + ch == '1' || ch == '2' || ch == '3' || ch == '4' || ch == '5') { bad = 2; sort_sounds(ch); @@ -2232,11 +2232,11 @@ static void SoundDisplay() if (ydim-overridepm16y+28+i*9+32 >= ydim) break; Bsprintf(disptext[i], - "%4d .................... ................ %6d:%-6d %3d %c%c%c%c%c %6d", - // 5678901234567890X23456789012345678901234567 - k, snd->ps, snd->pe, snd->pr, - snd->m&1 ? 'R':'-', snd->m&2 ? 'M':'-', snd->m&4 ? 'D':'-', - snd->m&8 ? 'P':'-', snd->m&16 ? 'G':'-', snd->vo); + "%4d .................... ................ %6d:%-6d %3d %c%c%c%c%c %6d", + // 5678901234567890X23456789012345678901234567 + k, snd->ps, snd->pe, snd->pr, + snd->m&1 ? 'R':'-', snd->m&2 ? 'M':'-', snd->m&4 ? 'D':'-', + snd->m&8 ? 'P':'-', snd->m&16 ? 'G':'-', snd->vo); for (l = Bsnprintf(disptext[i]+5, 20, "%s", snd->definedname); l<20; l++) disptext[i][5+l] = ' '; if (snd->filename) @@ -2253,9 +2253,9 @@ static void SoundDisplay() } printext16(8, ydim-overridepm16y+28+i*9, - S_CheckSoundPlaying(-1, k) ? editorcolors[2] : editorcolors[10], - j==cursnd+curofs ? editorcolors[1] : -1, - disptext[i], 0); + S_CheckSoundPlaying(-1, k) ? editorcolors[2] : editorcolors[10], + j==cursnd+curofs ? editorcolors[1] : -1, + disptext[i], 0); } showframe(1); @@ -2325,7 +2325,7 @@ static void M32_MoveFX(void) ht = s->hitag; if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && - AmbienceToggle && sector[s->sectnum].floorz != sector[s->sectnum].ceilingz) + AmbienceToggle && sector[s->sectnum].floorz != sector[s->sectnum].ceilingz) { if ((g_sounds[s->lotag].m&2)) { @@ -2337,7 +2337,7 @@ static void M32_MoveFX(void) for (j = headspritestat[0]; j >= 0; j = nextspritestat[j]) { if (s->picnum == MUSICANDSFX && j != i && sprite[j].lotag < 999 && - (sprite[j].filler&1) == 1 && dist(&sprite[j],(spritetype*)&pos) > x) + (sprite[j].filler&1) == 1 && dist(&sprite[j],(spritetype*)&pos) > x) { S_StopEnvSound(sprite[j].lotag,j); break; @@ -2603,8 +2603,8 @@ static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,in for (j=0; j localartlookupnum-nDisplayedTiles-1) - || (moffset > 0 && iTopLeftTile==0)) + || (moffset > 0 && iTopLeftTile==0)) { moffset=0; searchy -= mousedy*2; @@ -3205,7 +3205,7 @@ static int32_t m32gettile(int32_t idInitialTile) // Zoom in / out using numeric key pad's / and * keys if (((keystatus[KEYSC_gSLASH] || (!scrollmode && bstatus&16)) && s_Zoom<(signed)(NUM_ZOOMS-1)) - || ((keystatus[KEYSC_gSTAR] || (!scrollmode && bstatus&32)) && s_Zoom>0)) + || ((keystatus[KEYSC_gSTAR] || (!scrollmode && bstatus&32)) && s_Zoom>0)) { if (keystatus[KEYSC_gSLASH] || (!scrollmode && bstatus&16)) { @@ -3216,7 +3216,7 @@ static int32_t m32gettile(int32_t idInitialTile) // Watch out : If editor window is small, then the next zoom level // might get so large that even one tile might not fit ! if ((ZoomToThumbSize[s_Zoom+1] <= xdim) - && (ZoomToThumbSize[s_Zoom+1] <= ydim)) + && (ZoomToThumbSize[s_Zoom+1] <= ydim)) { // Phew, plenty of room. s_Zoom++; @@ -3646,7 +3646,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i MulInc = 1; while ((TileSizeX/DivInc > TileDim) - || (TileSizeY/DivInc) > TileDim) + || (TileSizeY/DivInc) > TileDim) { DivInc++; } @@ -3654,7 +3654,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i if (DivInc == 1 && s_TileZoom) { while (((TileSizeX*(MulInc+1)) <= TileDim) - && ((TileSizeY*(MulInc+1)) <= TileDim)) + && ((TileSizeY*(MulInc+1)) <= TileDim)) { MulInc++; } @@ -3707,38 +3707,38 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i } } - idTile = localartlookup[ iSelected ]; + idTile = localartlookup[ iSelected ]; - // Draw info bar at bottom. + // Draw info bar at bottom. - // Clear out behind the text for improved visibility. - //drawline256(0, (ydim-12)<<12, xdim<<12, (ydim-12)<<12, whitecol); - for (i=ydim-12; i>2,ydim-10,whitecol,-1,szT,0); + // Tile dimensions. + Bsprintf(szT,"%dx%d",tilesizx[idTile],tilesizy[idTile]); + printext256(xdim>>2,ydim-10,whitecol,-1,szT,0); - // EditArt animation flags. - Bsprintf(szT,"%d, %d",(picanm[idTile]>>8)&0xFF,(picanm[idTile]>>16)&0xFF); - printext256((xdim>>2)+100,ydim-10,whitecol,-1,szT,0); + // EditArt animation flags. + Bsprintf(szT,"%d, %d",(picanm[idTile]>>8)&0xFF,(picanm[idTile]>>16)&0xFF); + printext256((xdim>>2)+100,ydim-10,whitecol,-1,szT,0); - m32_showmouse(); + m32_showmouse(); - enddrawing(); - showframe(1); + enddrawing(); + showframe(1); - return(0); + return(0); } @@ -3958,10 +3958,10 @@ static void DoSpriteOrnament(int32_t i) hitdata_t hitinfo; hitscan((const vec3_t *)&sprite[i],sprite[i].sectnum, - sintable[(sprite[i].ang+2560+1024)&2047], - sintable[(sprite[i].ang+2048+1024)&2047], - 0, - &hitinfo,CLIPMASK1); + sintable[(sprite[i].ang+2560+1024)&2047], + sintable[(sprite[i].ang+2048+1024)&2047], + 0, + &hitinfo,CLIPMASK1); sprite[i].x = hitinfo.pos.x; sprite[i].y = hitinfo.pos.y; @@ -3969,7 +3969,7 @@ static void DoSpriteOrnament(int32_t i) changespritesect(i,hitinfo.hitsect); if (hitinfo.hitwall >= 0) sprite[i].ang = ((getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x, - wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y)+512)&2047); + wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y)+512)&2047); //Make sure sprite's in right sector if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0) @@ -3983,7 +3983,7 @@ static void DoSpriteOrnament(int32_t i) int64 ldistsqr(spritetype *s1,spritetype *s2) { return (((int64)(s2->x - s1->x))*((int64)(s2->x - s1->x)) + - ((int64)(s2->y - s1->y))*((int64)(s2->y - s1->y))); + ((int64)(s2->y - s1->y))*((int64)(s2->y - s1->y))); } void rendertext(int16_t startspr) @@ -4006,7 +4006,7 @@ void rendertext(int16_t startspr) } if (startspr<0 || startspr>=MAXSPRITES || - sprite[startspr].statnum == MAXSTATUS) + sprite[startspr].statnum == MAXSTATUS) return; if (numalphabets == 0) @@ -4148,7 +4148,7 @@ ENDFOR1: printmessage256(0,0,"^251Text entry mode.^31 Navigation keys change vars."); Bsprintf(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d", - hgap, vgap, spcgap[alphidx], sprite[linebegspr].shade, sprite[linebegspr].pal); + hgap, vgap, spcgap[alphidx], sprite[linebegspr].shade, sprite[linebegspr].pal); printmessage256(0, 9, buffer); showframe(1); @@ -4373,8 +4373,8 @@ static void Keys3d(void) case 0: case 4: drawtileinfo("Current",WIND1X,WIND1Y,wall[searchwall].picnum,wall[searchwall].shade, - wall[searchwall].pal,wall[searchwall].cstat,wall[searchwall].lotag, - wall[searchwall].hitag,wall[searchwall].extra); + wall[searchwall].pal,wall[searchwall].cstat,wall[searchwall].lotag, + wall[searchwall].hitag,wall[searchwall].extra); dax = wall[searchwall].x-wall[wall[searchwall].point2].x; day = wall[searchwall].y-wall[wall[searchwall].point2].y; @@ -4400,8 +4400,8 @@ static void Keys3d(void) break; case 1: drawtileinfo("Current",WIND1X,WIND1Y,sector[searchsector].ceilingpicnum,sector[searchsector].ceilingshade, - sector[searchsector].ceilingpal,sector[searchsector].ceilingstat, - sector[searchsector].lotag,sector[searchsector].hitag,sector[searchsector].extra); + sector[searchsector].ceilingpal,sector[searchsector].ceilingstat, + sector[searchsector].lotag,sector[searchsector].hitag,sector[searchsector].extra); Bsprintf(lines[num++],"Panning: %d, %d",sector[searchsector].ceilingxpanning,sector[searchsector].ceilingypanning); Bsprintf(lines[num++],"CeilingZ: %d",sector[searchsector].ceilingz); @@ -4414,8 +4414,8 @@ static void Keys3d(void) break; case 2: drawtileinfo("Current",WIND1X,WIND1Y,sector[searchsector].floorpicnum,sector[searchsector].floorshade, - sector[searchsector].floorpal,sector[searchsector].floorstat, - sector[searchsector].lotag,sector[searchsector].hitag,sector[searchsector].extra); + sector[searchsector].floorpal,sector[searchsector].floorstat, + sector[searchsector].lotag,sector[searchsector].hitag,sector[searchsector].extra); Bsprintf(lines[num++],"Panning: %d,%d",sector[searchsector].floorxpanning,sector[searchsector].floorypanning); Bsprintf(lines[num++],"FloorZ: %d",sector[searchsector].floorz); @@ -4428,8 +4428,8 @@ static void Keys3d(void) break; case 3: drawtileinfo("Current",WIND1X,WIND1Y,sprite[searchwall].picnum,sprite[searchwall].shade, - sprite[searchwall].pal,sprite[searchwall].cstat,sprite[searchwall].lotag, - sprite[searchwall].hitag,sprite[searchwall].extra); + sprite[searchwall].pal,sprite[searchwall].cstat,sprite[searchwall].lotag, + sprite[searchwall].hitag,sprite[searchwall].extra); Bsprintf(lines[num++],"Repeat: %d,%d",sprite[searchwall].xrepeat,sprite[searchwall].yrepeat); Bsprintf(lines[num++],"PosXY: %d,%d",sprite[searchwall].x,sprite[searchwall].y); @@ -4617,17 +4617,17 @@ static void Keys3d(void) { wall[w].pal = pal[2]; } - if (pal[3] > -1) - for (k=0; k -1) + for (k=0; k= 0) { - w = headspritesect[highlightsector[k]]; - while (w >= 0) - { - j = nextspritesect[w]; - sprite[w].pal = pal[3]; - w = j; - } + j = nextspritesect[w]; + sprite[w].pal = pal[3]; + w = j; } + } } message("Palettes changed"); } @@ -4987,7 +4987,7 @@ static void Keys3d(void) } smooshyalign = keystatus[KEYSC_gKP5]; - repeatpanalign = eitherSHIFT || (bstatus&2); + repeatpanalign = (eitherSHIFT || (bstatus&2)); if (mlook == 2) mlook = 0; @@ -5034,16 +5034,16 @@ static void Keys3d(void) } break; } - while (k > 0) - { - sector[searchsector].visibility++; - if (sector[searchsector].visibility == 240) - sector[searchsector].visibility = 239; - k--; - } - Bsprintf(getmessage,"Sector %d visibility %d",searchsector,sector[searchsector].visibility); - message(getmessage); - asksave = 1; + while (k > 0) + { + sector[searchsector].visibility++; + if (sector[searchsector].visibility == 240) + sector[searchsector].visibility = 239; + k--; + } + Bsprintf(getmessage,"Sector %d visibility %d",searchsector,sector[searchsector].visibility); + message(getmessage); + asksave = 1; } } else @@ -5131,16 +5131,16 @@ static void Keys3d(void) } break; } - while (k > 0) - { - sector[searchsector].visibility--; - if (sector[searchsector].visibility == 239) - sector[searchsector].visibility = 240; - k--; - } - Bsprintf(getmessage,"Sector %d visibility %d",searchsector,sector[searchsector].visibility); - message(getmessage); - asksave = 1; + while (k > 0) + { + sector[searchsector].visibility--; + if (sector[searchsector].visibility == 239) + sector[searchsector].visibility = 240; + k--; + } + Bsprintf(getmessage,"Sector %d visibility %d",searchsector,sector[searchsector].visibility); + message(getmessage); + asksave = 1; } } else @@ -5605,26 +5605,26 @@ static void Keys3d(void) break; } - if (k == 0) - { - sprite[searchwall].z -= updownunits << ((eitherCTRL && mouseaction)*3); - if (!spnoclip)sprite[searchwall].z = max(sprite[searchwall].z,spriteonceilingz(searchwall)); - Bsprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); - message(getmessage); + if (k == 0) + { + sprite[searchwall].z -= updownunits << ((eitherCTRL && mouseaction)*3); + if (!spnoclip)sprite[searchwall].z = max(sprite[searchwall].z,spriteonceilingz(searchwall)); + Bsprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); + message(getmessage); - } - else + } + else + { + for (i=0; i= 0 && !mouseaction) switch (searchstat) - { + { case 0: case 1: case 4: @@ -6416,7 +6416,7 @@ static void Keys3d(void) alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); message("Sector %d align floor to wall %d",searchsector,searchwall); break; - } + } } else { @@ -6469,7 +6469,7 @@ static void Keys3d(void) i = wall[searchwall].nextsector; if (i >= 0 && !mouseaction) switch (searchstat) - { + { case 1: alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); message("Sector %d align ceiling to wall %d",searchsector,searchwall); @@ -6480,7 +6480,7 @@ static void Keys3d(void) alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); message("Sector %d align floor to wall %d",searchsector,searchwall); break; - } + } } else { @@ -6534,7 +6534,7 @@ static void Keys3d(void) i = (i&0x4)+((i>>4)&3); if (stat&64) // align to first wall switch (i) - { + { case 0:break; case 1:ma=-ma; break; case 2:ma=1024-ma; break; @@ -6543,10 +6543,10 @@ static void Keys3d(void) case 5:ma+=512; break; case 6:ma-=512; break; case 7:ma=512-ma; break; - } + } else switch (i) - { + { case 0:ma=-ma; break; case 1:break; case 2:ma+=1024; break; @@ -6555,7 +6555,7 @@ static void Keys3d(void) case 5:ma=512-ma; break; case 6:ma=-512-ma; break; case 7:ma+=512; break; - } + } a=ksqrt(mouseax*mouseax+mouseay*mouseay); if (a) @@ -6710,7 +6710,7 @@ static void Keys3d(void) dayvect = yvect; } clipmove((vec3_t *)&sprite[searchwall], - &cursectnum,daxvect,dayvect,128L,4L<<8,4L<<8,spnoclip?1:CLIPMASK0); + &cursectnum,daxvect,dayvect,128L,4L<<8,4L<<8,spnoclip?1:CLIPMASK0); setsprite(searchwall,(vec3_t *)&sprite[searchwall]); } else @@ -6849,7 +6849,7 @@ static void Keys3d(void) dayvect = yvect; } clipmove((vec3_t *)&sprite[searchwall], - &cursectnum,daxvect,dayvect,128L,4L<<8,4L<<8,spnoclip?1:CLIPMASK0); + &cursectnum,daxvect,dayvect,128L,4L<<8,4L<<8,spnoclip?1:CLIPMASK0); setsprite(searchwall,(vec3_t *)&sprite[searchwall]); } else @@ -7175,7 +7175,7 @@ static void Keys3d(void) j = k; break; } - sprite[searchwall].picnum = j; + sprite[searchwall].picnum = j; } sprite[searchwall].shade = tempshade; sprite[searchwall].pal = temppal; @@ -7435,13 +7435,13 @@ static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards case 3: k = gs_sprite[1][3]; if (k != sprite[gs_cursprite].xrepeat && - k != sprite[gs_cursprite].yrepeat) + k != sprite[gs_cursprite].yrepeat) goto NEXTSPRITE; break; case 4: k = gs_sprite[1][4]; if (k != sprite[gs_cursprite].xoffset && - k != sprite[gs_cursprite].yoffset) + k != sprite[gs_cursprite].yoffset) goto NEXTSPRITE; break; case 5: k = sprite[gs_cursprite].picnum; break; @@ -7464,18 +7464,18 @@ static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards if (k != gs_sprite[i][j]) goto NEXTSPRITE; } - // found matching sprite - pos.x = sprite[gs_cursprite].x; - pos.y = sprite[gs_cursprite].y; - ang = sprite[gs_cursprite].ang; + // found matching sprite + pos.x = sprite[gs_cursprite].x; + pos.y = sprite[gs_cursprite].y; + ang = sprite[gs_cursprite].ang; - printmessage16("%s Sprite seach%s: found sprite %d", dir<0 ? "<" : ">", - did_wrap ? " (wrap)" : "", gs_cursprite); - did_wrap = 0; - return; + printmessage16("%s Sprite seach%s: found sprite %d", dir<0 ? "<" : ">", + did_wrap ? " (wrap)" : "", gs_cursprite); + did_wrap = 0; + return; NEXTSPRITE: - ; + ; } printmessage16("%s Sprite search: none found", dir<0 ? "<" : ">"); } @@ -7662,7 +7662,7 @@ static void Keys2d(void) showsectordata((int16_t)i); break; } - // printmessage16(""); + // printmessage16(""); } } @@ -7740,7 +7740,7 @@ static void Keys2d(void) showsectordata((int16_t)i); break; } - // printmessage16(""); + // printmessage16(""); } } @@ -7754,7 +7754,7 @@ static void Keys2d(void) asksave = 1; } - keystatus[KEYSC_E] = 0; + keystatus[KEYSC_E] = 0; } if (keystatus[KEYSC_SLASH]) // /? Reset panning&repeat to 0 @@ -7912,10 +7912,10 @@ static void Keys2d(void) if ( (wall[i].picnum==wall[curwall].picnum) &&((search_lotag==0)|| - (search_lotag!=0 && search_lotag==wall[i].lotag)) + (search_lotag!=0 && search_lotag==wall[i].lotag)) &&((search_hitag==0)|| - (search_hitag!=0 && search_hitag==wall[i].hitag)) - ) + (search_hitag!=0 && search_hitag==wall[i].hitag)) + ) { pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2); pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2); @@ -7940,12 +7940,12 @@ static void Keys2d(void) if ( (sprite[i].picnum==sprite[cursearchsprite].picnum && - sprite[i].statnum==0) + sprite[i].statnum==0) &&((search_lotag==0)|| - (search_lotag!=0 && search_lotag==sprite[i].lotag)) + (search_lotag!=0 && search_lotag==sprite[i].lotag)) &&((search_hitag==0)|| - (search_hitag!=0 && search_hitag==sprite[i].hitag)) - ) + (search_hitag!=0 && search_hitag==sprite[i].hitag)) + ) { pos.x=sprite[i].x; pos.y=sprite[i].y; @@ -7978,10 +7978,10 @@ static void Keys2d(void) if ( (wall[i].picnum==wall[curwall].picnum) &&((search_lotag==0)|| - (search_lotag!=0 && search_lotag==wall[i].lotag)) + (search_lotag!=0 && search_lotag==wall[i].lotag)) &&((search_hitag==0)|| - (search_hitag!=0 && search_hitag==wall[i].hitag)) - ) + (search_hitag!=0 && search_hitag==wall[i].hitag)) + ) { pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2); pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2); @@ -8003,12 +8003,12 @@ static void Keys2d(void) { if ( (sprite[i].picnum==sprite[cursearchsprite].picnum && - sprite[i].statnum==0) + sprite[i].statnum==0) &&((search_lotag==0)|| - (search_lotag!=0 && search_lotag==sprite[i].lotag)) + (search_lotag!=0 && search_lotag==sprite[i].lotag)) &&((search_hitag==0)|| - (search_hitag!=0 && search_hitag==sprite[i].hitag)) - ) + (search_hitag!=0 && search_hitag==sprite[i].hitag)) + ) { pos.x=sprite[i].x; pos.y=sprite[i].y; @@ -8308,18 +8308,18 @@ void ExtPreSaveMap(void) static void G_ShowParameterHelp(void) { char *s = "Usage: mapster32 [OPTIONS] [FILE]\n\n" - "-gFILE, -grp FILE\tUse extra group file FILE\n" - "-hFILE\t\tUse definitions file FILE\n" - "-jDIR, -game_dir DIR\n\t\tAdds DIR to the file path stack\n" - "-nocheck\t\tDisables map pointer checking when saving\n" + "-gFILE, -grp FILE\tUse extra group file FILE\n" + "-hFILE\t\tUse definitions file FILE\n" + "-jDIR, -game_dir DIR\n\t\tAdds DIR to the file path stack\n" + "-nocheck\t\tDisables map pointer checking when saving\n" #if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) - "-setup\t\tDisplays the configuration dialog\n" + "-setup\t\tDisplays the configuration dialog\n" #endif #if !defined(_WIN32) - "-usecwd\t\tRead game data and configuration file from working directory\n" + "-usecwd\t\tRead game data and configuration file from working directory\n" #endif - "\n-?, -help, --help\tDisplay this help message and exit" - ; + "\n-?, -help, --help\tDisplay this help message and exit" + ; wm_msgbox("Mapster32"VERSION BUILDDATE,s); } @@ -8697,9 +8697,9 @@ static int32_t osdcmd_fileinfo(const osdfuncparm_t *parm) kclose(i); OSD_Printf("fileinfo: %s\n" - " File size: %d\n" - " CRC-32: %08X\n", - parm->parms[0], length, crc); + " File size: %d\n" + " CRC-32: %08X\n", + parm->parms[0], length, crc); return OSDCMD_OK; } @@ -8746,9 +8746,9 @@ static int32_t osdcmd_testplay_addparam(const osdfuncparm_t *parm) if (parm->numparms != 1) { OSD_Printf("additional parameters for test playing: %s%s%s\n", - testplay_addparam ? "\"" : "", - testplay_addparam ? testplay_addparam : "", - testplay_addparam ? "\"" : ""); + testplay_addparam ? "\"" : "", + testplay_addparam ? testplay_addparam : "", + testplay_addparam ? "\"" : ""); return OSDCMD_OK; } @@ -8784,8 +8784,8 @@ static int32_t osdcmd_showheightindicators(const osdfuncparm_t *parm) showheightindicators = min(max(atoi(parm->parms[0]),0),2); OSD_Printf("height indicators: %s\n", - showheightindicators==0 ? "none" : - (showheightindicators==1 ? "two-sided walls only" : "all")); + showheightindicators==0 ? "none" : + (showheightindicators==1 ? "two-sided walls only" : "all")); return OSDCMD_OK; } @@ -8820,7 +8820,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm) else if (!Bstrcasecmp(parm->name, "pk_quickmapcycling")) { OSD_Printf("Quick map cycling ((LShift-)Ctrl-X): %s\n", - (quickmapcycling = !quickmapcycling) ? "enabled":"disabled"); + (quickmapcycling = !quickmapcycling) ? "enabled":"disabled"); } else if (!Bstrcasecmp(parm->name, "pk_uedaccel")) { @@ -9062,49 +9062,49 @@ int32_t parsegroupfiles(scriptfile *script) switch (tokn) { case T_LOADGRP: + { + char *fn; + + pathsearchmode = 1; + if (!scriptfile_getstring(script,&fn)) { - char *fn; + int32_t j = initgroupfile(fn); - pathsearchmode = 1; - if (!scriptfile_getstring(script,&fn)) + if (j == -1) + initprintf("Could not find group file '%s'.\n",fn); + else { - int32_t j = initgroupfile(fn); - - if (j == -1) - initprintf("Could not find group file '%s'.\n",fn); - else - { - initprintf("Using group file '%s'.\n",fn); - if (!NoAutoLoad) - DoAutoload(fn); - } - + initprintf("Using group file '%s'.\n",fn); + if (!NoAutoLoad) + DoAutoload(fn); } - pathsearchmode = 0; + } - break; + pathsearchmode = 0; + } + break; case T_INCLUDE: + { + char *fn; + if (!scriptfile_getstring(script,&fn)) { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included; + scriptfile *included; - included = scriptfile_fromfile(fn); - if (!included) - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - parsegroupfiles(included); - scriptfile_close(included); - } + included = scriptfile_fromfile(fn); + if (!included) + { + initprintf("Warning: Failed including %s on line %s:%d\n", + fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); + } + else + { + parsegroupfiles(included); + scriptfile_close(included); } - break; } break; + } + break; case T_NOAUTOLOAD: NoAutoLoad = 1; break; @@ -9155,248 +9155,248 @@ int32_t parsetilegroups(scriptfile *script) switch (tokn) { case T_HOTKEY: - { - int32_t i, j; - if (scriptfile_getsymbol(script,&i)) break; - if (scriptfile_getsymbol(script,&j)) break; - if (i < 0 || i > 9 || j < 0 || j >= MAXTILES) break; - prefixtiles[i] = j; - break; - } + { + int32_t i, j; + if (scriptfile_getsymbol(script,&i)) break; + if (scriptfile_getsymbol(script,&j)) break; + if (i < 0 || i > 9 || j < 0 || j >= MAXTILES) break; + prefixtiles[i] = j; + break; + } case T_INCLUDE: + { + char *fn; + if (!scriptfile_getstring(script,&fn)) { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included; + scriptfile *included; - included = scriptfile_fromfile(fn); - if (!included) - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - parsetilegroups(included); - scriptfile_close(included); - } + included = scriptfile_fromfile(fn); + if (!included) + { + initprintf("Warning: Failed including %s on line %s:%d\n", + fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); } - break; - } - case T_DEFINE: - { - char *name; - int32_t number; - - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getsymbol(script,&number)) break; - if (scriptfile_addsymbolvalue(name,number) < 0) - initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", - name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); - break; - } - case T_TILEGROUP: - { - char *end, *name; - int32_t i; - - if (tile_groups >= MAX_TILE_GROUPS) break; - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getbraces(script,&end)) break; - - s_TileGroups[tile_groups].pIds = Bcalloc(MAX_TILE_GROUP_ENTRIES,sizeof(int32_t)); - s_TileGroups[tile_groups].szText = Bstrdup(name); - - while (script->textptr < end) + else { - tokenlist tgtokens2[] = - { - { "tilegroup", T_TILEGROUP }, - { "tile", T_TILE }, - { "tilerange", T_TILERANGE }, - { "hotkey", T_HOTKEY }, - { "tiles", T_TILES }, - { "colors", T_COLORS }, - }; + parsetilegroups(included); + scriptfile_close(included); + } + } + break; + } + case T_DEFINE: + { + char *name; + int32_t number; - int32_t token = getatoken(script,tgtokens2,sizeof(tgtokens2)/sizeof(tokenlist)); - switch (token) + if (scriptfile_getstring(script,&name)) break; + if (scriptfile_getsymbol(script,&number)) break; + if (scriptfile_addsymbolvalue(name,number) < 0) + initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", + name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); + break; + } + case T_TILEGROUP: + { + char *end, *name; + int32_t i; + + if (tile_groups >= MAX_TILE_GROUPS) break; + if (scriptfile_getstring(script,&name)) break; + if (scriptfile_getbraces(script,&end)) break; + + s_TileGroups[tile_groups].pIds = Bcalloc(MAX_TILE_GROUP_ENTRIES,sizeof(int32_t)); + s_TileGroups[tile_groups].szText = Bstrdup(name); + + while (script->textptr < end) + { + tokenlist tgtokens2[] = + { + { "tilegroup", T_TILEGROUP }, + { "tile", T_TILE }, + { "tilerange", T_TILERANGE }, + { "hotkey", T_HOTKEY }, + { "tiles", T_TILES }, + { "colors", T_COLORS }, + }; + + int32_t token = getatoken(script,tgtokens2,sizeof(tgtokens2)/sizeof(tokenlist)); + switch (token) + { + case T_TILE: + { + if (scriptfile_getsymbol(script,&i)) break; + if (i >= 0 && i < MAXTILES && s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES) + s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i; + // OSD_Printf("added tile %d to group %d\n",i,g); + break; + } + case T_TILERANGE: + { + int32_t j; + if (scriptfile_getsymbol(script,&i)) break; + if (scriptfile_getsymbol(script,&j)) break; + if (i < 0 || i >= MAXTILES || j < 0 || j >= MAXTILES) break; + while (s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES && i <= j) { - case T_TILE: + s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i++; + // OSD_Printf("added tile %d to group %d\n",i,g); + } + break; + } + case T_COLORS: + { + int32_t j; + if (scriptfile_getsymbol(script, &i)) break; + if (scriptfile_getsymbol(script, &j)) break; + if (i < 0 || i >= 256 || j < 0 || j >= 256) break; + s_TileGroups[tile_groups].color1 = i; + s_TileGroups[tile_groups].color2 = j; + break; + } + case T_HOTKEY: + { + char *c; + if (scriptfile_getstring(script,&c)) break; + s_TileGroups[tile_groups].key1 = Btoupper(c[0]); + s_TileGroups[tile_groups].key2 = Btolower(c[0]); + break; + } + case T_TILES: + { + char *end2; + if (scriptfile_getbraces(script,&end2)) break; + while (script->textptr < end2-1) + { + if (!scriptfile_getsymbol(script,&i)) { - if (scriptfile_getsymbol(script,&i)) break; if (i >= 0 && i < MAXTILES && s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES) s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i; // OSD_Printf("added tile %d to group %d\n",i,g); - break; - } - case T_TILERANGE: - { - int32_t j; - if (scriptfile_getsymbol(script,&i)) break; - if (scriptfile_getsymbol(script,&j)) break; - if (i < 0 || i >= MAXTILES || j < 0 || j >= MAXTILES) break; - while (s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES && i <= j) - { - s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i++; - // OSD_Printf("added tile %d to group %d\n",i,g); - } - break; - } - case T_COLORS: - { - int32_t j; - if (scriptfile_getsymbol(script, &i)) break; - if (scriptfile_getsymbol(script, &j)) break; - if (i < 0 || i >= 256 || j < 0 || j >= 256) break; - s_TileGroups[tile_groups].color1 = i; - s_TileGroups[tile_groups].color2 = j; - break; - } - case T_HOTKEY: - { - char *c; - if (scriptfile_getstring(script,&c)) break; - s_TileGroups[tile_groups].key1 = Btoupper(c[0]); - s_TileGroups[tile_groups].key2 = Btolower(c[0]); - break; - } - case T_TILES: - { - char *end2; - if (scriptfile_getbraces(script,&end2)) break; - while (script->textptr < end2-1) - { - if (!scriptfile_getsymbol(script,&i)) - { - if (i >= 0 && i < MAXTILES && s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES) - s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i; - // OSD_Printf("added tile %d to group %d\n",i,g); - } - } - break; } } + break; + } } - s_TileGroups[tile_groups].pIds = Brealloc(s_TileGroups[tile_groups].pIds,s_TileGroups[tile_groups].nIds*sizeof(int32_t)); - tile_groups++; - break; } + s_TileGroups[tile_groups].pIds = Brealloc(s_TileGroups[tile_groups].pIds,s_TileGroups[tile_groups].nIds*sizeof(int32_t)); + tile_groups++; + break; + } case T_ALPHABET: + { + char *end; + int32_t i, j, k; + + if (numalphabets >= MAX_ALPHABETS) break; + if (scriptfile_getbraces(script,&end)) break; + + for (i=0; i= MAX_ALPHABETS) break; - if (scriptfile_getbraces(script,&end)) break; - - for (i=0; itextptr < end) - { - tokenlist alphtokens2[] = - { - { "map", T_MAP }, - { "mapa", T_MAPA }, - { "maprange", T_MAPRANGE }, - { "maprangea", T_MAPRANGEA }, - { "offset", T_OFFSET }, - { "offseta", T_OFFSETA }, - }; - - int32_t token = getatoken(script,alphtokens2,sizeof(alphtokens2)/sizeof(tokenlist)); - switch (token) - { - case T_MAP: // map , e.g. map 46 3002 - { - if (scriptfile_getnumber(script,&i)) break; - if (scriptfile_getsymbol(script,&j)) break; - - if (i>=33 && i<=126 && j>= 0 && j , e.g. map ".,!?" 3002 - { - char *s; - if (scriptfile_getstring(script,&s)) break; - if (scriptfile_getsymbol(script,&i)) break; - - for (; *s; s++, i++) - { - if (*s>=33 && *s<=126 && i>= 0 && i , e.g. map 33 126 STARTALPHANUM - // maprangea , e.g. map "!" "~" STARTALPHANUM - case T_MAPRANGE: - case T_MAPRANGEA: - { - if (token==T_MAPRANGE) - { - if (scriptfile_getnumber(script,&i)) break; - if (scriptfile_getnumber(script,&j)) break; - } - else - { - char *c1, *c2; - if (scriptfile_getstring(script,&c1)) break; - if (scriptfile_getstring(script,&c2)) break; - i=*c1; - j=*c2; - } - if (scriptfile_getsymbol(script,&k)) break; - - if (i>126 || j<33) break; - for (; i<=j && k=33 && i<=126) - alphabets[numalphabets].pic[i-33] = k; - } - break; - } - case T_OFFSET: // offset - { - if (scriptfile_getnumber(script, &i)) break; - if (scriptfile_getnumber(script, &j)) break; - if (scriptfile_getnumber(script, &k)) break; - - if (i >= 33 && i <= 126) - { - alphabets[numalphabets].xofs[i-33] = j; - alphabets[numalphabets].yofs[i-33] = k; - } - break; - } - case T_OFFSETA: // offseta - { - char *s; - if (scriptfile_getstring(script, &s)) break; - if (scriptfile_getnumber(script, &i)) break; - if (scriptfile_getnumber(script, &j)) break; - - for (; *s; s++) - if (*s >= 33 && *s <= 126) - { - alphabets[numalphabets].xofs[(*s)-33] = i; - alphabets[numalphabets].yofs[(*s)-33] = j; - } - break; - } - } - } - numalphabets++; - break; + alphabets[numalphabets].pic[i] = -1; + alphabets[numalphabets].xofs[i] = 0; + alphabets[numalphabets].yofs[i] = 0; } + + while (script->textptr < end) + { + tokenlist alphtokens2[] = + { + { "map", T_MAP }, + { "mapa", T_MAPA }, + { "maprange", T_MAPRANGE }, + { "maprangea", T_MAPRANGEA }, + { "offset", T_OFFSET }, + { "offseta", T_OFFSETA }, + }; + + int32_t token = getatoken(script,alphtokens2,sizeof(alphtokens2)/sizeof(tokenlist)); + switch (token) + { + case T_MAP: // map , e.g. map 46 3002 + { + if (scriptfile_getnumber(script,&i)) break; + if (scriptfile_getsymbol(script,&j)) break; + + if (i>=33 && i<=126 && j>= 0 && j , e.g. map ".,!?" 3002 + { + char *s; + if (scriptfile_getstring(script,&s)) break; + if (scriptfile_getsymbol(script,&i)) break; + + for (; *s; s++, i++) + { + if (*s>=33 && *s<=126 && i>= 0 && i , e.g. map 33 126 STARTALPHANUM + // maprangea , e.g. map "!" "~" STARTALPHANUM + case T_MAPRANGE: + case T_MAPRANGEA: + { + if (token==T_MAPRANGE) + { + if (scriptfile_getnumber(script,&i)) break; + if (scriptfile_getnumber(script,&j)) break; + } + else + { + char *c1, *c2; + if (scriptfile_getstring(script,&c1)) break; + if (scriptfile_getstring(script,&c2)) break; + i=*c1; + j=*c2; + } + if (scriptfile_getsymbol(script,&k)) break; + + if (i>126 || j<33) break; + for (; i<=j && k=33 && i<=126) + alphabets[numalphabets].pic[i-33] = k; + } + break; + } + case T_OFFSET: // offset + { + if (scriptfile_getnumber(script, &i)) break; + if (scriptfile_getnumber(script, &j)) break; + if (scriptfile_getnumber(script, &k)) break; + + if (i >= 33 && i <= 126) + { + alphabets[numalphabets].xofs[i-33] = j; + alphabets[numalphabets].yofs[i-33] = k; + } + break; + } + case T_OFFSETA: // offseta + { + char *s; + if (scriptfile_getstring(script, &s)) break; + if (scriptfile_getnumber(script, &i)) break; + if (scriptfile_getnumber(script, &j)) break; + + for (; *s; s++) + if (*s >= 33 && *s <= 126) + { + alphabets[numalphabets].xofs[(*s)-33] = i; + alphabets[numalphabets].yofs[(*s)-33] = j; + } + break; + } + } + } + numalphabets++; + break; + } case T_EOF: return(0); default: @@ -9471,113 +9471,113 @@ int32_t parseconsounds(scriptfile *script) switch (tokn) { case T_INCLUDE: + { + char *fn; + if (!scriptfile_getstring(script,&fn)) { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included; + scriptfile *included; - included = scriptfile_fromfile(fn); - if (!included) - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - int32_t tmp = parseconsounds(included); - scriptfile_close(included); - if (tmp < 0) return tmp; - } + included = scriptfile_fromfile(fn); + if (!included) + { + initprintf("Warning: Failed including %s on line %s:%d\n", + fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); + } + else + { + int32_t tmp = parseconsounds(included); + scriptfile_close(included); + if (tmp < 0) return tmp; } - break; } + break; + } case T_DEFINE: - { - char *name; - int32_t number; + { + char *name; + int32_t number; - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getsymbol(script,&number)) break; - if (scriptfile_addsymbolvalue(name,number) < 0) - initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", - name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); - break; - } + if (scriptfile_getstring(script,&name)) break; + if (scriptfile_getsymbol(script,&number)) break; + if (scriptfile_addsymbolvalue(name,number) < 0) + initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", + name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); + break; + } case T_DEFINESOUND: + { + char *definedname, *filename; + int32_t sndnum, ps, pe, pr, m, vo; + int32_t slen; + + if (scriptfile_getsymbol(script, &sndnum)) break; + + definedname = Bstrdup(script->ltextptr); + if (!definedname) return -1; + + if (sndnum < 0 || sndnum >= MAXSOUNDS) { - char *definedname, *filename; - int32_t sndnum, ps, pe, pr, m, vo; - int32_t slen; - - if (scriptfile_getsymbol(script, &sndnum)) break; - - definedname = Bstrdup(script->ltextptr); - if (!definedname) return -1; - - if (sndnum < 0 || sndnum >= MAXSOUNDS) - { - initprintf("Warning: invalid sound definition %s (sound number < 0 or >= MAXSOUNDS) on line %s:%d\n", - definedname, script->filename,scriptfile_getlinum(script,cmdtokptr)); - num_invalidsounds++; - break; - } - - if (scriptfile_getstring(script, &filename)) - { - Bfree(definedname); - num_invalidsounds++; - break; - } - - slen = strlen(filename); - if (slen >= BMAX_PATH) - { - initprintf("Warning: invalid sound definition %s (filename too long) on line %s:%d\n", - definedname, script->filename,scriptfile_getlinum(script,cmdtokptr)); - Bfree(definedname); - num_invalidsounds++; - break; - } - - if (g_sounds[sndnum].filename == NULL) - g_sounds[sndnum].filename = Bcalloc(slen+1,sizeof(uint8_t)); - // Hopefully noone does memcpy(..., g_sounds[].filename, BMAX_PATH) - if (!g_sounds[sndnum].filename) - { - Bfree(definedname); - return -1; - } - Bmemcpy(g_sounds[sndnum].filename, filename, slen+1); - - if (scriptfile_getnumber(script, &ps)) goto BAD; - if (scriptfile_getnumber(script, &pe)) goto BAD; - if (scriptfile_getnumber(script, &pr)) goto BAD; - if (scriptfile_getnumber(script, &m)) goto BAD; - if (ParentalLock && (m&8)) goto BAD; - if (scriptfile_getnumber(script, &vo)) goto BAD; - if (0) - { -BAD: - Bfree(definedname); - Bfree(g_sounds[sndnum].filename); - g_sounds[sndnum].filename = NULL; - num_invalidsounds++; - break; - } - - g_sounds[sndnum].definedname = definedname; // we want to keep it for display purposes - g_sounds[sndnum].ps = ps; - g_sounds[sndnum].pe = pe; - g_sounds[sndnum].pr = pr; - g_sounds[sndnum].m = m; - g_sounds[sndnum].vo = vo; - g_sndnum[g_numsounds] = g_definedsndnum[g_numsounds] = sndnum; - g_numsounds++; - if (g_numsounds == MAXSOUNDS) - goto END; + initprintf("Warning: invalid sound definition %s (sound number < 0 or >= MAXSOUNDS) on line %s:%d\n", + definedname, script->filename,scriptfile_getlinum(script,cmdtokptr)); + num_invalidsounds++; break; } + + if (scriptfile_getstring(script, &filename)) + { + Bfree(definedname); + num_invalidsounds++; + break; + } + + slen = strlen(filename); + if (slen >= BMAX_PATH) + { + initprintf("Warning: invalid sound definition %s (filename too long) on line %s:%d\n", + definedname, script->filename,scriptfile_getlinum(script,cmdtokptr)); + Bfree(definedname); + num_invalidsounds++; + break; + } + + if (g_sounds[sndnum].filename == NULL) + g_sounds[sndnum].filename = Bcalloc(slen+1,sizeof(uint8_t)); + // Hopefully noone does memcpy(..., g_sounds[].filename, BMAX_PATH) + if (!g_sounds[sndnum].filename) + { + Bfree(definedname); + return -1; + } + Bmemcpy(g_sounds[sndnum].filename, filename, slen+1); + + if (scriptfile_getnumber(script, &ps)) goto BAD; + if (scriptfile_getnumber(script, &pe)) goto BAD; + if (scriptfile_getnumber(script, &pr)) goto BAD; + if (scriptfile_getnumber(script, &m)) goto BAD; + if (ParentalLock && (m&8)) goto BAD; + if (scriptfile_getnumber(script, &vo)) goto BAD; + if (0) + { +BAD: + Bfree(definedname); + Bfree(g_sounds[sndnum].filename); + g_sounds[sndnum].filename = NULL; + num_invalidsounds++; + break; + } + + g_sounds[sndnum].definedname = definedname; // we want to keep it for display purposes + g_sounds[sndnum].ps = ps; + g_sounds[sndnum].pe = pe; + g_sounds[sndnum].pr = pr; + g_sounds[sndnum].m = m; + g_sounds[sndnum].vo = vo; + g_sndnum[g_numsounds] = g_definedsndnum[g_numsounds] = sndnum; + g_numsounds++; + if (g_numsounds == MAXSOUNDS) + goto END; + break; + } case T_EOF: goto END; default: @@ -9677,13 +9677,13 @@ int32_t ExtInit(void) { Bsnprintf(cwd,sizeof(cwd),"%s/" #if defined(_WIN32) - "EDuke32 Settings" + "EDuke32 Settings" #elif defined(__APPLE__) - "Library/Application Support/EDuke32" + "Library/Application Support/EDuke32" #else - ".eduke32" + ".eduke32" #endif - ,homedir); + ,homedir); asperr = addsearchpath(cwd); if (asperr == -2) { @@ -9762,8 +9762,8 @@ int32_t ExtInit(void) int32_t i; #if 0 i=wm_ynbox("Texture Cache", - "Would you like to enable the on-disk texture cache?\n\n" - "You generally want to say 'yes' here, especially if using the HRP."); + "Would you like to enable the on-disk texture cache?\n\n" + "You generally want to say 'yes' here, especially if using the HRP."); #else i = 1; #endif @@ -9808,7 +9808,7 @@ int32_t ExtInit(void) GAME_clearbackground, (int32_t(*)(void))GetTime, NULL - ); + ); #endif OSD_SetParameters(0,2, 0,0, 4,0); @@ -10015,39 +10015,39 @@ void ExtPreCheckKeys(void) // just before drawrooms case LIZMANFEEDING : case LIZMANJUMP : + { + int32_t k; + if (frames!=0) { - int32_t k; - if (frames!=0) + if (frames==10) frames=0; + k = 1536;//getangle(tspr->x-pos.x,tspr->y-pos.y); + k = (((sprite[i].ang+3072+128-k)&2047)>>8)&7; + //This guy has only 5 pictures for 8 angles (3 are x-flipped) + if (k <= 4) { - if (frames==10) frames=0; - k = 1536;//getangle(tspr->x-pos.x,tspr->y-pos.y); - k = (((sprite[i].ang+3072+128-k)&2047)>>8)&7; - //This guy has only 5 pictures for 8 angles (3 are x-flipped) - if (k <= 4) - { - picnum += k; - ang = 0; - flags &= ~4; - } - else - { - picnum += 8-k; - ang = 1024; - flags |= 4; - } + picnum += k; + ang = 0; + flags &= ~4; } - - if (graphicsmode == 2) + else { - if (frames==2) picnum+=((((4-(totalclock>>5)))&1)*5); - if (frames==4) picnum+=((((4-(totalclock>>5)))&3)*5); - if (frames==5) picnum+=(((totalclock>>5)%5))*5; + picnum += 8-k; + ang = 1024; + flags |= 4; } - - if (tilesizx[picnum] == 0) - picnum -= 5; //Hack, for actors } - break; + + if (graphicsmode == 2) + { + if (frames==2) picnum+=((((4-(totalclock>>5)))&1)*5); + if (frames==4) picnum+=((((4-(totalclock>>5)))&3)*5); + if (frames==5) picnum+=(((totalclock>>5)%5))*5; + } + + if (tilesizx[picnum] == 0) + picnum -= 5; //Hack, for actors + } + break; default: break; @@ -10070,7 +10070,7 @@ void ExtPreCheckKeys(void) // just before drawrooms if (xp1 < 4 || xp1 > xdim-6 || yp1 < 4 || yp1 > ydim16-6) continue; rotatesprite(xp1<<16,yp1<<16,zoom<<5,ang,picnum, - shade,sprite[i].pal,flags,0,0,xdim-1,ydim16-1); + shade,sprite[i].pal,flags,0,0,xdim-1,ydim16-1); } } @@ -10091,7 +10091,7 @@ void ExtPreCheckKeys(void) // just before drawrooms // drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, col); } - enddrawing(); + enddrawing(); } void ExtAnalyzeSprites(void) @@ -10191,10 +10191,10 @@ void ExtAnalyzeSprites(void) if (nosprites==1||nosprites==3) switch (tspr->picnum) - { + { case SEENINE : tspr->xrepeat=0; - } + } if (shadepreview && !(tspr->cstat & 16)) { @@ -10448,7 +10448,7 @@ static void Keys2d3d(void) NULL, (int32_t(*)(void))GetTime, NULL - ); + ); } else { @@ -10462,7 +10462,7 @@ static void Keys2d3d(void) GAME_clearbackground, (int32_t(*)(void))GetTime, NULL - ); + ); } #endif } @@ -11223,27 +11223,27 @@ static void EditSpriteData(int16_t spritenum) switch (col) { case 1: - { - printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col = 0; - xpos = 8; - rowmax = 4; - dispwidth = 23; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + col = 0; + xpos = 8; + rowmax = 4; + dispwidth = 23; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; case 2: - { - printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col = 1; - xpos = 208; - rowmax = 5; - dispwidth = 24; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + col = 1; + xpos = 208; + rowmax = 5; + dispwidth = 24; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; } keystatus[KEYSC_LEFT] = 0; } @@ -11252,27 +11252,27 @@ static void EditSpriteData(int16_t spritenum) switch (col) { case 0: - { - printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col = 1; - xpos = 208; - rowmax = 5; - dispwidth = 24; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + col = 1; + xpos = 208; + rowmax = 5; + dispwidth = 24; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; case 1: - { - printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col = 2; - xpos = 408; - rowmax = 6; - dispwidth = 26; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + col = 2; + xpos = 408; + rowmax = 6; + dispwidth = 26; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; } keystatus[KEYSC_RIGHT] = 0; } @@ -11284,234 +11284,234 @@ static void EditSpriteData(int16_t spritenum) switch (col) { case 0: + { + switch (row) { - switch (row) + case 0: + { + for (i=Bsprintf(disptext,"X-coordinate: %d",sprite[spritenum].x); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d X-coordinate: ",spritenum); + if (editval) { - case 0: - { - for (i=Bsprintf(disptext,"X-coordinate: %d",sprite[spritenum].x); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d X-coordinate: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1); - } - } - break; - case 1: - { - for (i=Bsprintf(disptext,"Y-coordinate: %d",sprite[spritenum].y); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Y-coordinate: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1); - } - } - break; - case 2: - { - for (i=Bsprintf(disptext,"Z-coordinate: %d",sprite[spritenum].z); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Z-coordinate: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L - } - } - break; - case 3: - { - for (i=Bsprintf(disptext,"Sectnum: %d",sprite[spritenum].sectnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Sectnum: ",spritenum); - if (editval) - { - printmessage16(edittext); - i = getnumber16(edittext,sprite[spritenum].sectnum,MAXSECTORS-1,0); - if (i != sprite[spritenum].sectnum) - changespritesect(spritenum,i); - } - } - break; - case 4: - { - for (i=Bsprintf(disptext,"Statnum: %d",sprite[spritenum].statnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Statnum: ",spritenum); - if (editval) - { - printmessage16(edittext); - i = getnumber16(edittext,sprite[spritenum].statnum,MAXSTATUS-1,0); - if (i != sprite[spritenum].statnum) - changespritestat(spritenum,i); - } - } - break; + printmessage16(edittext); + sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1); } } break; + case 1: + { + for (i=Bsprintf(disptext,"Y-coordinate: %d",sprite[spritenum].y); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Y-coordinate: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1); + } + } + break; + case 2: + { + for (i=Bsprintf(disptext,"Z-coordinate: %d",sprite[spritenum].z); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Z-coordinate: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L + } + } + break; + case 3: + { + for (i=Bsprintf(disptext,"Sectnum: %d",sprite[spritenum].sectnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Sectnum: ",spritenum); + if (editval) + { + printmessage16(edittext); + i = getnumber16(edittext,sprite[spritenum].sectnum,MAXSECTORS-1,0); + if (i != sprite[spritenum].sectnum) + changespritesect(spritenum,i); + } + } + break; + case 4: + { + for (i=Bsprintf(disptext,"Statnum: %d",sprite[spritenum].statnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Statnum: ",spritenum); + if (editval) + { + printmessage16(edittext); + i = getnumber16(edittext,sprite[spritenum].statnum,MAXSTATUS-1,0); + if (i != sprite[spritenum].statnum) + changespritestat(spritenum,i); + } + } + break; + } + } + break; case 1: + { + switch (row) { - switch (row) + case 0: + { + for (i=Bsprintf(disptext,"Flags (hex): %x",sprite[spritenum].cstat); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Flags: ",spritenum); + if (editval) { - case 0: - { - for (i=Bsprintf(disptext,"Flags (hex): %x",sprite[spritenum].cstat); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Flags: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].cstat = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].cstat,65536L,0); - } - } - break; - case 1: - { - for (i=Bsprintf(disptext,"Shade: %d",sprite[spritenum].shade); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Shade: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].shade = (char)getnumber16(edittext,(int32_t)sprite[spritenum].shade,128,1); - } - } - break; - case 2: - { - for (i=Bsprintf(disptext,"Pal: %d",sprite[spritenum].pal); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Pal: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].pal = (char)getnumber16(edittext,(int32_t)sprite[spritenum].pal,MAXPALOOKUPS,0); - } - } - break; - case 3: - { - for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Sprite %d X Repeat: ",spritenum); - printmessage16(edittext); - sprite[spritenum].xrepeat = (char)getnumber16(edittext,(int32_t)sprite[spritenum].xrepeat,256L,0); - Bsprintf(edittext,"Sprite %d Y Repeat: ",spritenum); - printmessage16(edittext); - sprite[spritenum].yrepeat = (char)getnumber16(edittext,(int32_t)sprite[spritenum].yrepeat,256L,0); - } - } - break; - case 4: - { - for (i=Bsprintf(disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Sprite %d X Offset: ",spritenum); - printmessage16(edittext); - sprite[spritenum].xoffset = (char)getnumber16(edittext,(int32_t)sprite[spritenum].xoffset,128L,1); - Bsprintf(edittext,"Sprite %d Y Offset: ",spritenum); - printmessage16(edittext); - sprite[spritenum].yoffset = (char)getnumber16(edittext,(int32_t)sprite[spritenum].yoffset,128L,1); - } - } - break; - case 5: - { - for (i=Bsprintf(disptext,"Tile number: %d",sprite[spritenum].picnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Tile number: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].picnum = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].picnum,MAXTILES,0); - } - } - break; + printmessage16(edittext); + sprite[spritenum].cstat = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].cstat,65536L,0); } } break; + case 1: + { + for (i=Bsprintf(disptext,"Shade: %d",sprite[spritenum].shade); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Shade: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].shade = (char)getnumber16(edittext,(int32_t)sprite[spritenum].shade,128,1); + } + } + break; + case 2: + { + for (i=Bsprintf(disptext,"Pal: %d",sprite[spritenum].pal); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Pal: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].pal = (char)getnumber16(edittext,(int32_t)sprite[spritenum].pal,MAXPALOOKUPS,0); + } + } + break; + case 3: + { + for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Sprite %d X Repeat: ",spritenum); + printmessage16(edittext); + sprite[spritenum].xrepeat = (char)getnumber16(edittext,(int32_t)sprite[spritenum].xrepeat,256L,0); + Bsprintf(edittext,"Sprite %d Y Repeat: ",spritenum); + printmessage16(edittext); + sprite[spritenum].yrepeat = (char)getnumber16(edittext,(int32_t)sprite[spritenum].yrepeat,256L,0); + } + } + break; + case 4: + { + for (i=Bsprintf(disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Sprite %d X Offset: ",spritenum); + printmessage16(edittext); + sprite[spritenum].xoffset = (char)getnumber16(edittext,(int32_t)sprite[spritenum].xoffset,128L,1); + Bsprintf(edittext,"Sprite %d Y Offset: ",spritenum); + printmessage16(edittext); + sprite[spritenum].yoffset = (char)getnumber16(edittext,(int32_t)sprite[spritenum].yoffset,128L,1); + } + } + break; + case 5: + { + for (i=Bsprintf(disptext,"Tile number: %d",sprite[spritenum].picnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Tile number: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].picnum = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].picnum,MAXTILES,0); + } + } + break; + } + } + break; case 2: + { + switch (row) { - switch (row) + case 0: + { + for (i=Bsprintf(disptext,"Angle (2048 degrees): %d",sprite[spritenum].ang); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Angle: ",spritenum); + if (editval) { - case 0: - { - for (i=Bsprintf(disptext,"Angle (2048 degrees): %d",sprite[spritenum].ang); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Angle: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].ang = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].ang,2048L,0); - } - } - break; - case 1: - { - for (i=Bsprintf(disptext,"X-Velocity: %d",sprite[spritenum].xvel); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d X-Velocity: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].xvel = getnumber16(edittext,(int32_t)sprite[spritenum].xvel,65536,1); - } - } - break; - case 2: - { - for (i=Bsprintf(disptext,"Y-Velocity: %d",sprite[spritenum].yvel); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Y-Velocity: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].yvel = getnumber16(edittext,(int32_t)sprite[spritenum].yvel,65536,1); - } - } - break; - case 3: - { - for (i=Bsprintf(disptext,"Z-Velocity: %d",sprite[spritenum].zvel); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Z-Velocity: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].zvel = getnumber16(edittext,(int32_t)sprite[spritenum].zvel,65536,1); - } - } - break; - case 4: - { - for (i=Bsprintf(disptext,"Owner: %d",sprite[spritenum].owner); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Owner: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].owner = getnumber16(edittext,(int32_t)sprite[spritenum].owner,MAXSPRITES,0); - } - } - break; - case 5: - { - for (i=Bsprintf(disptext,"Clipdist: %d",sprite[spritenum].clipdist); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Clipdist: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].clipdist = (char)getnumber16(edittext,(int32_t)sprite[spritenum].clipdist,256,0); - } - } - break; - case 6: - { - for (i=Bsprintf(disptext,"Extra: %d",sprite[spritenum].extra); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite %d Extra: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].extra = getnumber16(edittext,(int32_t)sprite[spritenum].extra,65536,1); - } - } - break; + printmessage16(edittext); + sprite[spritenum].ang = (int16_t)getnumber16(edittext,(int32_t)sprite[spritenum].ang,2048L,0); } } break; + case 1: + { + for (i=Bsprintf(disptext,"X-Velocity: %d",sprite[spritenum].xvel); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d X-Velocity: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].xvel = getnumber16(edittext,(int32_t)sprite[spritenum].xvel,65536,1); + } + } + break; + case 2: + { + for (i=Bsprintf(disptext,"Y-Velocity: %d",sprite[spritenum].yvel); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Y-Velocity: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].yvel = getnumber16(edittext,(int32_t)sprite[spritenum].yvel,65536,1); + } + } + break; + case 3: + { + for (i=Bsprintf(disptext,"Z-Velocity: %d",sprite[spritenum].zvel); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Z-Velocity: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].zvel = getnumber16(edittext,(int32_t)sprite[spritenum].zvel,65536,1); + } + } + break; + case 4: + { + for (i=Bsprintf(disptext,"Owner: %d",sprite[spritenum].owner); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Owner: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].owner = getnumber16(edittext,(int32_t)sprite[spritenum].owner,MAXSPRITES,0); + } + } + break; + case 5: + { + for (i=Bsprintf(disptext,"Clipdist: %d",sprite[spritenum].clipdist); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Clipdist: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].clipdist = (char)getnumber16(edittext,(int32_t)sprite[spritenum].clipdist,256,0); + } + } + break; + case 6: + { + for (i=Bsprintf(disptext,"Extra: %d",sprite[spritenum].extra); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite %d Extra: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].extra = getnumber16(edittext,(int32_t)sprite[spritenum].extra,65536,1); + } + } + break; + } + } + break; } printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[1],disptext,0); @@ -11600,110 +11600,110 @@ static void GenSearchSprite() printext16(xpos[i], ypos+j*8, editorcolors[11], editorcolors[0], disptext, 0); } - for (k=0; k<80; k++) disptext[k] = 0; + for (k=0; k<80; k++) disptext[k] = 0; - // disptext[dispwidth[col]] = 0; - // showspritedata(spritenum); - wallsprite = 2; + // disptext[dispwidth[col]] = 0; + // showspritedata(spritenum); + wallsprite = 2; - while (keystatus[KEYSC_ESC] == 0) + while (keystatus[KEYSC_ESC] == 0) + { + begindrawing(); + if (handleevents()) { - begindrawing(); - if (handleevents()) - { - if (quitevent) quitevent = 0; - } - idle(); - printmessage16("Sprite search, press to exit"); - - if (keystatus[KEYSC_DOWN]) - { - keystatus[KEYSC_DOWN] = 0; - if (row < rowmax[col]) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - row++; - } - } - if (keystatus[KEYSC_UP]) - { - keystatus[KEYSC_UP] = 0; - if (row > 0) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - row--; - } - } - if (keystatus[KEYSC_LEFT]) - { - keystatus[KEYSC_LEFT] = 0; - if (col > 0) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col--; - disptext[dispwidth[col]] = 0; - if (row > rowmax[col]) row = rowmax[col]; - } - } - if (keystatus[KEYSC_RIGHT]) - { - keystatus[KEYSC_RIGHT] = 0; - if (col < 2) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col++; - disptext[dispwidth[col]] = 0; - if (row > rowmax[col]) row = rowmax[col]; - } - } - if (keystatus[KEYSC_ENTER]) - { - keystatus[KEYSC_ENTER] = 0; - Bsprintf(edittext, "%s: ", labels[row][col]); - enddrawing(); - printmessage16(edittext); - i = getnumber16(edittext, gs_spritewhat[col][row] ? gs_sprite[col][row] : 0, - maxval[row][col], sign[row][col]); - if (col == 2 && row == 0) i = (i+2048)&2047; // angle - gs_sprite[col][row] = i; - begindrawing(); - gs_spritewhat[col][row] = 1; - - if (col == 1 && row == 5) // picnum - printext16(xpos[1], ypos-2*8, editorcolors[14], editorcolors[0], names[i], 0); - } - if (keystatus[KEYSC_BS] || keystatus[KEYSC_DELETE]) - { - keystatus[KEYSC_BS] = keystatus[KEYSC_DELETE] = 0; - gs_spritewhat[col][row] = 0; - - if (col == 1 && row == 5) // picnum - printext16(xpos[1], ypos-2*8, editorcolors[14], editorcolors[0], " ", 0); - } - - if (gs_spritewhat[col][row]) - { - if (col == 1 && row == 0) // flags - k = Bsprintf(disptext, "%s: %x", labels[row][col], gs_sprite[col][row]); - else - k = Bsprintf(disptext, "%s: %d", labels[row][col], gs_sprite[col][row]); - } - else - k = Bsprintf(disptext, "%s: ^7any", labels[row][col]); - for (; k to exit"); + + if (keystatus[KEYSC_DOWN]) + { + keystatus[KEYSC_DOWN] = 0; + if (row < rowmax[col]) + { + printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + row++; + } + } + if (keystatus[KEYSC_UP]) + { + keystatus[KEYSC_UP] = 0; + if (row > 0) + { + printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + row--; + } + } + if (keystatus[KEYSC_LEFT]) + { + keystatus[KEYSC_LEFT] = 0; + if (col > 0) + { + printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + col--; + disptext[dispwidth[col]] = 0; + if (row > rowmax[col]) row = rowmax[col]; + } + } + if (keystatus[KEYSC_RIGHT]) + { + keystatus[KEYSC_RIGHT] = 0; + if (col < 2) + { + printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); + col++; + disptext[dispwidth[col]] = 0; + if (row > rowmax[col]) row = rowmax[col]; + } + } + if (keystatus[KEYSC_ENTER]) + { + keystatus[KEYSC_ENTER] = 0; + Bsprintf(edittext, "%s: ", labels[row][col]); + enddrawing(); + printmessage16(edittext); + i = getnumber16(edittext, gs_spritewhat[col][row] ? gs_sprite[col][row] : 0, + maxval[row][col], sign[row][col]); + if (col == 2 && row == 0) i = (i+2048)&2047; // angle + gs_sprite[col][row] = i; + begindrawing(); + gs_spritewhat[col][row] = 1; + + if (col == 1 && row == 5) // picnum + printext16(xpos[1], ypos-2*8, editorcolors[14], editorcolors[0], names[i], 0); + } + if (keystatus[KEYSC_BS] || keystatus[KEYSC_DELETE]) + { + keystatus[KEYSC_BS] = keystatus[KEYSC_DELETE] = 0; + gs_spritewhat[col][row] = 0; + + if (col == 1 && row == 5) // picnum + printext16(xpos[1], ypos-2*8, editorcolors[14], editorcolors[0], " ", 0); + } + + if (gs_spritewhat[col][row]) + { + if (col == 1 && row == 0) // flags + k = Bsprintf(disptext, "%s: %x", labels[row][col], gs_sprite[col][row]); + else + k = Bsprintf(disptext, "%s: %d", labels[row][col], gs_sprite[col][row]); + } + else + k = Bsprintf(disptext, "%s: ^7any", labels[row][col]); + for (; k= 0) + { + int32_t k = 0; + for (j=0; j= 0) - { - int32_t k = 0; - for (j=0; j= 0) - { - sprite[w].x = (int32_t)(sprite[w].x*size); - sprite[w].y = (int32_t)(sprite[w].y*size); - sprite[w].z = (int32_t)(sprite[w].z*size); - sprite[w].xrepeat = min(max((int32_t)(sprite[w].xrepeat*size),1),255); - sprite[w].yrepeat = min(max((int32_t)(sprite[w].yrepeat*size),1),255); - w = nextspritesect[w]; - } + wall[w].x = (int32_t)(wall[w].x*size); + wall[w].y = (int32_t)(wall[w].y*size); + wall[w].yrepeat = min((int32_t)(wall[w].yrepeat/size),255); + } + w = headspritesect[highlightsector[i]]; + while (w >= 0) + { + sprite[w].x = (int32_t)(sprite[w].x*size); + sprite[w].y = (int32_t)(sprite[w].y*size); + sprite[w].z = (int32_t)(sprite[w].z*size); + sprite[w].xrepeat = min(max((int32_t)(sprite[w].xrepeat*size),1),255); + sprite[w].yrepeat = min(max((int32_t)(sprite[w].yrepeat*size),1),255); + w = nextspritesect[w]; } - printmessage16("Map scaled"); } - else printmessage16("Aborted"); + printmessage16("Map scaled"); } + else printmessage16("Aborted"); } - break; + } + break; case 6: + { + for (i=Bsprintf(disptext,"%s",FuncMenuStrings[row]); i < dispwidth; i++) disptext[i] = ' '; + if (editval) { - for (i=Bsprintf(disptext,"%s",FuncMenuStrings[row]); i < dispwidth; i++) disptext[i] = ' '; - if (editval) + j=getnumber16("Shade divisor: ",1,128,1); + if (j!=1) { - j=getnumber16("Shade divisor: ",1,128,1); - if (j!=1) + for (i=0; i>4)/j; - } - printmessage16("Visibility adjusted"); + if (sector[i].visibility < 240) + sector[i].visibility /= j; + else sector[i].visibility = 240 + (sector[i].visibility>>4)/j; } - else printmessage16("Aborted"); + printmessage16("Visibility adjusted"); } + else printmessage16("Aborted"); } - break; + } + break; } break; } diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 7d8b307d1..9f9885993 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -4117,190 +4117,167 @@ void G_DrawBackground(void) pus = pub = NUMPAGES; } -#define SE40 - -#ifdef SE40 -// Floor Over Floor - -// If standing in sector with SE42 or SE44 -// then draw viewing to SE41 and raise all =hi SE43 cielings. - -// If standing in sector with SE43 or SE45 -// then draw viewing to SE40 and lower all =hi SE42 floors. - -static void SE40_Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int32_t a,int32_t h,int32_t smoothratio) -{ - static int32_t tempsectorz[MAXSECTORS]; - static int32_t tempsectorpicnum[MAXSECTORS]; - - int32_t i=0,j=0,k=0; - int32_t floor1=0,floor2=0,ok=0,fofmode=0,draw_both=0; - int32_t offx,offy,offz; - - if (sprite[spnum].ang!=512) return; - - // Things are a little different now, as we allow for masked transparent - // floors and ceilings. So the FOF textures is no longer required - // Additionally names.h also defines FOF as 13 which isn't useful for us - // so we'll use 562 instead - tilesizx[562] = 0; - tilesizy[562] = 0; - - floor1=spnum; - - if (sprite[spnum].lotag==42) fofmode=40; - if (sprite[spnum].lotag==43) fofmode=41; - if (sprite[spnum].lotag==44) fofmode=40; - if (sprite[spnum].lotag==45) fofmode=41; - - // fofmode=sprite[spnum].lotag-2; - - // sectnum=sprite[j].sectnum; - // sectnum=cursectnum; - ok++; - - /* recursive? - Not at the moment - for(j=0;j=0; j=nextspritestat[j]) - { - if (sprite[j].picnum==1 && sprite[j].lotag==fofmode && sprite[j].hitag==sprite[floor1].hitag) - { - floor1=j; - fofmode=sprite[j].lotag; - ok++; - break; - } - } - // if(ok==1) { Message("no floor1",RED); return; } - - if (fofmode==40) k=41; - else k=40; - - for (j=headspritestat[15]; j>=0; j=nextspritestat[j]) - { - if (sprite[j].picnum==1 && sprite[j].lotag==k && sprite[j].hitag==sprite[floor1].hitag) - { - floor2=j; - ok++; - break; - } - } - - i=floor1; - offx=sprite[floor2].x-sprite[floor1].x; - offy=sprite[floor2].y-sprite[floor1].y; - offz=0; - - if (sprite[floor2].ang >= 1024) - offz = sprite[floor2].z; - else if (fofmode==41) - offz = sector[sprite[floor2].sectnum].floorz; - else - offz = sector[sprite[floor2].sectnum].ceilingz; - - if (sprite[floor1].ang >= 1024) - offz -= sprite[floor1].z; - else if (fofmode==40) - offz -= sector[sprite[floor1].sectnum].floorz; - else - offz -= sector[sprite[floor1].sectnum].ceilingz; - - // if(ok==2) { Message("no floor2",RED); return; } - - for (j=headspritestat[15]; j>=0; j=nextspritestat[j]) // raise ceiling or floor - { - if (sprite[j].picnum==1 && sprite[j].lotag==k+2 && sprite[j].hitag==sprite[floor1].hitag) - { - if (k==40) - { - tempsectorz[sprite[j].sectnum]=sector[sprite[j].sectnum].floorz; - sector[sprite[j].sectnum].floorz+=(((z-sector[sprite[j].sectnum].floorz)/32768)+1)*32768; - tempsectorpicnum[sprite[j].sectnum]=sector[sprite[j].sectnum].floorpicnum; - sector[sprite[j].sectnum].floorpicnum=562; - } - else - { - tempsectorz[sprite[j].sectnum]=sector[sprite[j].sectnum].ceilingz; - sector[sprite[j].sectnum].ceilingz+=(((z-sector[sprite[j].sectnum].ceilingz)/32768)-1)*32768; - tempsectorpicnum[sprite[j].sectnum]=sector[sprite[j].sectnum].ceilingpicnum; - sector[sprite[j].sectnum].ceilingpicnum=562; - } - draw_both = 1; - } - } - - drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum); - G_DoSpriteAnimations(x,y,a,smoothratio); - drawmasks(); - - if (draw_both) - { - for (j=headspritestat[15]; j>=0; j=nextspritestat[j]) // restore ceiling or floor for the draw both sectors - { - if (sprite[j].picnum==1 && - sprite[j].lotag==k+2 && - sprite[j].hitag==sprite[floor1].hitag) - { - if (k==40) - { - sector[sprite[j].sectnum].floorz=tempsectorz[sprite[j].sectnum]; - sector[sprite[j].sectnum].floorpicnum=tempsectorpicnum[sprite[j].sectnum]; - } - else - { - sector[sprite[j].sectnum].ceilingz=tempsectorz[sprite[j].sectnum]; - sector[sprite[j].sectnum].ceilingpicnum=tempsectorpicnum[sprite[j].sectnum]; - } - }// end if - }// end for - - // Now re-draw - drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum); - G_DoSpriteAnimations(x,y,a,smoothratio); - drawmasks(); - } -} // end SE40 - -void se40code(int32_t x,int32_t y,int32_t z,int32_t a,int32_t h, int32_t smoothratio) -{ - int32_t i= headspritestat[15]; - - while (i >= 0) - { - int32_t t = sprite[i].lotag; - switch (t) - { - // case 40: - // case 41: - // SE40_Draw(i,x,y,a,smoothratio); - // break; - case 42: - case 43: - case 44: - case 45: - if (g_player[screenpeek].ps->cursectnum == sprite[i].sectnum) - SE40_Draw(i,x,y,z,a,h,smoothratio); - break; - } - i = nextspritestat[i]; - } -} -#endif /* SE40 */ +static int32_t ror_sprite = -1; static int32_t oyrepeat=-1; extern float r_ambientlight; +char ror_protectedsectors[MAXSECTORS]; +int32_t drawing_ror = 0; + +void G_SE40(int32_t smoothratio) +{ + if (getrendermode() != 4 && ror_sprite != -1) + { + int32_t x, y, z; + int16_t sect; + int32_t level = 0; + spritetype *sp = &sprite[ror_sprite]; + int32_t sprite2 = sp->yvel; + + if (klabs(sector[sp->sectnum].floorz - sp->z) < klabs(sector[sprite[sprite2].sectnum].floorz - sprite[sprite2].z)) + level = 1; + + x = ud.camerax - sp->x; + y = ud.cameray - sp->y; + z = ud.cameraz - (level ? sector[sp->sectnum].floorz : sector[sp->sectnum].ceilingz); + + sect = sprite[sprite2].sectnum; + updatesector(sprite[sprite2].x + x, sprite[sprite2].y + y, §); + + if (sect != -1) + { + int32_t renderz, picnum; + int16_t backupstat[numsectors]; + int32_t backupz[numsectors]; + int32_t i; + int32_t pix_diff, newz; + // initprintf("drawing ror\n"); + + if (level) + { + // renderz = sector[sprite[sprite2].sectnum].ceilingz; + renderz = sprite[sprite2].z - (sprite[sprite2].yrepeat * tilesizy[sprite[sprite2].picnum]<<1); + picnum = sector[sprite[sprite2].sectnum].ceilingpicnum; + sector[sprite[sprite2].sectnum].ceilingpicnum = 562; + tilesizx[562] = tilesizy[562] = 0; + + pix_diff = klabs(z) >> 8; + newz = - ((pix_diff / 128) + 1) * (128<<8); + + for (i = 0; i < numsectors; i++) + { + backupstat[i] = sector[i].ceilingstat; + backupz[i] = sector[i].ceilingz; + if (!ror_protectedsectors[i] || (ror_protectedsectors[i] && sp->lotag == 41)) + { + sector[i].ceilingstat = 1; + sector[i].ceilingz += newz; + } + } + } + else + { + // renderz = sector[sprite[sprite2].sectnum].floorz; + renderz = sprite[sprite2].z; + picnum = sector[sprite[sprite2].sectnum].floorpicnum; + sector[sprite[sprite2].sectnum].floorpicnum = 562; + tilesizx[562] = tilesizy[562] = 0; + + pix_diff = klabs(z) >> 8; + newz = ((pix_diff / 128) + 1) * (128<<8); + + for (i = 0; i < numsectors; i++) + { + backupstat[i] = sector[i].floorstat; + backupz[i] = sector[i].floorz; + if (!ror_protectedsectors[i] || (ror_protectedsectors[i] && sp->lotag == 41)) + { + sector[i].floorstat = 1; + sector[i].floorz = +newz; + } + } + } + + drawrooms(sprite[sprite2].x + x, sprite[sprite2].y + y, + z + renderz, ud.cameraang, ud.camerahoriz, sect); + drawing_ror = 1 + level; + + // dupe the sprites touching the portal to the other sector + + if (drawing_ror == 2) // viewing from top + { + int32_t k = headspritesect[sp->sectnum]; + + while (k != -1) + { + if (sprite[k].picnum != SECTOREFFECTOR && (sprite[k].z >= sp->z)) + { + Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)&sprite[k],sizeof(spritetype)); + + tsprite[spritesortcnt].x += (sprite[sp->yvel].x-sp->x); + tsprite[spritesortcnt].y += (sprite[sp->yvel].y-sp->y); + tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sp->z + ActorExtra[sp->yvel].ceilingz; + tsprite[spritesortcnt].sectnum = sprite[sp->yvel].sectnum; + tsprite[spritesortcnt].owner = k; + + //OSD_Printf("duped sprite of pic %d at %d %d %d\n",tsprite[spritesortcnt].picnum,tsprite[spritesortcnt].x,tsprite[spritesortcnt].y,tsprite[spritesortcnt].z); + spritesortcnt++; + } + k = nextspritesect[k]; + } + } + /* + else // viewing from bottom + { + int32_t k = headspritesect[sprite[sp->yvel].sectnum]; + + while (k != -1) + { + if (sprite[k].picnum != SECTOREFFECTOR && (sprite[k].z >= sprite[sp->yvel].z)) + { + Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)&sprite[k],sizeof(spritetype)); + + tsprite[spritesortcnt].x -= (sprite[sp->yvel].x-sp->x); + tsprite[spritesortcnt].y -= (sprite[sp->yvel].y-sp->y); + tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sprite[sp->yvel].z + ActorExtra[ror_sprite].ceilingz; + tsprite[spritesortcnt].sectnum = sp->sectnum; + tsprite[spritesortcnt].owner = k; + + //OSD_Printf("duped sprite of pic %d at %d %d %d\n",tsprite[spritesortcnt].picnum,tsprite[spritesortcnt].x,tsprite[spritesortcnt].y,tsprite[spritesortcnt].z); + spritesortcnt++; + } + k = nextspritesect[k]; + } + } + */ + + G_DoSpriteAnimations(ud.camerax,ud.cameray,ud.cameraang,smoothratio); + drawmasks(); + + if (level) + { + sector[sprite[sprite2].sectnum].ceilingpicnum = picnum; + for (i = 0; i < numsectors; i++) + { + sector[i].ceilingstat = backupstat[i]; + sector[i].ceilingz = backupz[i]; + } + } + else + { + sector[sprite[sprite2].sectnum].floorpicnum = picnum; + + for (i = 0; i < numsectors; i++) + { + sector[i].floorstat = backupstat[i]; + sector[i].floorz = backupz[i]; + } + } + } + } +} + void G_DrawRooms(int32_t snum,int32_t smoothratio) { int32_t dst,j,fz,cz; @@ -4343,13 +4320,13 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) else if (s->yvel > 199) s->yvel = 300; ud.cameraang = ActorExtra[ud.camerasprite].tempang+mulscale16((int32_t)(((s->ang+1024-ActorExtra[ud.camerasprite].tempang)&2047)-1024),smoothratio); -#ifdef SE40 - se40code(s->x,s->y,s->z,ud.cameraang,s->yvel,smoothratio); -#endif #ifdef POLYMER if (getrendermode() == 4) polymer_setanimatesprites(G_DoSpriteAnimations, s->x, s->y, ud.cameraang, smoothratio); #endif + + G_SE40(smoothratio); + drawrooms(s->x,s->y,s->z-(4<<8),ud.cameraang,s->yvel,s->sectnum); G_DoSpriteAnimations(s->x,s->y,ud.cameraang,smoothratio); drawmasks(); @@ -4495,9 +4472,6 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) if (apScriptGameEvent[EVENT_DISPLAYROOMS]) X_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek, -1); -#ifdef SE40 - se40code(ud.camerax,ud.cameray,ud.cameraz,ud.cameraang,ud.camerahoriz,smoothratio); -#endif if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0) #if defined(POLYMOST) && defined(USE_OPENGL) && (getrendermode() != 4) @@ -4539,8 +4513,43 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) polymer_setanimatesprites(G_DoSpriteAnimations, ud.camerax,ud.cameray,ud.cameraang,smoothratio); } #endif + G_SE40(smoothratio); + drawrooms(ud.camerax,ud.cameray,ud.cameraz,ud.cameraang,ud.camerahoriz,ud.camerasect); + + // dupe the sprites touching the portal to the other sector + + if (ror_sprite != -1) + { + spritetype *sp = &sprite[ror_sprite]; + + // viewing from bottom + if (drawing_ror == 1) + { + int32_t k = headspritesect[sp->sectnum]; + + while (k != -1) + { + if (sprite[k].picnum != SECTOREFFECTOR && (sprite[k].z >= sp->z)) + { + Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)&sprite[k],sizeof(spritetype)); + + tsprite[spritesortcnt].x += (sprite[sp->yvel].x-sp->x); + tsprite[spritesortcnt].y += (sprite[sp->yvel].y-sp->y); + tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sp->z + ActorExtra[sp->yvel].ceilingz; + tsprite[spritesortcnt].sectnum = sprite[sp->yvel].sectnum; + tsprite[spritesortcnt].owner = k; + + OSD_Printf("duped sprite of pic %d at %d %d %d\n",tsprite[spritesortcnt].picnum,tsprite[spritesortcnt].x,tsprite[spritesortcnt].y,tsprite[spritesortcnt].z); + spritesortcnt++; + } + k = nextspritesect[k]; + } + } + } + G_DoSpriteAnimations(ud.camerax,ud.cameray,ud.cameraang,smoothratio); + drawing_ror = 0; drawmasks(); if (g_screenCapture == 1) @@ -4582,7 +4591,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) static void G_DumpDebugInfo(void) { int32_t i,j,x; -// FILE * fp=fopen("condebug.log","w"); + // FILE * fp=fopen("condebug.log","w"); OSD_Printf("Current gamevar values:\n"); for (i=0; ilotag) { - + case 40: + case 41: + sp->cstat = 32; + sp->xrepeat = sp->yrepeat = 64; + changespritestat(i, STAT_EFFECTOR); + for (j=0; j < MAXSPRITES; j++) + if (sprite[j].picnum == SECTOREFFECTOR && (sprite[j].lotag == 40 || sprite[j].lotag == 41) && + sprite[j].hitag == sp->hitag && i != j) + { +// initprintf("found ror match\n"); + sp->yvel = j; + break; + } + goto SPAWN_END; + break; + case 46: + ror_protectedsectors[sp->sectnum] = 1; case 49: case 50: changespritestat(i, STAT_EFFECTOR); @@ -6539,21 +6564,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) break; } - switch (sprite[i].lotag) - { - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - changespritestat(i,15); - break; - default: - changespritestat(i, STAT_EFFECTOR); - break; - } - + changespritestat(i, STAT_EFFECTOR); break; case SEENINE__STATIC: @@ -6676,6 +6687,36 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) if (!spritesortcnt) return; + ror_sprite = -1; + + for (j=spritesortcnt-1; j>=0; j--) //Between drawrooms() and drawmasks() + { + //is the perfect time to animate sprites + t = &tsprite[j]; + i = t->owner; + s = &sprite[i]; + + switch (DynamicTileMap[s->picnum]) + { + case SECTOREFFECTOR__STATIC: + if (s->lotag == 40 || s->lotag == 41) + { + t->cstat = 32768; + + if (ror_sprite == -1) ror_sprite = i; + } + + if (t->lotag == 27 && ud.recstat == 1) + { + t->picnum = 11+((totalclock>>3)&1); + t->cstat |= 128; + } + else + t->xrepeat = t->yrepeat = 0; + break; + } + } + for (j=spritesortcnt-1; j>=0; j--) { t = &tsprite[j]; @@ -6779,15 +6820,6 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) switch (DynamicTileMap[s->picnum]) { - case SECTOREFFECTOR__STATIC: - if (t->lotag == 27 && ud.recstat == 1) - { - t->picnum = 11+((totalclock>>3)&1); - t->cstat |= 128; - } - else - t->xrepeat = t->yrepeat = 0; - break; case NATURALLIGHTNING__STATIC: t->shade = -127; break; @@ -7290,7 +7322,7 @@ PALONLY: } */ - if (t4) + if (t4 && t4 != 1) { l = *(((intptr_t *)t4)+2); //For TerminX: was *(int32_t *)(t4+8) @@ -12277,7 +12309,7 @@ static void Net_DoPrediction(void) if (lz >= 0 && (lz&49152) == 49152) { j = lz&(MAXSPRITES-1); - if ((sprite[j].cstat&33) == 33) + if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17) { psectlotag = 0; spritebridge = 1; @@ -12358,11 +12390,13 @@ static void Net_DoPrediction(void) if (my.z > (fz-(15<<8))) my.z += ((fz-(15<<8))-my.z)>>1; - if (my.z < (cz+(4<<8))) - { - my.z = cz+(4<<8); - myvel.z = 0; - } + /* + if (my.z < (cz+(4<<8))) + { + my.z = cz+(4<<8); + myvel.z = 0; + } + */ } else if (p->jetpack_on) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index b96512bdc..12cef28a4 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1517,7 +1517,7 @@ static int32_t C_GetNextKeyword(void) //Returns its code # *g_scriptPtr = i + (IFELSE_MAGIC<<12); else *g_scriptPtr = i + (g_lineNumber<<12); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); textptr += l; g_scriptPtr++; @@ -1552,13 +1552,13 @@ static void C_GetNextVarType(int32_t type) { if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=MAXGAMEVARS; if (tolower(textptr[1])=='x') sscanf(textptr+2,"%" PRIxPTR "",g_scriptPtr); else *g_scriptPtr=atoi(textptr); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); g_scriptPtr++; #if 1 while (!ispecial(*textptr) && *textptr != ']') textptr++; @@ -1616,7 +1616,7 @@ static void C_GetNextVarType(int32_t type) f |= (MAXGAMEVARS<<3); } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=(i|f); C_GetNextVarType(0); C_SkipComments(); @@ -1680,7 +1680,7 @@ static void C_GetNextVarType(int32_t type) return; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); if (i == g_iSpriteVarID) { @@ -1732,9 +1732,9 @@ static void C_GetNextVarType(int32_t type) { if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) initprintf("%s:%d: debug: accepted defined label `%s' instead of gamevar.\n",g_szScriptFileName,g_lineNumber,label+(i<<6)); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=MAXGAMEVARS; - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=labelcode[i]; return; } @@ -1772,7 +1772,7 @@ static void C_GetNextVarType(int32_t type) if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) initprintf("%s:%d: debug: accepted gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=(i|f); } @@ -1831,12 +1831,12 @@ static int32_t C_GetNextValue(int32_t type) } if (labeltype[i] != LABEL_DEFINE && labelcode[i] >= (intptr_t)&script[0] && labelcode[i] < (intptr_t)&script[g_scriptSize]) bitptr[(g_scriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_scriptPtr-script)&7)); - else bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + else bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *(g_scriptPtr++) = labelcode[i]; textptr += l; return labeltype[i]; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *(g_scriptPtr++) = 0; textptr += l; el = (char *)C_GetLabelType(type); @@ -1853,7 +1853,7 @@ static int32_t C_GetNextValue(int32_t type) { C_ReportError(ERROR_PARAMUNDEFINED); g_numCompilerErrors++; - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = 0; g_scriptPtr++; textptr+=l; @@ -1883,7 +1883,7 @@ static int32_t C_GetNextValue(int32_t type) if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) initprintf("%s:%d: debug: accepted constant %d.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); if (tolower(textptr[1])=='x') sscanf(textptr+2,"%" PRIxPTR "",g_scriptPtr); @@ -2075,7 +2075,7 @@ static int32_t C_ParseCommand(void) *g_scriptPtr = labelcode[j]; if (labelcode[j] >= (intptr_t)&script[0] && labelcode[j] < (intptr_t)&script[g_scriptSize]) bitptr[(g_scriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_scriptPtr-script)&7)); - else bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + else bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); g_scriptPtr++; return 0; } @@ -2187,7 +2187,7 @@ static int32_t C_ParseCommand(void) return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=ProjectileLabels[lLabelID].lId; //printf("member's flags are: %02Xh\n",PlayerLabels[lLabelID].flags); @@ -2353,7 +2353,7 @@ static int32_t C_ParseCommand(void) while (j>-1) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = 0; g_scriptPtr++; j--; @@ -2385,7 +2385,7 @@ static int32_t C_ParseCommand(void) g_scriptPtr--; j |= *g_scriptPtr; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = j; g_scriptPtr++; @@ -2430,7 +2430,7 @@ static int32_t C_ParseCommand(void) for (k=j; k>=0; k--) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = 0; g_scriptPtr++; } @@ -2639,7 +2639,7 @@ static int32_t C_ParseCommand(void) g_scriptPtr--; k |= *g_scriptPtr; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = k; g_scriptPtr++; return 0; @@ -2647,7 +2647,7 @@ static int32_t C_ParseCommand(void) } for (k=j; k<3; k++) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = 0; g_scriptPtr++; } @@ -2706,7 +2706,7 @@ static int32_t C_ParseCommand(void) } for (k=j; k>=0; k--) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *(g_scriptPtr++) = 0; } } @@ -2749,7 +2749,7 @@ static int32_t C_ParseCommand(void) g_scriptPtr--; j |= *g_scriptPtr; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = j; g_scriptPtr++; break; @@ -2760,7 +2760,7 @@ static int32_t C_ParseCommand(void) { for (i=4-j; i; i--) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *(g_scriptPtr++) = 0; } break; @@ -2904,7 +2904,7 @@ static int32_t C_ParseCommand(void) for (j=0; j<4; j++) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *(g_parsingActorPtr+j) = 0; if (j == 3) { @@ -2915,7 +2915,7 @@ static int32_t C_ParseCommand(void) g_scriptPtr--; j |= *g_scriptPtr; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = j; g_scriptPtr++; break; @@ -2926,7 +2926,7 @@ static int32_t C_ParseCommand(void) { for (i=4-j; i; i--) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *(g_scriptPtr++) = 0; } break; @@ -2979,7 +2979,7 @@ static int32_t C_ParseCommand(void) while (j > -1) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = 0; g_scriptPtr++; j--; @@ -3173,7 +3173,7 @@ static int32_t C_ParseCommand(void) C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=lLabelID; // now at target VAR... @@ -3308,7 +3308,7 @@ static int32_t C_ParseCommand(void) C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=lLabelID; // now at target VAR... @@ -3376,7 +3376,7 @@ static int32_t C_ParseCommand(void) return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=PlayerLabels[lLabelID].lId; //printf("member's flags are: %02Xh\n",PlayerLabels[lLabelID].flags); @@ -3457,7 +3457,7 @@ static int32_t C_ParseCommand(void) return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=InputLabels[lLabelID].lId; // now at target VAR... @@ -3507,7 +3507,7 @@ static int32_t C_ParseCommand(void) C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=lLabelID; // now at target VAR... @@ -3641,7 +3641,7 @@ static int32_t C_ParseCommand(void) } } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=i; // the ID of the DEF (offset into array...) switch (tw) @@ -3712,7 +3712,7 @@ static int32_t C_ParseCommand(void) return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=ActorLabels[lLabelID].lId; //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); @@ -3795,7 +3795,7 @@ static int32_t C_ParseCommand(void) return 0; } - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=TsprLabels[lLabelID].lId; //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); @@ -3957,7 +3957,7 @@ static int32_t C_ParseCommand(void) i=GetADefID(label+(g_numLabels<<6)); if (i > (-1)) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=i; } else @@ -3969,7 +3969,7 @@ static int32_t C_ParseCommand(void) i=GetADefID(label+(g_numLabels<<6)); if (i > (-1)) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=i; } else @@ -3996,7 +3996,7 @@ static int32_t C_ParseCommand(void) i=GetADefID(label+(g_numLabels<<6)); if (i > (-1)) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=i; } else @@ -4026,7 +4026,7 @@ static int32_t C_ParseCommand(void) i=GetADefID(label+(g_numLabels<<6)); if (i > (-1)) { - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=i; } else @@ -4518,12 +4518,12 @@ static int32_t C_ParseCommand(void) tempscrptr= g_scriptPtr; tempoffset = (unsigned)(tempscrptr-script); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=0; // leave spot for end location (for after processing) - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=0; // count of case statements g_caseScriptPtr=g_scriptPtr; // the first case's pointer. - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=0; // leave spot for 'default' location (null if none) temptextptr=textptr; @@ -4561,9 +4561,9 @@ static int32_t C_ParseCommand(void) while (j--) { // leave room for statements - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=0; // value check - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=0; // code offset C_SkipComments(); } @@ -4851,7 +4851,7 @@ repeatcase: j |= *g_scriptPtr; } while (C_GetKeyword() == -1); - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr = j; g_scriptPtr++; break; @@ -5474,7 +5474,7 @@ repeatcase: else { *(ScriptQuoteRedefinitions[g_numQuoteRedefinitions]+i) = '\0'; - bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=g_numQuoteRedefinitions; g_numQuoteRedefinitions++; } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index ea0bdec43..ae832dabc 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2238,11 +2238,6 @@ static int32_t X_DoExecute(register int32_t once) #endif G_DoInterpolations(smoothratio); -#define SE40 - -#ifdef SE40 - se40code(x,y,z,a,horiz,smoothratio); -#endif if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0) #if defined(POLYMER) && defined(USE_OPENGL) && (getrendermode() != 4) diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 6146f3e4f..cfd2ba6c8 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //------------------------------------------------------------------------- #include "duke3d.h" -const char *s_buildDate = "20090616"; +const char *s_buildDate = "20090701"; char *MusicPtr = NULL; int32_t g_musicSize; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 738c1a6a0..6065c24d0 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -3891,7 +3891,7 @@ void P_ProcessInput(int32_t snum) { j = lz&(MAXSPRITES-1); - if ((sprite[j].cstat&33) == 33) + if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17) { psectlotag = 0; p->footprintcount = 0; @@ -4356,7 +4356,7 @@ void P_ProcessInput(int32_t snum) if (p->posz > (fz-(15<<8))) p->posz += ((fz-(15<<8))-p->posz)>>1; - if (p->posz < (cz+(4<<8))) + if ((psectlotag != 2 || cz != sector[p->cursectnum].ceilingz) && p->posz < (cz+(4<<8))) { p->posz = cz+(4<<8); p->poszv = 0; @@ -4456,10 +4456,12 @@ void P_ProcessInput(int32_t snum) { if (p->on_ground == 1) { - if (p->dummyplayersprite == -1) - p->dummyplayersprite = - A_Spawn(pi,PLAYERONWATER); - sprite[p->dummyplayersprite].pal = sprite[p->i].pal; + /* + if (p->dummyplayersprite == -1) + p->dummyplayersprite = + A_Spawn(pi,PLAYERONWATER); + sprite[p->dummyplayersprite].pal = sprite[p->i].pal; + */ p->footprintcount = 6; if (sector[p->cursectnum].floorpicnum == FLOORSLIME) p->footprintpal = 8; @@ -4655,7 +4657,7 @@ void P_ProcessInput(int32_t snum) p->posz += p->poszv; - if (p->posz < (cz+(4<<8))) + if ((psectlotag != 2 || cz != sector[p->cursectnum].ceilingz) && p->posz < (cz+(4<<8))) { p->jumping_counter = 0; if (p->poszv < 0) diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index b756fdaad..cb4413036 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -881,12 +881,14 @@ static inline void prelevel(char g) int32_t i, nexti, j, startwall, endwall, lotaglist; int32_t lotags[MAXSPRITES]; int32_t switchpicnum; - + extern char ror_protectedsectors[MAXSECTORS]; clearbufbyte(show2dsector,sizeof(show2dsector),0L); clearbufbyte(show2dwall,sizeof(show2dwall),0L); clearbufbyte(show2dsprite,sizeof(show2dsprite),0L); + Bmemset(ror_protectedsectors, 0, MAXSECTORS); + resetprestat(0,g); g_numClouds = 0;