mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
undo improvements
git-svn-id: https://svn.eduke32.com/eduke32@1363 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
024edae792
commit
e47b890189
2 changed files with 32 additions and 43 deletions
|
@ -218,6 +218,7 @@ int32_t getfilenames(char *path, char *kind);
|
|||
void clearfilenames(void);
|
||||
void loadmhk();
|
||||
extern int32_t map_revision;
|
||||
extern int32_t map_undoredo(int32_t dir);
|
||||
|
||||
void clearkeys(void) { memset(keystatus,0,sizeof(keystatus)); }
|
||||
|
||||
|
@ -4148,8 +4149,7 @@ CANCEL:
|
|||
if (keystatus[1])
|
||||
{
|
||||
keystatus[1] = 0;
|
||||
_printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (T)est map, (Q)uit");
|
||||
// printext16(200L+248, ydim-STATUS2DSIZ+20L, 9, 0, "(U)ndo, (R)edo", 0);
|
||||
_printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (T)est map, (U)ndo, (R)edo, (Q)uit");
|
||||
showframe(1);
|
||||
bflushchars();
|
||||
bad = 1;
|
||||
|
@ -4511,6 +4511,18 @@ CANCEL:
|
|||
{
|
||||
test_map(0);
|
||||
}
|
||||
else if (ch == 'u' || ch == 'U')
|
||||
{
|
||||
bad = 0;
|
||||
if (map_undoredo(0)) printmessage16("Nothing to undo!");
|
||||
else printmessage16("Revision %d undone",map_revision);
|
||||
}
|
||||
else if (ch == 'r' || ch == 'R')
|
||||
{
|
||||
bad = 0;
|
||||
if (map_undoredo(1)) printmessage16("Nothing to redo!");
|
||||
else printmessage16("Restored revision %d",map_revision-1);
|
||||
}
|
||||
else if (ch == 'q' || ch == 'Q') //Q
|
||||
{
|
||||
bad = 0;
|
||||
|
|
|
@ -253,48 +253,24 @@ void create_map_snapshot(void)
|
|||
mapstate = mapstate->next;
|
||||
}
|
||||
|
||||
int32_t map_undo(void)
|
||||
int32_t map_undoredo(int32_t dir)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if (mapstate == NULL || mapstate->prev == NULL || !mapstate->prev->numsectors) return 1;
|
||||
|
||||
mapstate = mapstate->prev;
|
||||
|
||||
numsectors = mapstate->numsectors;
|
||||
numwalls = mapstate->numwalls;
|
||||
numsprites = mapstate->numsprites;
|
||||
|
||||
initspritelists();
|
||||
|
||||
lzf_decompress(&mapstate->sectors[0], mapstate->sectsiz, §or[0], sizeof(sectortype) * numsectors);
|
||||
lzf_decompress(&mapstate->walls[0], mapstate->wallsiz, &wall[0], sizeof(walltype) * numwalls);
|
||||
lzf_decompress(&mapstate->sprites[0], mapstate->spritesiz, &sprite[0], sizeof(spritetype) * numsprites);
|
||||
|
||||
updatenumsprites();
|
||||
|
||||
for (i=0; i<numsprites; i++)
|
||||
if (dir)
|
||||
{
|
||||
if ((sprite[i].cstat & 48) == 48) sprite[i].cstat &= ~48;
|
||||
insertsprite(sprite[i].sectnum,sprite[i].statnum);
|
||||
}
|
||||
|
||||
map_revision = mapstate->revision;
|
||||
|
||||
#ifdef POLYMER
|
||||
if (qsetmode == 200 && rendmode == 4)
|
||||
polymer_loadboard();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t map_redo(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if (mapstate == NULL || mapstate->next == NULL || !mapstate->next->numsectors) return 1;
|
||||
|
||||
while (map_revision+1 != mapstate->revision)
|
||||
mapstate = mapstate->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mapstate == NULL || mapstate->prev == NULL || !mapstate->prev->numsectors) return 1;
|
||||
|
||||
while (map_revision-1 != mapstate->revision)
|
||||
mapstate = mapstate->prev;
|
||||
}
|
||||
|
||||
numsectors = mapstate->numsectors;
|
||||
numwalls = mapstate->numwalls;
|
||||
|
@ -9845,7 +9821,6 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
|
||||
if (shadepreview)
|
||||
{
|
||||
int32_t i = 0;
|
||||
|
@ -10023,6 +9998,8 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
xp1 += halfxdim16;
|
||||
yp1 += midydim16;
|
||||
|
||||
ydim16 = ydim-STATUS2DSIZ2;
|
||||
|
||||
if (xp1 < 4 || xp1 > xdim-6 || yp1 < 4 || yp1 > ydim16-6)
|
||||
continue;
|
||||
rotatesprite(xp1<<16,yp1<<16,zoom<<5,ang,picnum,
|
||||
|
@ -10315,13 +10292,13 @@ static void Keys2d3d(void)
|
|||
keystatus[KEYSC_Z] = 0;
|
||||
if (eitherSHIFT)
|
||||
{
|
||||
if (map_redo()) message("Nothing to redo!");
|
||||
else message("Restored undo rev %d",map_revision-1);
|
||||
if (map_undoredo(1)) message("Nothing to redo!");
|
||||
else message("Restored revision %d",map_revision-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (map_undo()) message("Nothing to undo!");
|
||||
else message("Restored undo rev %d",map_revision-1);
|
||||
if (map_undoredo(0)) printmessage16("Nothing to undo!");
|
||||
else message("Revision %d undone",map_revision);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue