Besides catching a few more corner cases, there's better mouselook handling and a warning (but no fix) for a rare and bad corruption when splitting a sector in this revision.

git-svn-id: https://svn.eduke32.com/eduke32@1836 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-03-08 23:02:38 +00:00
parent c4f613e021
commit b158521449
8 changed files with 546 additions and 544 deletions

View File

@ -39,7 +39,7 @@ extern "C" {
extern int32_t qsetmode;
extern int16_t searchsector, searchwall, searchstat;
extern int16_t searchbottomwall;
extern int32_t zmode, kensplayerheight;
extern int32_t zmode, kensplayerheight, zlock;
#define DEFAULT_SPRITE_CSTAT 0
//extern int16_t defaultspritecstat;

File diff suppressed because it is too large Load Diff

View File

@ -59,8 +59,8 @@ extern int16_t brightness;
extern int32_t vsync;
extern char game_executable[BMAX_PATH];
extern int32_t fullscreen;
extern char option[9];
extern char keys[NUMBUILDKEYS];
extern char default_buildkeys[NUMBUILDKEYS];
static char *const keys = default_buildkeys;
extern char remap[256];
extern int32_t remapinit;
extern double msens;
@ -134,8 +134,8 @@ int32_t loadsetup(const char *fn)
if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val);
if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val);
// if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
// if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
// if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
if (readconfig(fp, "vsync", val, VL) > 0) vsync = Batoi(val)?1:0;
if (readconfig(fp, "editorgridextent", val, VL) > 0) editorgridextent = max(min(262144,Batoi(val)),32768);
@ -187,10 +187,10 @@ int32_t loadsetup(const char *fn)
if (readconfig(fp, "gameexecutable", val, VL) > 0)
Bstrcpy(game_executable, val);
option[0] = 1; // vesa all the way...
option[1] = 1; // sound all the way...
option[4] = 0; // no multiplayer
option[5] = 0;
// option[0] = 1; // vesa all the way...
// option[1] = 1; // sound all the way...
// option[4] = 0; // no multiplayer
// option[5] = 0;
#if 1
if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
@ -393,11 +393,6 @@ int32_t writesetup(const char *fn)
"music = %d\n"
"\n"
#endif
"; Enable mouse\n"
"; 0 - No\n"
"; 1 - Yes\n"
"mouse = %d\n"
"\n"
"; Mouse sensitivity\n"
"mousesensitivity = %g\n"
"\n"
@ -525,7 +520,7 @@ int32_t writesetup(const char *fn)
#if 0
option[7]>>4, option[2],
#endif
option[3], msens, unrealedlook, pk_uedaccel, quickmapcycling,
msens, unrealedlook, pk_uedaccel, quickmapcycling,
sideview_reversehrot,
revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave,autocorruptcheck,
showheightindicators,showambiencesounds,graphicsmode,

View File

@ -808,20 +808,22 @@ void getvalidmodes(void)
validmodecnt=0;
// initprintf("Detecting video modes:\n");
#define ADDMODE(x,y,c,f) if (validmodecnt<MAXVALIDMODES) { \
int32_t mn; \
for(mn=0;mn<validmodecnt;mn++) \
if (validmode[mn].xdim==x && validmode[mn].ydim==y && \
validmode[mn].bpp==c && validmode[mn].fs==f) break; \
if (mn==validmodecnt) { \
validmode[validmodecnt].xdim=x; \
validmode[validmodecnt].ydim=y; \
validmode[validmodecnt].bpp=c; \
validmode[validmodecnt].fs=f; \
validmodecnt++; \
/*initprintf(" - %dx%d %d-bit %s\n", x, y, c, (f&1)?"fullscreen":"windowed");*/ \
#define ADDMODE(x,y,c,f) do { \
if (validmodecnt<MAXVALIDMODES) { \
int32_t mn; \
for(mn=0;mn<validmodecnt;mn++) \
if (validmode[mn].xdim==x && validmode[mn].ydim==y && \
validmode[mn].bpp==c && validmode[mn].fs==f) break; \
if (mn==validmodecnt) { \
validmode[validmodecnt].xdim=x; \
validmode[validmodecnt].ydim=y; \
validmode[validmodecnt].bpp=c; \
validmode[validmodecnt].fs=f; \
validmodecnt++; \
/*initprintf(" - %dx%d %d-bit %s\n", x, y, c, (f&1)?"fullscreen":"windowed");*/ \
} \
} \
}
} while (0)
#define CHECK(w,h) if ((w < maxx) && (h < maxy))
@ -849,15 +851,15 @@ void getvalidmodes(void)
if (modes == (SDL_Rect **)-1)
{
for (i=0; defaultres[i][0]; i++)
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1)
}
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1);
}
else
{
for (i=0; modes[i]; i++)
{
if ((modes[i]->w > MAXXDIM) || (modes[i]->h > MAXYDIM)) continue;
ADDMODE(modes[i]->w, modes[i]->h, cdepths[j], 1)
ADDMODE(modes[i]->w, modes[i]->h, cdepths[j], 1);
if ((modes[i]->w > maxx) && (modes[i]->h > maxy))
{
@ -883,7 +885,7 @@ void getvalidmodes(void)
if (cdepths[j] < 0) continue;
for (i=0; defaultres[i][0]; i++)
CHECK(defaultres[i][0],defaultres[i][1])
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0)
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0);
}
#undef CHECK

View File

@ -998,14 +998,22 @@ defstate js // jump to current sprite
updatecursectnum
ends
defstate jumptosec // (tmp)
ifge tmp 0 ifl tmp numsectors nullop else return
set j sector[tmp].wallptr
set posx wall[j].x
set posy wall[j].y
var sec 0 0
var wal 0 0
defstate jumptowal // (wal)
ifge wal 0 ifl wal numwalls nullop else return
set posx wall[wal].x
set posy wall[wal].y
updatecursectnum
ends
defstate jumptosec // (sec)
ifge sec 0 ifl sec numsectors nullop else return
set wal sector[sec].wallptr
state jumptowal
ends
onevent EVENT_DRAW2DSCREEN
var tmp

View File

@ -4898,11 +4898,19 @@ static void Keys3d(void)
smooshyalign = keystatus[KEYSC_gKP5];
repeatpanalign = eitherSHIFT || eitherALT || (bstatus&2);
if (mlook == 2)
mlook = 0;
{
static int32_t omlook;
if (!unrealedlook && (bstatus&4))
mlook = 2;
if (mlook == 2)
{
mlook = omlook;
}
else if (!unrealedlook && (bstatus&4))
{
omlook = mlook;
mlook = 2;
}
}
// PK: no btn: wheel changes shade
if ((bstatus&(16|32) && !(bstatus&(1|2|4))) || keystatus[KEYSC_gMINUS] || keystatus[KEYSC_gPLUS])
@ -5613,7 +5621,8 @@ static void Keys3d(void)
int16_t ohitag = AIMED(hitag);
Bsprintf(tempbuf, "%s hitag: ", Typestr_wss[searchstat]);
AIMED(hitag) = getnumber256(tempbuf, ohitag, BTAG_MAX,0);
asksave |= (AIMED(hitag) != ohitag);
if (AIMED(hitag) != ohitag)
asksave = 1;
}
}
@ -5624,7 +5633,8 @@ static void Keys3d(void)
int8_t oshade = AIMED_CF_SEL(shade);
Bsprintf(tempbuf, "%s shade: ", Typestr[searchstat]);
getnumberptr256(tempbuf, &AIMED_CF_SEL(shade), sizeof(int8_t), 128, 1, NULL);
asksave |= (AIMED_CF_SEL(shade) != oshade);
if (AIMED_CF_SEL(shade) != oshade)
asksave = 1;
}
}
@ -5682,7 +5692,8 @@ static void Keys3d(void)
static const char *Typestr_tmp[5] = { "Wall", "Sector ceiling", "Sector floor", "Sprite", "Masked wall" };
Bsprintf(tempbuf, "%s picnum: ", Typestr_tmp[searchstat]);
getnumberptr256(tempbuf, &AIMED_CF_SEL(picnum), sizeof(int16_t), MAXTILES-1, 0, NULL);
asksave |= (opicnum != AIMED_CF_SEL(picnum));
if (opicnum != AIMED_CF_SEL(picnum))
asksave = 1;
if (aimspr)
correct_sprite_yoffset(searchwall);
@ -5954,7 +5965,7 @@ static void Keys3d(void)
mouseay=0;
}
if ((bstatus&1) && searchstat != SEARCH_CEILING && searchstat != SEARCH_FLOOR)
if ((bstatus&1) && !AIMING_AT_CEILING_OR_FLOOR)
{
if (eitherSHIFT)
{
@ -5963,7 +5974,7 @@ static void Keys3d(void)
{
mouseaction = 1;
mouseax += mousex;
updownunits = klabs((int32_t)(mouseax/2.));
updownunits = klabs(mouseax/2);
if (updownunits)
mouseax=0;
}
@ -6006,10 +6017,10 @@ static void Keys3d(void)
if (mouseaction)
{
i=wall[w].cstat;
i=((i>>3)&1)+((i>>7)&2);
i = wall[w].cstat;
i &= (8|256);
if (i==1||i==3)
if (i==8 || i==256)
changedir*=-1;
if (eitherCTRL)
@ -6546,7 +6557,7 @@ static void Keys3d(void)
if (ASSERT_AIMING)
{
Bsprintf(tempbuf, "%s pal: ", Typestr[searchstat]);
getnumberptr256(tempbuf, &AIMED_CF_SEL(pal) , sizeof(uint8_t), 255, 0, NULL);
getnumberptr256(tempbuf, &AIMED_CF_SEL(pal), sizeof(uint8_t), 255, 0, NULL);
asksave = 1;
}
}
@ -6899,9 +6910,6 @@ static void Keys2d(void)
{
Bsprintf(tempbuf,"Sector %d Extra: ",i);
sector[i].extra = getnumber16(tempbuf,sector[i].extra,BTAG_MAX,1);
// clearmidstatbar16();
// showsectordata(i, 0);
// break;
}
}
}
@ -7090,7 +7098,9 @@ static void Keys2d(void)
}
}
else if (wallsprite==0)
{
SearchSectors(tsign);
}
else if (wallsprite==1)
{
if ((tsign<0 && curwallnum>0) || (tsign>0 && curwallnum<numwalls))
@ -7125,9 +7135,7 @@ static void Keys2d(void)
{
if (autogrid)
{
grid = 0;
if (eitherSHIFT)
grid = 8;
grid = 8*eitherSHIFT;
autogrid = 0;
}
@ -7140,6 +7148,7 @@ static void Keys2d(void)
grid = 0;
}
}
if (autogrid)
printmessage16("Grid size: 9 (autosize)");
else if (!grid)
@ -7147,6 +7156,7 @@ static void Keys2d(void)
else
printmessage16("Grid size: %d (%d units)", grid, 2048>>grid);
}
if (autogrid)
{
grid = min(zoom+512, 65536);
@ -7333,7 +7343,7 @@ void ExtPreSaveMap(void)
startwall = sector[i].wallptr;
endwall = startwall + sector[i].wallnum;
for (j=startwall; j<endwall; j++)
checksectorpointer((int16_t)j,(int16_t)i);
checksectorpointer(j, i);
}
}
}
@ -7346,6 +7356,7 @@ static void G_ShowParameterHelp(void)
"-jDIR, -game_dir DIR\n\t\tAdds DIR to the file path stack\n"
"-check\t\tEnables map pointer checking when saving\n"
"-nocheck\t\tDisables map pointer checking when saving (default)\n" // kept for script compat
"-namesfile <filename>\t\tOverride NAMES.H\n"
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
"-setup\t\tDisplays the configuration dialog\n"
#endif
@ -7412,7 +7423,10 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
{
lengths = Bmalloc(argc*sizeof(int32_t));
for (j=1; j<argc; j++)
maxlen += (lengths[j] = Bstrlen(argv[j]));
{
lengths[j] = Bstrlen(argv[j]);
maxlen += lengths[j];
}
testplay_addparam = Bmalloc(maxlen+argc);
testplay_addparam[0] = 0;
@ -8116,7 +8130,7 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm)
return OSDCMD_OK;
OUTOFMEM:
OSD_Printf("OUT OF MEMORY!\n");
message("OUT OF MEMORY!\n");
return OSDCMD_OK;
}
@ -8236,6 +8250,7 @@ static int32_t registerosdcommands(void)
#define DUKEOSD
#ifdef DUKEOSD
#if 0
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
{
int32_t ac;
@ -8266,12 +8281,14 @@ void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade,
else x += tilesizx[ac];
}
}
#endif
static int32_t GetTime(void)
{
return totalclock;
}
#if 0
void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress)
{
int32_t ac;
@ -8292,6 +8309,7 @@ int32_t GAME_getrowheight(int32_t w)
{
return w>>3;
}
#endif
//#define BGTILE 311
//#define BGTILE 1156
@ -8334,7 +8352,8 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows)
ysiz = tilesizx[BORDTILE];
for (x=0; x<=tx2; x++)
rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,
BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
return;
}
@ -8355,7 +8374,7 @@ static void m32_osdsetfunctions()
*/
0,0,0,0,0,
GAME_clearbackground,
(int32_t( *)(void))GetTime,
/*(int32_t( *)(void))*/GetTime,
NULL
);
}
@ -9194,7 +9213,8 @@ int32_t ExtInit(void)
if (Bstrcmp(setupfilename, "mapster32.cfg"))
initprintf("Using config file '%s'.\n",setupfilename);
if (loadsetup(setupfilename) < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1;
if (loadsetup(setupfilename) < 0)
initprintf("Configuration file not found, using defaults.\n"), rv = 1;
if (glusetexcache == -1)
{
@ -9212,7 +9232,7 @@ int32_t ExtInit(void)
}
#endif
Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys
Bmemcpy(buildkeys, default_buildkeys, NUMBUILDKEYS); //Trick to make build use setup.dat keys
if (initengine())
{
@ -9225,7 +9245,6 @@ int32_t ExtInit(void)
kensplayerheight = 40; //32
zmode = 2;
zlock = kensplayerheight<<8;
// defaultspritecstat = 0;
ReadGamePalette();
// InitWater();
@ -10041,29 +10060,28 @@ void ExtCheckKeys(void)
}
}
if (asksave == 1 && (bstatus + lastbstatus) == 0 && mapstate)
if (asksave == 1)
asksave++;
else if (asksave == 2 && (bstatus + lastbstatus) == 0 && mapstate)
{
#if 0
int32_t i;
// check keys so that e.g. bunch deletions won't produce
// as much revisions
for (i=sizeof(keystatus)/sizeof(keystatus[0]) - 1; i>=0; i--)
// check keys so that e.g. bulk deletions won't produce
// as much revisions as deleted sprites
for (i=sizeof(keystatus)/sizeof(keystatus[0])-1; i>=0; i--)
if (keystatus[i])
break;
// message("Saved undo rev %d",map_revision);
if (i==-1)
#endif
{
create_map_snapshot();
asksave++;
}
}
else if (asksave == 2)
else if (asksave == 3)
asksave++;
if (totalclock > autosavetimer && autosave)
{
if (asksave == 3)
if (asksave == 4)
{
if (CheckMapCorruption(6, 0)>=4)
{
@ -10076,7 +10094,7 @@ void ExtCheckKeys(void)
message("Board autosaved to AUTOSAVE.MAP");
}
asksave = 4;
asksave++;
}
autosavetimer = totalclock+120*autosave;
}

