git-svn-id: https://svn.eduke32.com/eduke32@881 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-07-21 09:05:53 +00:00
parent c3cc992d65
commit 86e70d3012
10 changed files with 117 additions and 32 deletions

View file

@ -132,9 +132,9 @@ int setpalette(int start, int num, char *dapal);
int setgamma(void);
double vid_gamma, vid_contrast, vid_brightness;
#define DEFAULT_GAMMA 1.2
#define DEFAULT_GAMMA 1.0
#define DEFAULT_CONTRAST 1.2
#define DEFAULT_BRIGHTNESS 0.0
#define DEFAULT_BRIGHTNESS 0.1
int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit

View file

@ -174,6 +174,9 @@ int r_animsmoothing = 1;
int r_parallaxskyclamping = 1;
int r_parallaxskypanning = 0;
// line of sight checks before mddraw()
int r_cullobstructedmodels = 0;
static float fogresult, fogcol[4];
// making this a macro should speed things up at the expense of code size
@ -4423,6 +4426,7 @@ void polymost_drawsprite(int snum)
int posx,posy;
int oldsizx, oldsizy;
int tsizx, tsizy;
short datempsectnum;
tspr = tspriteptr[snum];
if (tspr->owner < 0 || tspr->picnum < 0) return;
@ -4467,7 +4471,46 @@ void polymost_drawsprite(int snum)
{
if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0)
{
if (mddraw(tspr)) return;
if (r_cullobstructedmodels)
{
i = 0;
do // this is so gay
{
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x, tspr->y, tspr->z, tspr->sectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, globalposz+6144, globalcursectnum, tspr->x, tspr->y, tspr->z, tspr->sectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, globalposz-6144, globalcursectnum, tspr->x, tspr->y, tspr->z, tspr->sectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, sector[globalcursectnum].ceilingz, globalcursectnum, tspr->x, tspr->y, tspr->z, tspr->sectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, sector[globalcursectnum].floorz, globalcursectnum, tspr->x, tspr->y, tspr->z, tspr->sectnum))
{ i++; break; }
updatesector(tspr->x+384,tspr->y,&datempsectnum);
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x+384, tspr->y, sector[datempsectnum].ceilingz, datempsectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x+384, tspr->y, sector[datempsectnum].floorz, datempsectnum))
{ i++; break; }
updatesector(tspr->x-384,tspr->y,&datempsectnum);
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x-384, tspr->y, sector[datempsectnum].ceilingz, datempsectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x-384, tspr->y, sector[datempsectnum].floorz, datempsectnum))
{ i++; break; }
updatesector(tspr->x,tspr->y+384,&datempsectnum);
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x, tspr->y+384, sector[datempsectnum].ceilingz, datempsectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x, tspr->y+384, sector[datempsectnum].floorz, datempsectnum))
{ i++; break; }
updatesector(tspr->x,tspr->y-384,&datempsectnum);
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x, tspr->y-384, sector[datempsectnum].ceilingz, datempsectnum))
{ i++; break; }
if (cansee(globalposx, globalposy, globalposz, globalcursectnum, tspr->x, tspr->y-384, sector[datempsectnum].floorz, datempsectnum))
{ i++; break; }
break;
} while (1);
} else i = 1;
if (i && mddraw(tspr)) return;
break; // else, render as flat sprite
}
if (usevoxels && (tspr->cstat&48)!=48 && tiletovox[tspr->picnum] >= 0 && voxmodels[ tiletovox[tspr->picnum] ])
@ -5863,6 +5906,12 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
}
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_cullobstructedmodels"))
{
if (showval) { OSD_Printf("r_cullobstructedmodels is %d\n", r_cullobstructedmodels); }
else r_cullobstructedmodels = (val != 0);
return OSDCMD_OK;
}
#endif
return OSDCMD_SHOWHELP;
}
@ -5923,6 +5972,7 @@ void polymost_initosdfuncs(void)
OSD_RegisterFunction("r_animsmoothing","r_animsmoothing: enable/disable model animation smoothing",osdcmd_polymostvars);
OSD_RegisterFunction("r_parallaxskyclamping","r_parallaxskyclamping: enable/disable parallaxed floor/ceiling sky texture clamping",osdcmd_polymostvars);
OSD_RegisterFunction("r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky",osdcmd_polymostvars);
OSD_RegisterFunction("r_cullobstructedmodels","r_cullobstructedmodels: enable/disable hack to cull \"unseen\" models",osdcmd_polymostvars);
#endif
OSD_RegisterFunction("r_models","r_models: enable/disable model rendering in >8-bit mode",osdcmd_polymostvars);
OSD_RegisterFunction("r_hightile","r_hightile: enable/disable hightile texture rendering in >8-bit mode",osdcmd_polymostvars);

View file

