Weapon sprite scaling, still needs a rotatespritescaled CON command

git-svn-id: https://svn.eduke32.com/eduke32@1090 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-10-05 11:51:59 +00:00
parent 8dc599fc28
commit ccafc41189
9 changed files with 101 additions and 42 deletions

View file

@ -249,6 +249,7 @@ void CONFIG_SetDefaults(void)
ud.display_bonus_screen = 1; ud.display_bonus_screen = 1;
ud.show_level_text = 1; ud.show_level_text = 1;
ud.configversion = 0; ud.configversion = 0;
ud.weaponscale = 100;
Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(ud.rtsname, "DUKE.RTS");
Bstrcpy(myname, "Duke"); Bstrcpy(myname, "Duke");
@ -782,6 +783,8 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation); SCRIPT_GetNumber(ud.config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponScale",&ud.weaponscale);
// weapon choices are defaulted in checkcommandline, which may override them // weapon choices are defaulted in checkcommandline, which may override them
if (!CommandWeaponChoice) if (!CommandWeaponChoice)
for (i=0;i<10;i++) for (i=0;i<10;i++)
@ -960,6 +963,8 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AltHud",ud.althud,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AltHud",ud.althud,false,false);
// SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false); // SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponScale",ud.weaponscale,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,false,false);
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,false,false);

View file

@ -404,7 +404,7 @@ typedef struct {
int runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125 int runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125
int democams,color,msgdisptime,statusbarmode; int democams,color,msgdisptime,statusbarmode;
int m_noexits,noexits,autovote,automsg,idplayers; int m_noexits,noexits,autovote,automsg,idplayers;
int team, viewbob, weaponsway, althud; int team, viewbob, weaponsway, althud, weaponscale;
int entered_name,screen_tilting,shadows,fta_on,executions,auto_run; int entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
int coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair; int coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;

View file

@ -232,12 +232,12 @@ static inline int sbarxr(int x)
return (((320l<<16) - scale(320l<<16,ud.statusbarscale,100)) >> 1) + scale(x<<16,ud.statusbarscale,100); return (((320l<<16) - scale(320l<<16,ud.statusbarscale,100)) >> 1) + scale(x<<16,ud.statusbarscale,100);
} }
static inline int sbary(int y) inline int sbary(int y)
{ {
return ((200l<<16) - scale(200l<<16,ud.statusbarscale,100) + scale(y<<16,ud.statusbarscale,100)); return ((200l<<16) - scale(200l<<16,ud.statusbarscale,100) + scale(y<<16,ud.statusbarscale,100));
} }
static inline int sbarsc(int sc) inline int sbarsc(int sc)
{ {
return scale(sc,ud.statusbarscale,100); return scale(sc,ud.statusbarscale,100);
} }

View file

@ -914,6 +914,7 @@ const memberlabel_t userdefslabels[]=
{ "althud", USERDEFS_ALTHUD, 0, 0 }, { "althud", USERDEFS_ALTHUD, 0, 0 },
{ "display_bonus_screen", USERDEFS_DISPLAY_BONUS_SCREEN, 0, 0 }, { "display_bonus_screen", USERDEFS_DISPLAY_BONUS_SCREEN, 0, 0 },
{ "show_level_text", USERDEFS_SHOW_LEVEL_TEXT, 0, 0 }, { "show_level_text", USERDEFS_SHOW_LEVEL_TEXT, 0, 0 },
{ "weaponscale", USERDEFS_WEAPONSCALE, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST { "", -1, 0, 0 } // END OF LIST
}; };

View file

@ -369,6 +369,7 @@ enum userdefslabels
USERDEFS_ALTHUD, USERDEFS_ALTHUD,
USERDEFS_DISPLAY_BONUS_SCREEN, USERDEFS_DISPLAY_BONUS_SCREEN,
USERDEFS_SHOW_LEVEL_TEXT, USERDEFS_SHOW_LEVEL_TEXT,
USERDEFS_WEAPONSCALE,
USERDEFS_END USERDEFS_END
}; };

