mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Mapster undo fixes and some other relatively minor stuff... SPRITE_NOLIGHT flag to kill built in lights from CONs
git-svn-id: https://svn.eduke32.com/eduke32@1444 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6f6f0900c8
commit
f061313bef
5 changed files with 1949 additions and 1906 deletions
|
@ -7853,6 +7853,17 @@ void G_MoveWorld(void)
|
|||
{
|
||||
spritetype *s = &sprite[i];
|
||||
|
||||
if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT))
|
||||
{
|
||||
if (ActorExtra[i].lightptr != NULL)
|
||||
{
|
||||
polymer_deletelight(ActorExtra[i].lightId);
|
||||
ActorExtra[i].lightId = -1;
|
||||
ActorExtra[i].lightptr = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (ActorExtra[i].lightptr != NULL && ActorExtra[i].lightcount)
|
||||
{
|
||||
if (!(--ActorExtra[i].lightcount))
|
||||
|
@ -7883,8 +7894,16 @@ void G_MoveWorld(void)
|
|||
{
|
||||
int32_t x, y;
|
||||
|
||||
if (s->cstat & 32768 || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
|
||||
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);
|
||||
|
@ -7981,7 +8000,7 @@ void G_MoveWorld(void)
|
|||
{
|
||||
int32_t x, y;
|
||||
|
||||
if ((s->cstat & 32768) || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -143,18 +143,26 @@ typedef struct _mapundo
|
|||
|
||||
mapundo_t *mapstate = NULL;
|
||||
|
||||
int32_t map_revision = 0;
|
||||
int32_t map_revision = 1;
|
||||
|
||||
void create_map_snapshot(void)
|
||||
{
|
||||
int32_t j;
|
||||
uint32_t tempcrc;
|
||||
|
||||
// if (mapstate == NULL) mapstate = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
|
||||
|
||||
/*
|
||||
if (mapstate->prev == NULL && mapstate->next != NULL) // should be the first map version
|
||||
mapstate = mapstate->next;
|
||||
*/
|
||||
|
||||
if (mapstate == NULL)
|
||||
{
|
||||
mapstate = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
|
||||
mapstate->revision = map_revision = 1;
|
||||
mapstate->prev = mapstate->next = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mapstate->next != NULL)
|
||||
{
|
||||
mapundo_t *next = mapstate->next;
|
||||
|
@ -163,24 +171,33 @@ void create_map_snapshot(void)
|
|||
while (next->next)
|
||||
next = next->next;
|
||||
|
||||
while (next->prev)
|
||||
do
|
||||
{
|
||||
next = next->prev;
|
||||
if (next->next->sectors && (next->next->sectors != next->sectors)) Bfree(next->next->sectors);
|
||||
if (next->next->walls && (next->next->walls != next->walls)) Bfree(next->next->walls);
|
||||
if (next->next->sprites && (next->next->sprites != next->sprites)) Bfree(next->next->sprites);
|
||||
Bfree(next->next);
|
||||
next->next = NULL;
|
||||
if (next->sectors && (next->prev == NULL || (next->sectcrc != next->prev->sectcrc))) Bfree(next->sectors);
|
||||
if (next->walls && (next->prev == NULL || (next->wallcrc != next->prev->wallcrc))) Bfree(next->walls);
|
||||
if (next->sprites && (next->prev == NULL || (next->spritecrc != next->prev->spritecrc))) Bfree(next->sprites);
|
||||
if (!next->prev)
|
||||
{
|
||||
Bfree(next);
|
||||
break;
|
||||
}
|
||||
next = next->prev;
|
||||
Bfree(next->next);
|
||||
}
|
||||
while (next);
|
||||
}
|
||||
|
||||
mapstate->next = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
|
||||
mapstate->next->prev = mapstate;
|
||||
|
||||
mapstate = mapstate->next;
|
||||
mapstate->revision = ++map_revision;
|
||||
}
|
||||
|
||||
fixspritesectors();
|
||||
|
||||
numsprites = 0;
|
||||
for (j=0; j<MAXSPRITES; j++)
|
||||
for (j=MAXSPRITES-1; j>=0; j--)
|
||||
{
|
||||
if (sprite[j].statnum != MAXSTATUS)
|
||||
numsprites++;
|
||||
|
@ -193,7 +210,7 @@ void create_map_snapshot(void)
|
|||
tempcrc = crc32once((uint8_t *)§or[0],sizeof(sectortype) * numsectors);
|
||||
|
||||
|
||||
if (mapstate->prev && mapstate->prev->numsectors == numsectors && mapstate->prev->sectcrc == tempcrc)
|
||||
if (mapstate->prev && mapstate->prev->sectcrc == tempcrc)
|
||||
{
|
||||
mapstate->sectors = mapstate->prev->sectors;
|
||||
mapstate->sectsiz = mapstate->prev->sectsiz;
|
||||
|
@ -212,7 +229,7 @@ void create_map_snapshot(void)
|
|||
tempcrc = crc32once((uint8_t *)&wall[0],sizeof(walltype) * numwalls);
|
||||
|
||||
|
||||
if (mapstate->prev && mapstate->prev->numwalls == numwalls && mapstate->prev->wallcrc == tempcrc)
|
||||
if (mapstate->prev && mapstate->prev->wallcrc == tempcrc)
|
||||
{
|
||||
mapstate->walls = mapstate->prev->walls;
|
||||
mapstate->wallsiz = mapstate->prev->wallsiz;
|
||||
|
@ -230,7 +247,7 @@ void create_map_snapshot(void)
|
|||
|
||||
tempcrc = crc32once((uint8_t *)&sprite[0],sizeof(spritetype) * MAXSPRITES);
|
||||
|
||||
if (mapstate->prev && mapstate->prev->numsprites == numsprites && mapstate->prev->spritecrc == tempcrc)
|
||||
if (mapstate->prev && mapstate->prev->spritecrc == tempcrc)
|
||||
{
|
||||
mapstate->sprites = mapstate->prev->sprites;
|
||||
mapstate->spritesiz = mapstate->prev->spritesiz;
|
||||
|
@ -245,10 +262,13 @@ void create_map_snapshot(void)
|
|||
|
||||
spri = &tspri[0];
|
||||
|
||||
for (j=0; j<MAXSPRITES && i < numsprites; j++,i++)
|
||||
for (j=0; j<MAXSPRITES && i < numsprites; j++)
|
||||
{
|
||||
if (sprite[j].statnum != MAXSTATUS)
|
||||
{
|
||||
Bmemcpy(spri++,&sprite[j],sizeof(spritetype));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
mapstate->spritesiz = j = lzf_compress(&tspri[0], sizeof(spritetype) * numsprites,
|
||||
&mapstate->sprites[0], sizeof(spritetype) * numsprites);
|
||||
|
@ -256,9 +276,6 @@ void create_map_snapshot(void)
|
|||
mapstate->spritecrc = tempcrc;
|
||||
Bfree(tspri);
|
||||
}
|
||||
|
||||
mapstate->revision = ++map_revision;
|
||||
mapstate = mapstate->next;
|
||||
}
|
||||
|
||||
void map_undoredo_free(void)
|
||||
|
@ -290,7 +307,7 @@ void map_undoredo_free(void)
|
|||
mapstate = NULL;
|
||||
}
|
||||
|
||||
map_revision = 0;
|
||||
map_revision = 1;
|
||||
|
||||
}
|
||||
|
||||
|
@ -298,24 +315,27 @@ int32_t map_undoredo(int32_t dir)
|
|||
{
|
||||
int32_t i;
|
||||
|
||||
if (mapstate == NULL) return 1;
|
||||
|
||||
if (dir)
|
||||
{
|
||||
if (mapstate == NULL || mapstate->next == NULL || !mapstate->next->numsectors) return 1;
|
||||
if (mapstate->next == NULL || !mapstate->next->numsectors) return 1;
|
||||
|
||||
while (map_revision+1 != mapstate->revision && mapstate->next)
|
||||
// while (map_revision+1 != mapstate->revision && mapstate->next)
|
||||
mapstate = mapstate->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mapstate == NULL || mapstate->prev == NULL || !mapstate->prev->numsectors) return 1;
|
||||
if (mapstate->prev == NULL || !mapstate->prev->numsectors) return 1;
|
||||
|
||||
while (map_revision-1 != mapstate->revision && mapstate->prev)
|
||||
// while (map_revision-1 != mapstate->revision && mapstate->prev)
|
||||
mapstate = mapstate->prev;
|
||||
}
|
||||
|
||||
numsectors = mapstate->numsectors;
|
||||
numwalls = mapstate->numwalls;
|
||||
numsprites = mapstate->numsprites;
|
||||
map_revision = mapstate->revision;
|
||||
|
||||
initspritelists();
|
||||
|
||||
|
@ -335,8 +355,6 @@ int32_t map_undoredo(int32_t dir)
|
|||
insertsprite(sprite[i].sectnum,sprite[i].statnum);
|
||||
}
|
||||
|
||||
map_revision = mapstate->revision;
|
||||
|
||||
#ifdef POLYMER
|
||||
if (qsetmode == 200 && rendmode == 4)
|
||||
polymer_loadboard();
|
||||
|
@ -9835,7 +9853,7 @@ extern int32_t graphicsmode;
|
|||
|
||||
void ExtPreCheckKeys(void) // just before drawrooms
|
||||
{
|
||||
int32_t i = 0;
|
||||
int32_t i = 0, ii;
|
||||
int32_t radius, xp1, yp1;
|
||||
int32_t col;
|
||||
int32_t picnum, frames;
|
||||
|
@ -9917,9 +9935,10 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
|
||||
if (graphicsmode && zoom >= 256)
|
||||
{
|
||||
for (i=0; i<numsprites; i++)
|
||||
for (i=ii=0; i<MAXSPRITES && ii < numsprites; i++)
|
||||
{
|
||||
if ((sprite[i].cstat & 48) != 0 || sprite[i].statnum == MAXSTATUS) continue;
|
||||
ii++;
|
||||
picnum = sprite[i].picnum;
|
||||
ang = flags = frames = shade = 0;
|
||||
|
||||
|
@ -10276,11 +10295,10 @@ static void Keys2d3d(void)
|
|||
|
||||
if (mapstate == NULL)
|
||||
{
|
||||
mapstate = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
|
||||
map_revision = 0;
|
||||
// map_revision = 0;
|
||||
create_map_snapshot(); // initial map state
|
||||
Bfree(mapstate->next);
|
||||
mapstate = mapstate->prev;
|
||||
// Bfree(mapstate->next);
|
||||
// mapstate = mapstate->prev;
|
||||
}
|
||||
|
||||
if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_A]) // ' a
|
||||
|
@ -10541,12 +10559,13 @@ void ExtCheckKeys(void)
|
|||
{
|
||||
// message("Saved undo rev %d",map_revision);
|
||||
create_map_snapshot();
|
||||
asksave = 2;
|
||||
asksave++;
|
||||
}
|
||||
else if (asksave == 2) asksave++;
|
||||
|
||||
if ((totalclock > autosavetimer) && (autosave))
|
||||
{
|
||||
if (asksave == 2)
|
||||
if (asksave == 3)
|
||||
{
|
||||
fixspritesectors(); //Do this before saving!
|
||||
// updatesector(startposx,startposy,&startsectnum);
|
||||
|
@ -10554,7 +10573,7 @@ void ExtCheckKeys(void)
|
|||
saveboard("autosave.map",&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap("autosave.map");
|
||||
message("Board autosaved to AUTOSAVE.MAP");
|
||||
asksave = 3;
|
||||
asksave = 4;
|
||||
}
|
||||
autosavetimer = totalclock+120*autosave;
|
||||
}
|
||||
|
|
|
@ -864,6 +864,7 @@ enum SpriteFlags_t {
|
|||
SPRITE_BADGUY = 32,
|
||||
SPRITE_NOPAL = 64,
|
||||
SPRITE_NOEVENTCODE = 128,
|
||||
SPRITE_NOLIGHT = 256,
|
||||
};
|
||||
|
||||
extern int16_t SpriteCacheList[MAXTILES][3];
|
||||
|
|
|
@ -271,7 +271,7 @@ extern inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zof
|
|||
extern void se40code(int32_t x,int32_t y,int32_t z,int32_t a,int32_t h, int32_t smoothratio);
|
||||
|
||||
extern void G_FreeMapState(int32_t mapnum);
|
||||
extern void G_FindLevelForFilename(const char *fn, char *volume, char *level);
|
||||
extern int32_t G_FindLevelForFilename(const char *fn);
|
||||
|
||||
extern void G_GetCrosshairColor(void);
|
||||
extern void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b);
|
||||
|
|
|
@ -742,7 +742,7 @@ void P_ResetWeapons(int32_t snum)
|
|||
p->curr_weapon = PISTOL_WEAPON;
|
||||
p->gotweapon[PISTOL_WEAPON] = 1;
|
||||
p->gotweapon[KNEE_WEAPON] = 1;
|
||||
p->ammo_amount[PISTOL_WEAPON] = 48;
|
||||
p->ammo_amount[PISTOL_WEAPON] = min(p->max_ammo_amount[PISTOL_WEAPON], 48);
|
||||
p->gotweapon[HANDREMOTE_WEAPON] = 1;
|
||||
p->last_weapon = -1;
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
|
|||
{
|
||||
p->curr_weapon = i;
|
||||
p->gotweapon[i] = 1;
|
||||
p->ammo_amount[i] = 48;
|
||||
p->ammo_amount[i] = min(p->max_ammo_amount[i], 48);
|
||||
}
|
||||
else if (aplWeaponWorksLike[i][0]==KNEE_WEAPON)
|
||||
p->gotweapon[i] = 1;
|
||||
|
@ -1625,19 +1625,20 @@ void Net_ResetPrediction(void)
|
|||
|
||||
extern int32_t voting, vote_map, vote_episode;
|
||||
|
||||
void G_FindLevelForFilename(const char *fn, char *volume, char *level)
|
||||
int32_t G_FindLevelForFilename(const char *fn)
|
||||
{
|
||||
for (*volume=0; *volume<MAXVOLUMES; (*volume)++)
|
||||
int32_t volume, level;
|
||||
|
||||
for (volume=0; volume<MAXVOLUMES; volume++)
|
||||
{
|
||||
for (*level=0; *level<MAXLEVELS; (*level)++)
|
||||
for (level=0; level<MAXLEVELS; level++)
|
||||
{
|
||||
if (MapInfo[(*volume*MAXLEVELS)+*level].filename != NULL)
|
||||
if (!Bstrcasecmp(fn, MapInfo[(*volume*MAXLEVELS)+*level].filename))
|
||||
break;
|
||||
if (MapInfo[(volume*MAXLEVELS)+level].filename != NULL)
|
||||
if (!Bstrcasecmp(fn, MapInfo[(volume*MAXLEVELS)+level].filename))
|
||||
return ((volume * MAXLEVELS) + level);
|
||||
}
|
||||
if (*level != MAXLEVELS)
|
||||
break;
|
||||
}
|
||||
return MAXLEVELS;
|
||||
}
|
||||
|
||||
int32_t G_EnterLevel(int32_t g)
|
||||
|
@ -1669,14 +1670,17 @@ int32_t G_EnterLevel(int32_t g)
|
|||
|
||||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
||||
{
|
||||
char volume, level;
|
||||
int32_t volume, level;
|
||||
|
||||
Bcorrectfilename(boardfilename,0);
|
||||
|
||||
G_FindLevelForFilename(boardfilename,&volume,&level);
|
||||
volume = level = G_FindLevelForFilename(boardfilename);
|
||||
|
||||
if (level != MAXLEVELS)
|
||||
{
|
||||
level &= MAXLEVELS-1;
|
||||
volume = (volume - level) / MAXLEVELS;
|
||||
|
||||
ud.level_number = ud.m_level_number = level;
|
||||
ud.volume_number = ud.m_volume_number = volume;
|
||||
boardfilename[0] = 0;
|
||||
|
|
Loading…
Reference in a new issue