@ -225,7 +225,8 @@ void CONFIG_SetDefaults(void)
ud.brightness = 8;
ud.camerasprite = -1;
ud.color = 0;
ud.crosshair = 2;
ud.crosshair = 1;
ud.crosshairscale = 50;
ud.deathmsgs = 1;
ud.democams = 1;
ud.detail = 1;
@ -705,6 +706,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup",&ud.config.ForceSetup);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Crosshairs",&ud.crosshair);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "CrosshairScale",&ud.crosshairscale);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",&ud.config.ShowOpponentWeapons);
@ -857,6 +859,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoVote",ud.autovote,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Color",ud.color,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Crosshairs",ud.crosshair,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "CrosshairScale",ud.crosshairscale,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DeathMessages",ud.deathmsgs,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoCams",ud.democams,false,false);
ud.executions++;

View file

@ -407,7 +407,7 @@ typedef struct {
typedef struct {
int const_visibility,uw_framerate;
int camera_time,folfvel,folavel,folx,foly,fola;
int reccnt;
int reccnt,crosshairscale;
int runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125
int democams,color,msgdisptime,statusbarmode;

View file

@ -3471,7 +3471,7 @@ void displayrest(int smoothratio)
SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
OnEvent(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, -1);
if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
rotatesprite((160L-(g_player[myconnectindex].ps->look_ang>>1))<<16,100L<<16,ud.crosshair>1?65536L>>(ud.crosshair-1):65536L,0,CROSSHAIR,0,0,2+1,windowx1,windowy1,windowx2,windowy2);
rotatesprite((160L-(g_player[myconnectindex].ps->look_ang>>1))<<16,100L<<16,scale(65536,ud.crosshairscale,100),0,CROSSHAIR,0,0,2+1,windowx1,windowy1,windowx2,windowy2);
}
#if 0
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
@ -7823,12 +7823,12 @@ static void nonsharedkeys(void)
if (BUTTON(gamefunc_Toggle_Crosshair))
{
CONTROL_ClearButton(gamefunc_Toggle_Crosshair);
ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1;
ud.crosshair = !ud.crosshair;
if (ud.crosshair)
{
int size[] = { 100, 50, 25 };
Bsprintf(fta_quotes[122],"%s [%d%%]",fta_quotes[20],size[ud.crosshair-1]);
FTA(122,g_player[screenpeek].ps);
// Bsprintf(fta_quotes[122],"%s [%d%%]",fta_quotes[20],size[ud.crosshair-1]);
// FTA(122,g_player[screenpeek].ps);
FTA(20,g_player[screenpeek].ps);
}
else FTA(21,g_player[screenpeek].ps);
}

View file

@ -874,6 +874,7 @@ const memberlabel_t userdefslabels[]=
{ "angleinterpolation", USERDEFS_ANGLEINTERPOLATION, 0, 0 },
{ "deathmsgs", USERDEFS_DEATHMSGS, 0, 0 },
{ "levelstats", USERDEFS_LEVELSTATS, 0, 0 },
{ "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST
};

View file

@ -341,7 +341,8 @@ enum userdefslabels
USERDEFS_WEAPONSWAY,
USERDEFS_ANGLEINTERPOLATION,
USERDEFS_DEATHMSGS,
USERDEFS_LEVELSTATS
USERDEFS_LEVELSTATS,
USERDEFS_CROSSHAIRSCALE
};
enum sectorlabels

View file

@ -865,6 +865,15 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2)
SetGameVarID(lVar2, ud.levelstats, g_i, g_p);
return;
case USERDEFS_CROSSHAIRSCALE:
if (iSet)
{
ud.crosshairscale = lValue;
return;
}
SetGameVarID(lVar2, ud.crosshairscale, g_i, g_p);
return;
default:
return;
}

View file

