mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
mapster32 fixes: aiming crash in polymer, more accurate aiming in polymost + calibration/replacement crosshair via "r_preview_mouseaim", 2 other crashes; fix "S" in tile selector, make read-only variable overridable with "script_expertmode", misc. beautifying.
git-svn-id: https://svn.eduke32.com/eduke32@1706 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a7c95286c2
commit
fec84e6dbb
10 changed files with 131 additions and 65 deletions
|
@ -105,6 +105,7 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
|
|||
int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
|
||||
#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL)
|
||||
void printmessage256(int32_t x, int32_t y, const char *name);
|
||||
void message(const char *fmt, ...);
|
||||
|
||||
// currently only for 3d mode
|
||||
const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen);
|
||||
|
@ -171,4 +172,7 @@ extern int32_t scripthistend;
|
|||
}
|
||||
#endif
|
||||
|
||||
// showdebug is now used as a general informational on-screen display
|
||||
#define M32_SHOWDEBUG
|
||||
|
||||
#endif
|
||||
|
|
|
@ -320,26 +320,18 @@ extern char *defsfilename; // set in bstub.c
|
|||
|
||||
|
||||
#ifdef M32_SHOWDEBUG
|
||||
extern char m32_debugstr[64][128];
|
||||
extern int32_t m32_numdebuglines;
|
||||
char m32_debugstr[64][128];
|
||||
int32_t m32_numdebuglines=0;
|
||||
|
||||
static void M32_drawdebug(void)
|
||||
{
|
||||
int i;
|
||||
int x=4, y=8;
|
||||
char tstr[64];
|
||||
|
||||
static int inited = 0;
|
||||
if (!inited)
|
||||
{
|
||||
Bmemset(m32_debugstr, 0, sizeof(m32_debugstr));
|
||||
inited = 1;
|
||||
}
|
||||
|
||||
begindrawing();
|
||||
Bsprintf(tstr, "searchstat=%d, searchsector=%d, searchwall=%d",
|
||||
searchstat, searchsector, searchwall);
|
||||
printext256(x,y,whitecol,0,tstr,xdimgame>640?0:1);
|
||||
// Bsprintf(tstr, "searchstat=%d, searchsector=%d, searchwall=%d",
|
||||
// searchstat, searchsector, searchwall);
|
||||
// printext256(x,y,whitecol,0,tstr,xdimgame>640?0:1);
|
||||
for (i=0; i<m32_numdebuglines; i++)
|
||||
{
|
||||
y+=8;
|
||||
|
@ -364,13 +356,13 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
|
||||
wm_setapptitle("Mapster32");
|
||||
|
||||
editstatus = 1;
|
||||
if ((i = ExtPreInit(argc,argv)) < 0) return -1;
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
backgroundidle = 1;
|
||||
#endif
|
||||
|
||||
editstatus = 1;
|
||||
boardfilename[0] = 0;
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
|
@ -570,6 +562,12 @@ CANCEL:
|
|||
#endif
|
||||
|
||||
#ifdef M32_SHOWDEBUG
|
||||
if (searchstat>=0 && (searchwall<0 || searchsector<0))
|
||||
{
|
||||
Bsprintf(m32_debugstr[m32_numdebuglines++], "inconsistent search variables!");
|
||||
searchstat = -1;
|
||||
}
|
||||
|
||||
M32_drawdebug();
|
||||
#endif
|
||||
ExtCheckKeys();
|
||||
|
@ -1419,8 +1417,8 @@ void overheadeditor(void)
|
|||
osearchx = searchx;
|
||||
osearchy = searchy;
|
||||
|
||||
searchx = scale(searchx,xdim2d,xdimgame);
|
||||
searchy = scale(searchy,ydim2d-STATUS2DSIZ2,ydimgame);
|
||||
searchx = clamp(scale(searchx,xdim2d,xdimgame), 8, xdim2d-8-1);
|
||||
searchy = clamp(scale(searchy,ydim2d-STATUS2DSIZ2,ydimgame), 8, ydim2d-STATUS2DSIZ-8-1);
|
||||
oposz = pos.z;
|
||||
|
||||
begindrawing(); //{{{
|
||||
|
@ -4669,8 +4667,9 @@ CANCEL:
|
|||
setbrightness(GAMMA_CALC,palette,0);
|
||||
|
||||
pos.z = oposz;
|
||||
searchx = scale(searchx,xdimgame,xdim2d);
|
||||
searchy = scale(searchy,ydimgame,ydim2d-STATUS2DSIZ);
|
||||
|
||||
searchx = clamp(scale(searchx,xdimgame,xdim2d), 8, xdimgame-8-1);
|
||||
searchy = clamp(scale(searchy,ydimgame,ydim2d-STATUS2DSIZ), 8, ydimgame-8-1);
|
||||
|
||||
VM_OnEvent(EVENT_ENTER3DMODE, -1);
|
||||
}
|
||||
|
@ -6613,7 +6612,8 @@ void test_map(int32_t mode)
|
|||
else
|
||||
saveboard("autosave.map",&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
|
||||
_printmessage16("Board saved to AUTOSAVE.MAP. Starting the game...");
|
||||
message("Board saved to AUTOSAVE.MAP. Starting the game...");
|
||||
OSD_Printf("...as `%s'\n", fullparam);
|
||||
|
||||
showframe(1);
|
||||
uninitmouse();
|
||||
|
@ -6627,7 +6627,7 @@ void test_map(int32_t mode)
|
|||
si.cb = sizeof(si);
|
||||
|
||||
if (!CreateProcess(NULL,fullparam,NULL,NULL,0,0,NULL,NULL,&si,&pi))
|
||||
printmessage16("Error launching the game!");
|
||||
message("Error launching the game!");
|
||||
else WaitForSingleObject(pi.hProcess,INFINITE);
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -536,8 +536,11 @@ int16_t editstatus = 0;
|
|||
int16_t searchit;
|
||||
int32_t searchx = -1, searchy; //search input
|
||||
int16_t searchsector, searchwall, searchstat; //search output
|
||||
// nextwall if aiming at bottom w/ swapped walls, else searchwall; only valid for searchstat==0:
|
||||
|
||||
// if searchstat==0 (wall), searchbottomwall is ==.nextwall if aiming at
|
||||
// bottom of a wall with swapped walls (.cstat&2), else it's ==searchwall
|
||||
int16_t searchbottomwall;
|
||||
|
||||
double msens = 1.0;
|
||||
|
||||
static char artfilename[20];
|
||||
|
@ -9392,12 +9395,13 @@ void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum)
|
|||
walltype *wal;
|
||||
int32_t i, j, cz, fz;
|
||||
|
||||
getzsofslope(*sectnum, x, y, &cz, &fz);
|
||||
if ((z >= cz) && (z <= fz))
|
||||
if (inside(x,y,*sectnum) != 0) return;
|
||||
|
||||
if ((*sectnum >= 0) && (*sectnum < numsectors))
|
||||
{
|
||||
// this block used to be outside the "if" and caused crashes in Polymost Mapster32
|
||||
getzsofslope(*sectnum, x, y, &cz, &fz);
|
||||
if ((z >= cz) && (z <= fz))
|
||||
if (inside(x,y,*sectnum) != 0) return;
|
||||
|
||||
wal = &wall[sector[*sectnum].wallptr];
|
||||
j = sector[*sectnum].wallnum;
|
||||
do
|
||||
|
|
|
@ -981,6 +981,8 @@ void polymer_editorpick(void)
|
|||
case 4: // 1-way/masked wall
|
||||
searchsector = sectorofwall(num);
|
||||
searchbottomwall = searchwall = num;
|
||||
if (wall[num].nextwall>=0 && (wall[num].cstat&2))
|
||||
searchbottomwall = wall[num].nextwall;
|
||||
break;
|
||||
case 1: // floor
|
||||
case 2: // ceiling
|
||||
|
@ -2971,10 +2973,13 @@ static void polymer_drawwall(int16_t sectnum, int16_t wallnum)
|
|||
memcpy(oldcolor, w->wall.material.diffusemodulation, sizeof(GLubyte) * 4);
|
||||
|
||||
pickwallnum = wallnum;
|
||||
|
||||
// if the bottom of the walls are inverted
|
||||
// we're going to hit the nextwall instead
|
||||
if (wall[wallnum].cstat & 2)
|
||||
pickwallnum = wall[wallnum].nextwall;
|
||||
// PK -- handled in polymer_editorpick(), also because there
|
||||
// are maps with .nextwall==-1 but .cstat&2 (like e4l3)
|
||||
// if (wall[wallnum].cstat & 2)
|
||||
// pickwallnum = wall[wallnum].nextwall;
|
||||
|
||||
w->wall.material.diffusemodulation[0] = 0x00;
|
||||
w->wall.material.diffusemodulation[1] = ((GLubyte *)(&pickwallnum))[0];
|
||||
|
|
|
@ -119,6 +119,8 @@ double guo, gux, guy; //Screen-based texture mapping parameters
|
|||
double gvo, gvx, gvy;
|
||||
double gdo, gdx, gdy;
|
||||
|
||||
static int32_t preview_mouseaim=0; // when 1, displays a CROSSHAIR tsprite at the _real_ aimed position
|
||||
|
||||
#if (USEZBUFFER != 0)
|
||||
int32_t zbufysiz = 0, zbufbpl = 0, *zbufoff = 0;
|
||||
intptr_t zbufmem = 0;
|
||||
|
@ -199,6 +201,8 @@ static char ptempbuf[MAXWALLSB<<1];
|
|||
int32_t r_parallaxskyclamping = 1;
|
||||
int32_t r_parallaxskypanning = 0;
|
||||
|
||||
extern int16_t editstatus;
|
||||
|
||||
static inline int32_t imod(int32_t a, int32_t b)
|
||||
{
|
||||
if (a >= 0) return(a%b);
|
||||
|
@ -4204,7 +4208,9 @@ void polymost_drawrooms()
|
|||
{
|
||||
resizeglcheck();
|
||||
|
||||
//bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
if (editstatus)
|
||||
bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
bglDisable(GL_BLEND);
|
||||
bglEnable(GL_TEXTURE_2D);
|
||||
//bglTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); //default anyway
|
||||
|
@ -4355,7 +4361,7 @@ void polymost_drawrooms()
|
|||
|
||||
hitallsprites = 1;
|
||||
hitscan((const vec3_t *)&vect,globalcursectnum, //Start position
|
||||
vx>>12,vy>>12,vz>>8,&hitinfo,0xffff0030);
|
||||
vx>>10,vy>>10,vz>>6,&hitinfo,0xffff0030);
|
||||
|
||||
if (hitinfo.hitsect != -1) // if hitsect is -1, hitscan overflowed somewhere
|
||||
{
|
||||
|
@ -4388,6 +4394,22 @@ void polymost_drawrooms()
|
|||
//if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/
|
||||
}
|
||||
|
||||
if (preview_mouseaim && spritesortcnt < MAXSPRITESONSCREEN)
|
||||
{
|
||||
spritetype *tsp = &tsprite[spritesortcnt];
|
||||
double dadist, x,y,z;
|
||||
Bmemcpy(tsp, &hitinfo.pos, sizeof(vec3_t));
|
||||
x = tsp->x-globalposx; y=tsp->y-globalposy; z=(tsp->z-globalposz)/16.0;
|
||||
dadist = sqrt(x*x + y*y + z*z);
|
||||
tsp->sectnum = hitinfo.hitsect;
|
||||
tsp->picnum = 2523; // CROSSHAIR
|
||||
tsp->cstat = 128;
|
||||
tsp->owner = MAXSPRITES-1;
|
||||
tsp->xrepeat = tsp->yrepeat = min(max(1, (int32_t)(dadist*48.0/3200.0)), 255);
|
||||
sprite[tsp->owner].xoffset = sprite[tsp->owner].yoffset = 0;
|
||||
tspriteptr[spritesortcnt++] = tsp;
|
||||
}
|
||||
|
||||
if ((searchstat==1 || searchstat==2) && searchsector>=0)
|
||||
{
|
||||
int32_t scrv[2] = {(vx>>12), (vy>>12)};
|
||||
|
@ -6182,6 +6204,8 @@ void polymost_initosdfuncs(void)
|
|||
|
||||
{ "r_models","r_models: enable/disable model rendering",(void *)&usemodels, CVAR_BOOL, 0, 1 },
|
||||
{ "r_hightile","r_hightile: enable/disable hightile texture rendering",(void *)&usehightile, CVAR_BOOL, 0, 1 },
|
||||
|
||||
{ "r_preview_mouseaim", "r_preview_mouseaim: toggles mouse aiming preview, use this to calibrate yxaspect in Polymost Mapster32", (void *)&preview_mouseaim, CVAR_BOOL, 0, 1 },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -434,6 +434,8 @@ RIGHT smooth scrolling
|
|||
Hi=unique per train
|
||||
SE 6: SUBWAY FRONT CAR
|
||||
Ang: direction of first movement
|
||||
GPSPEED:
|
||||
Lo: speed (default: 256)
|
||||
SE 14: SUBWAY PULLED CARS
|
||||
Locators:
|
||||
starting with Lo=0, ascending
|
||||
|
|
|
@ -20,9 +20,15 @@ define MAXSPECULARFACTOR 1000
|
|||
define SPOWERSTEPS 100
|
||||
define SFACTORSTEPS 100
|
||||
|
||||
// settings for various drawing enhancements
|
||||
// color of various drawing enhancements
|
||||
define PREVIEW_DRAW_COLOR 11
|
||||
|
||||
// whether to use overridden aspect/range values when entering 3d mode (software/Polymost).
|
||||
// tweak with keys 7,8,9,0 on the top row
|
||||
gamevar use_custom_aspect 0 0
|
||||
gamevar davr 65536 0
|
||||
gamevar dayx 65536 0
|
||||
|
||||
////////// END USER SETTINGS //////////
|
||||
|
||||
|
||||
|
@ -48,9 +54,6 @@ gamevar dang 0 0
|
|||
gamevar tmp 0 0
|
||||
gamevar cnt 0 0
|
||||
|
||||
gamevar davr 65536 0
|
||||
gamevar dayx 65536 0
|
||||
|
||||
gamevar drawcol 9 0
|
||||
|
||||
|
||||
|
@ -425,14 +428,15 @@ endevent
|
|||
|
||||
|
||||
defstate setas
|
||||
set j dayx
|
||||
mul j ydim mul j 8
|
||||
div j xdim div j 5
|
||||
setaspect davr j
|
||||
// set j dayx
|
||||
// mul j ydim mul j 8
|
||||
// div j xdim div j 5
|
||||
setaspect davr dayx
|
||||
ends
|
||||
|
||||
onevent EVENT_ENTER3DMODE
|
||||
state setas
|
||||
ifn use_custom_aspect 0
|
||||
state setas
|
||||
endevent
|
||||
|
||||
|
||||
|
@ -695,6 +699,7 @@ ends
|
|||
// same as above but with tsprite[], as a kind of preview
|
||||
defstate tduprot
|
||||
ifaimingsprite nullop else return
|
||||
ifl searchwall 0 return
|
||||
ifn sprite[searchwall].extra DUP_ROT_MAGIC return
|
||||
|
||||
set p searchwall // pivot sprite
|
||||
|
@ -927,14 +932,36 @@ onevent EVENT_KEYS3D
|
|||
}
|
||||
}
|
||||
|
||||
ifholdkey KEY_0
|
||||
// ife 0 1
|
||||
|
||||
set j 0
|
||||
|
||||
set k 0
|
||||
ifholdkey KEY_7 set k -1
|
||||
ifholdkey KEY_0 set k 1
|
||||
ifn k 0
|
||||
{
|
||||
ifeithershift sub davr 512 else add davr 512
|
||||
set j 1
|
||||
ifeithershift nullop else mul k 256
|
||||
add davr k
|
||||
ifl davr 32768 set davr 32768
|
||||
ifg davr 256000 set davr 256000
|
||||
setaspect davr yxaspect
|
||||
qsprintf TQUOTE "ASPECT: VR=%d, YX=%d" davr yxaspect
|
||||
}
|
||||
|
||||
set k 0
|
||||
ifholdkey KEY_8 set k -1
|
||||
ifholdkey KEY_9 set k 1
|
||||
ifn k 0
|
||||
{
|
||||
set j 1
|
||||
ifeithershift nullop else mul k 256
|
||||
add dayx k
|
||||
ifl dayx 32768 set dayx 32768
|
||||
ifg dayx 256000 set dayx 256000
|
||||
}
|
||||
ife j 1
|
||||
{
|
||||
setaspect davr dayx
|
||||
qsprintf TQUOTE "ASPECT: VR=%d, YX=%d" davr dayx
|
||||
quote TQUOTE
|
||||
}
|
||||
endevent
|
||||
|
|
|
@ -3097,22 +3097,19 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
|
||||
if (searchstr && searchstr[0])
|
||||
{
|
||||
int32_t i, i0;
|
||||
int32_t i, i0, slen=Bstrlen(searchstr)-1;
|
||||
|
||||
Bstrcpy(laststr, searchstr);
|
||||
i0 = localartlookup[iTile];
|
||||
|
||||
if (searchstr[0]=='^')
|
||||
{
|
||||
for (i=(i0+1)%MAXTILES; i!=i0; i=(i+1)%MAXTILES)
|
||||
if ((searchstr[0]=='^' && !Bstrcmp(names[i], searchstr+1)) ||
|
||||
(searchstr[0]!='^' && strstr(names[i], searchstr)))
|
||||
{
|
||||
SelectAllTiles(iTile);
|
||||
iTile = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i=(i0+1)%MAXTILES; i!=i0; i=(i+1)%MAXTILES)
|
||||
if ((searchstr[0]=='^' && !Bstrncmp(names[i], searchstr+1, slen)) ||
|
||||
(searchstr[0]!='^' && strstr(names[i], searchstr)))
|
||||
{
|
||||
SelectAllTiles(i);
|
||||
iTile = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3731,7 +3728,8 @@ void drawtileinfo(char *title,int32_t x,int32_t y,int32_t picnum,int32_t shade,i
|
|||
scale /= (max(tilesizx[picnum],tilesizy[picnum])/24.0);
|
||||
|
||||
setaspect(65536L, (int32_t)divscale16(ydim*320L,xdim*200L));
|
||||
rotatesprite((x1+13)<<16,(y+11)<<16,scale,0,picnum,shade,pal,2,0L,0L,xdim-1L,ydim-1L);
|
||||
// +1024: prevents rotatesprite from setting aspect itself
|
||||
rotatesprite((x1+13)<<16,(y+11)<<16,scale,0, picnum,shade,pal, 2+1024, 0,0,xdim-1,ydim-1);
|
||||
setaspect(oviewingrange, oyxaspect);
|
||||
|
||||
x *= xdimgame/320.0;
|
||||
|
@ -4692,7 +4690,7 @@ static void Keys3d(void)
|
|||
|
||||
tsign = 0;
|
||||
tsign -= PRESSED_KEYSC(COMMA);
|
||||
tsign += PRESSED_KEYSC(PERIOD);;
|
||||
tsign += PRESSED_KEYSC(PERIOD);
|
||||
|
||||
if (tsign) // , . Search & fix panning to the left/right (3D)
|
||||
{
|
||||
|
@ -5646,7 +5644,7 @@ static void Keys3d(void)
|
|||
if (PRESSED_KEYSC(F2)) // F2
|
||||
{
|
||||
if (eitherCTRL || eitherSHIFT)
|
||||
infobox ^= (eitherSHIFT | (eitherCTRL<<2));
|
||||
infobox ^= (eitherSHIFT | ((eitherCTRL)<<1));
|
||||
else
|
||||
usedcount = !usedcount;
|
||||
}
|
||||
|
@ -6744,7 +6742,10 @@ static void Keys2d(void)
|
|||
ocursectornum = cursectornum;
|
||||
*/
|
||||
|
||||
if (counter >= 2 && totalclock >= 120*6)
|
||||
|
||||
if (totalclock < lastpm16time + 120*2)
|
||||
_printmessage16(lastpm16buf);
|
||||
else if (counter >= 2 && totalclock >= 120*6)
|
||||
{
|
||||
if (pointhighlight >= 16384)
|
||||
{
|
||||
|
@ -6759,9 +6760,6 @@ static void Keys2d(void)
|
|||
else if (cursectornum >= 0)
|
||||
showsectordata(cursectornum, 1);
|
||||
}
|
||||
|
||||
if (totalclock < lastpm16time + 120*2)
|
||||
_printmessage16(lastpm16buf);
|
||||
}
|
||||
|
||||
///__bigcomment__
|
||||
|
|
|
@ -1073,7 +1073,7 @@ static void C_GetNextVarType(int32_t type)
|
|||
}
|
||||
else if (id<MAXGAMEARRAYS) // simple (non-local) gamearrays
|
||||
{
|
||||
if ((aGameArrays[id].dwFlags & GAMEARRAY_READONLY) && (type&GV_WRITABLE))
|
||||
if (!m32_script_expertmode && (aGameArrays[id].dwFlags & GAMEARRAY_READONLY) && (type&GV_WRITABLE))
|
||||
{
|
||||
C_ReportError(ERROR_ARRAYREADONLY);
|
||||
g_numCompilerErrors++;
|
||||
|
@ -1215,6 +1215,8 @@ static void C_GetNextVarType(int32_t type)
|
|||
}
|
||||
else if (id<MAXGAMEVARS) // it's an ordinary var (not a local one)
|
||||
{
|
||||
if (m32_script_expertmode)
|
||||
type &= ~GV_WRITABLE;
|
||||
if (type==GV_WRITABLE && (aGameVars[id].dwFlags & GV_WRITABLE))
|
||||
{
|
||||
g_numCompilerErrors++;
|
||||
|
|
|
@ -2773,10 +2773,10 @@ dodefault:
|
|||
|
||||
// ifaimingsprite and -wall also work in 2d mode, but you must "and" with 16383 yourself
|
||||
case CON_IFAIMINGSPRITE:
|
||||
VM_DoConditional(AIMING_AT_SPRITE || pointhighlight>=16384);
|
||||
VM_DoConditional(AIMING_AT_SPRITE || (qsetmode!=200 && pointhighlight>=16384));
|
||||
continue;
|
||||
case CON_IFAIMINGWALL:
|
||||
VM_DoConditional(AIMING_AT_WALL_OR_MASK || linehighlight>=0);
|
||||
VM_DoConditional(AIMING_AT_WALL_OR_MASK || (qsetmode!=200 && linehighlight>=0));
|
||||
continue;
|
||||
case CON_IFAIMINGSECTOR:
|
||||
VM_DoConditional(AIMING_AT_CEILING_OR_FLOOR);
|
||||
|
|
Loading…
Reference in a new issue