View File

@ -60,7 +60,7 @@ static instype *x_sortingstateptr;
extern void message(const char *fmt, ...);
// from sector.c vvv
static int32_t ldist(spritetype *s1,spritetype *s2)
static int32_t ldist(const spritetype *s1, const spritetype *s2)
{
int32_t x= klabs(s1->x-s2->x);
int32_t y= klabs(s1->y-s2->y);
@ -73,7 +73,7 @@ static int32_t ldist(spritetype *s1,spritetype *s2)
}
}
static int32_t dist(spritetype *s1,spritetype *s2)
static int32_t dist(const spritetype *s1, const spritetype *s2)
{
int32_t x= klabs(s1->x-s2->x);
int32_t y= klabs(s1->y-s2->y);

View File

@ -37,8 +37,6 @@ extern char names[MAXTILES][25];
extern int32_t ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d;
extern int32_t zmode, kensplayerheight, zlock;
extern int16_t editstatus, searchit;
extern int32_t searchx, searchy, osearchx, osearchy; //search input
extern int16_t searchsector, searchwall, searchstat; //search output
@ -47,10 +45,10 @@ extern int16_t searchbottomwall;
#define COLOR_RED 248
#define COLOR_WHITE 31
#define NUMOPTIONS 9
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
//#define NUMOPTIONS 9
//char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
uint8_t keys[NUMBUILDKEYS] =
uint8_t default_buildkeys[NUMBUILDKEYS] =
{
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x47,0x49,