View file

@ -886,6 +886,15 @@ void DoUserDef(int iSet, int lLabelID, int lVar2)
SetGameVarID(lVar2, ud.show_level_text, g_i, g_p); SetGameVarID(lVar2, ud.show_level_text, g_i, g_p);
return; return;
case USERDEFS_WEAPONSCALE:
if (iSet)
{
ud.weaponscale = lValue;
return;
}
SetGameVarID(lVar2, ud.weaponscale, g_i, g_p);
return;
default: default:
return; return;
} }

View file

@ -2724,6 +2724,7 @@ cheat_for_port_credits:
"-", "-",
"Screen size", "Screen size",
"Status bar size", "Status bar size",
"Weapon size",
"Show level stats", "Show level stats",
"-", "-",
"Allow walk with autorun", "Allow walk with autorun",
@ -2734,8 +2735,6 @@ cheat_for_port_credits:
"Show framerate", "Show framerate",
"Demo recording", "Demo recording",
"-", "-",
"-",
"-",
"More...", "More...",
NULL NULL
}; };
@ -2752,7 +2751,7 @@ cheat_for_port_credits:
io++; io++;
} }
onbar = (probey == 2 || probey == 3 || probey == 4); onbar = (probey >= 2 && probey <= 5);
x = probesm(c,yy+5,0,io); x = probesm(c,yy+5,0,io);
if (x == -1) if (x == -1)
@ -2825,21 +2824,33 @@ cheat_for_port_credits:
} }
break; break;
case 5: case 5:
{
int sbs, sbsl;
sbs = sbsl = ud.weaponscale-37;
barsm(d+8,yy+7, &sbs,4,x==io,MENUHIGHLIGHT(io),0);
if (x == io && sbs != sbsl)
{
sbs += 37;
ud.weaponscale = min(100,max(10,sbs));
}
}
break;
case 6:
if (x==io) ud.levelstats = 1-ud.levelstats; if (x==io) ud.levelstats = 1-ud.levelstats;
modval(0,1,(int *)&ud.levelstats,1,probey==io); modval(0,1,(int *)&ud.levelstats,1,probey==io);
mgametextpal(d,yy, ud.levelstats ? "Yes" : "No", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.levelstats ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break; break;
case 6: case 7:
if (x==io) ud.runkey_mode = 1-ud.runkey_mode; if (x==io) ud.runkey_mode = 1-ud.runkey_mode;
modval(0,1,(int *)&ud.runkey_mode,1,probey==io); modval(0,1,(int *)&ud.runkey_mode,1,probey==io);
mgametextpal(d,yy, ud.runkey_mode ? "No" : "Yes", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.runkey_mode ? "No" : "Yes", MENUHIGHLIGHT(io), 0);
break; break;
case 7: case 8:
if (x==io) ud.shadows = 1-ud.shadows; if (x==io) ud.shadows = 1-ud.shadows;
modval(0,1,(int *)&ud.shadows,1,probey==io); modval(0,1,(int *)&ud.shadows,1,probey==io);
mgametextpal(d,yy, ud.shadows ? "On" : "Off", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.shadows ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break; break;
case 8: case 9:
if (x==io) ud.screen_tilting = 1-ud.screen_tilting; if (x==io) ud.screen_tilting = 1-ud.screen_tilting;
#ifdef POLYMOST #ifdef POLYMOST
if (!ud.screen_tilting) setrollangle(0); if (!ud.screen_tilting) setrollangle(0);
@ -2847,12 +2858,12 @@ cheat_for_port_credits:
modval(0,1,(int *)&ud.screen_tilting,1,probey==io); modval(0,1,(int *)&ud.screen_tilting,1,probey==io);
mgametextpal(d,yy, ud.screen_tilting ? "On" : "Off", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.screen_tilting ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break; // original had a 'full' option break; // original had a 'full' option
case 9: case 10:
if (x==io) ud.tickrate = 1-ud.tickrate; if (x==io) ud.tickrate = 1-ud.tickrate;
modval(0,1,(int *)&ud.tickrate,1,probey==io); modval(0,1,(int *)&ud.tickrate,1,probey==io);
mgametextpal(d,yy, ud.tickrate ? "Yes" : "No", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.tickrate ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break; break;
case 10: case 11:
if (x==io) if (x==io)
{ {
enabled = !((g_player[myconnectindex].ps->gm&MODE_GAME) && ud.m_recstat != 1); enabled = !((g_player[myconnectindex].ps->gm&MODE_GAME) && ud.m_recstat != 1);
@ -2863,7 +2874,7 @@ cheat_for_port_credits:
enabled = 0; enabled = 0;
mgametextpal(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); mgametextpal(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; break;
case 11: case 12:
if (x==io) cmenu(201); if (x==io) cmenu(201);
break; break;
default: default:
@ -2930,7 +2941,7 @@ cheat_for_port_credits:
if (x == -1) if (x == -1)
{ {
cmenu(200); cmenu(200);
probey = 11; probey = 12;
break; break;
} }

View file

@ -497,6 +497,19 @@ static int osdcmd_setstatusbarscale(const osdfuncparm_t *parm)
return OSDCMD_OK; return OSDCMD_OK;
} }
static int osdcmd_setweaponscale(const osdfuncparm_t *parm)
{
if (parm->numparms == 0)
{
OSD_Printf("\"hud_weaponscale\" is \"%d\"\n", ud.weaponscale);
return OSDCMD_SHOWHELP;
}
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
ud.weaponscale = min(100,max(10,Batol(parm->parms[0])));
OSD_Printf("hud_weaponscale %d\n", ud.weaponscale);
return OSDCMD_OK;
}
static int osdcmd_spawn(const osdfuncparm_t *parm) static int osdcmd_spawn(const osdfuncparm_t *parm)
{ {
int x=0,y=0,z=0; int x=0,y=0,z=0;
@ -1442,6 +1455,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("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("hud_scale","hud_scale: changes the hud scale", osdcmd_setstatusbarscale); OSD_RegisterFunction("hud_scale","hud_scale: changes the hud scale", osdcmd_setstatusbarscale);
OSD_RegisterFunction("hud_weaponscale","hud_weaponscale: changes the weapon scale", osdcmd_setweaponscale);
OSD_RegisterFunction("crosshairscale","crosshairscale: changes the crosshair scale", osdcmd_setcrosshairscale); OSD_RegisterFunction("crosshairscale","crosshairscale: changes the crosshair scale", osdcmd_setcrosshairscale);
OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes crosshair color", osdcmd_crosshaircolor); OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes crosshair color", osdcmd_crosshaircolor);
OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu); OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);

View file

@ -2119,12 +2119,30 @@ static int animateaccess(int gs,int snum)
return 1; return 1;
} }
#define weapsc(sc) scale(sc,ud.weaponscale,100)
static void myospalscaled(int x, int y, int tilenum, int shade, int orientation, int p)
{
int a = 0;
int xoff = 240;
if (orientation&4)
{
a = 1024;
xoff = 80;
}
rotatesprite(weapsc((orientation&256)?x:(x<<16))+((xoff-weapsc(xoff))<<16),
weapsc((orientation&256)?y:(y<<16))+((200-weapsc(200))<<16),
weapsc(65536L),a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);
}
static void myospalw(int x, int y, int tilenum, int shade, int orientation, int p) static void myospalw(int x, int y, int tilenum, int shade, int orientation, int p)
{ {
if (!ud.drawweapon) if (!ud.drawweapon)
return; return;
else if (ud.drawweapon == 1) else if (ud.drawweapon == 1)
myospal(x,y,tilenum,shade,orientation,p); myospalscaled(x,y,tilenum,shade,orientation,p);
else if (ud.drawweapon == 2) else if (ud.drawweapon == 2)
{ {
switch (g_currentweapon) switch (g_currentweapon)