@ -2638,10 +2638,11 @@ cheat_for_port_credits:
char *opts[] =
{
"Show crosshair",
"Show level stats",
"Crosshair size",
"-",
"Screen size",
"Status bar size",
"Show level stats",
"-",
"Allow walk with autorun",
"-",
@ -2654,8 +2655,6 @@ cheat_for_port_credits:
"-",
"-",
"-",
"-",
"-",
"More...",
NULL
};
@ -2672,7 +2671,7 @@ cheat_for_port_credits:
io++;
}
onbar = (probey == 2 || probey == 3);
onbar = (probey == 1 || probey == 2 || probey == 3);
x = probesm(c,yy+5,0,io);
if (x == -1)
@ -2693,18 +2692,19 @@ cheat_for_port_credits:
switch (io)
{
case 0:
if (x==io) ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1;
modval(0,3,(int *)&ud.crosshair,1,probey==io);
if (x==io) ud.crosshair = !ud.crosshair;
modval(0,1,(int *)&ud.crosshair,1,probey==io);
{
char *s[] = { "OFF", "ON [100%]", "ON [50%]", "ON [25%]" };
gametextpal(d,yy,s[ud.crosshair], MENUHIGHLIGHT(io), 0);
gametextpal(d,yy,ud.crosshair?"Yes":"No", MENUHIGHLIGHT(io), 0);
break;
}
case 1:
if (x==io) ud.levelstats = 1-ud.levelstats;
modval(0,1,(int *)&ud.levelstats,1,probey==io);
gametextpal(d,yy, ud.levelstats ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
{
int sbs = ud.crosshairscale;
_bar(1,d+8,yy+7, &sbs,15,x==io,MENUHIGHLIGHT(io),0,25,100);
ud.crosshairscale = min(100,max(10,sbs));
}
break;
case 2:
{
int i;
@ -2739,33 +2739,38 @@ cheat_for_port_credits:
}
break;
case 4:
if (x==io) ud.levelstats = 1-ud.levelstats;
modval(0,1,(int *)&ud.levelstats,1,probey==io);
gametextpal(d,yy, ud.levelstats ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
case 5:
if (x==io) ud.runkey_mode = 1-ud.runkey_mode;
modval(0,1,(int *)&ud.runkey_mode,1,probey==io);
gametextpal(d,yy, ud.runkey_mode ? "No" : "Yes", MENUHIGHLIGHT(io), 0);
break;
case 5:
case 6:
if (x==io) ud.shadows = 1-ud.shadows;
modval(0,1,(int *)&ud.shadows,1,probey==io);
gametextpal(d,yy, ud.shadows ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
case 6:
case 7:
if (x==io) ud.screen_tilting = 1-ud.screen_tilting;
if (!ud.screen_tilting)setrollangle(0);
modval(0,1,(int *)&ud.screen_tilting,1,probey==io);
gametextpal(d,yy, ud.screen_tilting ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break; // original had a 'full' option
case 7:
case 8:
if (x==io) ud.showweapons = 1-ud.showweapons;
modval(0,1,(int *)&ud.showweapons,1,probey==io);
ud.config.ShowOpponentWeapons = ud.showweapons;
gametextpal(d,yy, ud.config.ShowOpponentWeapons ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
case 8:
case 9:
if (x==io) ud.democams = 1-ud.democams;
modval(0,1,(int *)&ud.democams,1,probey==io);
gametextpal(d,yy, ud.democams ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
case 9:
case 10:
if (x==io)
{
enabled = !((g_player[myconnectindex].ps->gm&MODE_GAME) && ud.m_recstat != 1);
@ -2776,7 +2781,7 @@ cheat_for_port_credits:
enabled = 0;
gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && g_player[myconnectindex].ps->gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1);
break;
case 10:
case 11:
if (x==io) cmenu(201);
break;
default:
@ -2846,7 +2851,7 @@ cheat_for_port_credits:
if (x == -1)
{
cmenu(200);
probey = 10;
probey = 11;
break;
}
@ -3839,6 +3844,7 @@ cheat_for_port_credits:
case 5:
case 6:
gametext(160,144+9+9,"DIGITAL AXES ARE NOT FOR MOUSE LOOK",0,2+8+16);
gametext(160,144+9+9+9,"OR FOR AIMING UP AND DOWN",0,2+8+16);
break;
}
@ -4387,7 +4393,7 @@ cheat_for_port_credits:
menutext(c,50+16+16+16+16,MENUHIGHLIGHT(4),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"DUKE TALK");
menutext(c,50+16+16+16+16+16,MENUHIGHLIGHT(5),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"AMBIENCE");
menutext(c,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"FLIP STEREO");
menutext(c,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"REVERSE STEREO");
{
char *s[] = { "OFF", "LOCAL", "ALL" };

View file

@ -631,7 +631,7 @@ static int osdcmd_cmenu(const osdfuncparm_t *parm)
cvarmappings cvar[] =
{
{ "crosshair", "crosshair: enable/disable crosshair", (void*)&ud.crosshair, CVAR_INT, 0, 0, 3 },
{ "crosshair", "crosshair: enable/disable crosshair", (void*)&ud.crosshair, CVAR_BOOL, 0, 0, 1 },
{ "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 0, 2 },
{ "cl_automsg", "cl_automsg: enable/disable automatically sending messages to all players", (void*)&ud.automsg, CVAR_BOOL, 0, 0, 1 },
@ -1273,6 +1273,20 @@ static int osdcmd_vid_contrast(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int osdcmd_setcrosshairscale(const osdfuncparm_t *parm)
{
if (parm->numparms == 0)
{
OSD_Printf("\"cl_crosshairscale\" is \"%d\"\n", ud.crosshairscale);
return OSDCMD_SHOWHELP;
}
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
ud.crosshairscale = min(100,max(10,Batol(parm->parms[0])));
OSD_Printf("cl_statusbarscale %d\n", ud.crosshairscale);
return OSDCMD_OK;
}
int registerosdcommands(void)
{
unsigned int i;
@ -1297,6 +1311,7 @@ int registerosdcommands(void)
OSD_RegisterFunction("bind","bind <key> <string>: associates a keypress with a string of console input. Type \"bind showkeys\" for a list of keys and \"listsymbols\" for a list of valid console commands.", osdcmd_bind);
OSD_RegisterFunction("cl_statusbarscale","cl_statusbarscale: changes the status bar scale", osdcmd_setstatusbarscale);
OSD_RegisterFunction("cl_crosshairscale","cl_crosshairscale: changes the crosshair scale", osdcmd_setcrosshairscale);
OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);
OSD_RegisterFunction("echo","echo [text]: echoes text to the console", osdcmd_echo);