Added shadows as an option.

Alt-S (can be modified) to toggle.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@401 4a71c877-e1ca-e34f-864e-861f7616d084
master
Rodolphe Suescun 2006-02-28 14:04:59 +00:00
parent 1e7edf9fa2
commit aa3c7b4ff7
14 changed files with 63 additions and 10 deletions

View File

@ -205,6 +205,7 @@ extern void pie_DrawTile(PIEVERTEX *pv0, PIEVERTEX *pv1, PIEVERTEX *pv2, PIEVERT
void SetBSPObjectRot(SDWORD Yaw, SDWORD Pitch);
void pie_BeginLighting(float x, float y, float z);
void pie_EndLighting(void);
void pie_RemainingPasses(void);
void pie_CleanUp( void );

View File

@ -133,6 +133,7 @@ void DrawTriangleList(BSPPOLYID PolygonNumber);
/***************************************************************************/
static BOOL lighting = FALSE;
static BOOL shadows = FALSE;
void pie_BeginLighting(float x, float y, float z) {
float pos[4];
@ -155,9 +156,11 @@ void pie_BeginLighting(float x, float y, float z) {
glEnable(GL_LIGHT0);
//lighting = TRUE;
shadows = TRUE;
}
void pie_EndLighting(float x, float y, float z) {
void pie_EndLighting() {
shadows = FALSE;
lighting = FALSE;
}
@ -630,7 +633,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD s
frame = team;
}
if (drawing_interface) {
if (drawing_interface || !shadows) {
pie_Draw3DShape2(shape, frame, colour, specular, pieFlag, pieFlagData);
} else {
if (pieFlag & (pie_ADDITIVE | pie_TRANSLUCENT)) {

View File

@ -133,6 +133,8 @@ void pie_ScreenFlip(CLEAR_MODE clearMode) {
screenDoDumpToDiskIfRequired();
SDL_GL_SwapBuffers();
switch (clearMode) {
case CLEAR_OFF_AND_NO_BUFFER_DOWNLOAD:
break;
case CLEAR_BLACK:
default:
glDepthMask(GL_TRUE);

View File

@ -32,7 +32,7 @@ SDL_CD *cdAudio_dev;
extern BOOL openal_initialized;
#define NB_BUFFERS 6
#define NB_BUFFERS 16
#define BUFFER_SIZE (16384)
static BOOL music_initialized;
@ -44,7 +44,7 @@ enum { WZ_NONE,
WZ_OGG } music_file_format;
#ifndef WZ_NOMP3
#define MP3_BUFFER_SIZE (16384)
#define MP3_BUFFER_SIZE (8192)
static struct mad_stream mp3_stream;
static struct mad_frame mp3_frame;

View File

@ -123,6 +123,18 @@ BOOL loadConfig(BOOL bResourceAvailable)
setWarzoneKeyNumeric("shake", TRUE);
}
// //////////////////////////
// draw shadows
if(getWarzoneKeyNumeric("shadows", &val))
{
setDrawShadows(val);
}
else
{
setDrawShadows(TRUE);
setWarzoneKeyNumeric("shadows", TRUE);
}
// //////////////////////////
// invert mouse
if(getWarzoneKeyNumeric("mouseflip", &val))
@ -497,6 +509,7 @@ BOOL saveConfig()
setWarzoneKeyNumeric("visfog",(DWORD)(!war_GetFog())); // fogtype
setWarzoneKeyNumeric("shake",(DWORD)(getShakeStatus())); // screenshake
setWarzoneKeyNumeric("mouseflip",(DWORD)(getInvertMouseStatus())); // flipmouse
setWarzoneKeyNumeric("shadows",(DWORD)(getDrawShadows())); // shadows
setWarzoneKeyNumeric("sequences",(DWORD)(war_GetSeqMode())); // sequences
setWarzoneKeyNumeric("subtitles",(DWORD)(seq_GetSubtitles())); // subtitles
setWarzoneKeyNumeric("reopenBuild",(DWORD)(intGetReopenBuild())); // build menu

View File

@ -208,6 +208,7 @@ static BOOL anyDroidSelected(UDWORD player);
static BOOL cyborgDroidSelected(UDWORD player);
//static BOOL ctrlShiftDown(void);
static BOOL bInvertMouse = TRUE;
static BOOL bDrawShadows = TRUE;
//BOOL widgetsOn=TRUE; //FALSE;
//BOOL forceWidgetsOn = FALSE;
SELECTION_TYPE establishSelection(UDWORD selectedPlayer);
@ -324,6 +325,17 @@ void setInvertMouseStatus( BOOL val )
}
BOOL getDrawShadows( void )
{
return(bDrawShadows);
}
void setDrawShadows( BOOL val )
{
bDrawShadows = val;
}
void setShakeStatus( BOOL val )
{
bShakingPermitted = val;

View File

@ -49,7 +49,10 @@ extern void dealWithDroidSelect(DROID *psDroid, BOOL bDragBox);
extern BOOL buildingDamaged(STRUCTURE *psStructure);
extern void setInvertMouseStatus( BOOL val );
extern BOOL getInvertMouseStatus( void );
extern BOOL getInvertMouseStatus( void );
extern void setDrawShadows( BOOL val );
extern BOOL getDrawShadows( void );
extern BOOL getRadarJumpStatus( void );

View File

@ -786,7 +786,9 @@ void drawTiles(iView *camera, iView *player)
pie_TRANSLATE(-rx,-player->p.y,rz);
angle += 0.01;
// RODZ uncomment the following line to see an OpenGL lighting demo
pie_BeginLighting(50, -300, -300);
if (getDrawShadows()) {
pie_BeginLighting(50, -300, -300);
}
/* ---------------------------------------------------------------- */
/* Rotate and project all the tiles within the grid */
@ -1055,6 +1057,7 @@ void drawTiles(iView *camera, iView *player)
#ifdef BUCKET
bucketRenderCurrentList();
pie_RemainingPasses();
pie_EndLighting();
#endif
#ifdef ARROWS
arrowDrawAll();

View File

@ -2430,6 +2430,19 @@ void kf_ToggleShakeStatus( void )
setShakeStatus(TRUE);
}
}
// --------------------------------------------------------------------------
void kf_ToggleShadows( void )
{
if(getDrawShadows())
{
setDrawShadows(FALSE);
}
else
{
setDrawShadows(TRUE);
}
}
// --------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@ extern void kf_ToggleDistanceFog( void );
extern void kf_ToggleMistFog( void );
extern void kf_ToggleFogColour( void );
extern void kf_ToggleFog( void );
extern void kf_ToggleShadows( void );
extern void kf_ToggleCamera( void );
extern void kf_SimCloseDown( void );
extern void kf_ToggleGouraud( void );

View File

@ -68,7 +68,7 @@ BOOL saveKeyMap (void);
BOOL loadKeyMap (void);
static BOOL pushedKeyMap (UDWORD key);
char keymapVersion[8] = "KM_0001";
char keymapVersion[8] = "KM_0002";
extern char KeyMapPath[];
// ////////////////////////////////////////////////////////////////////////////

View File

@ -243,6 +243,7 @@ _keymapsave keyMapSaveTable[] =
kf_ToggleGodMode,
kf_EndMissionOffWorld,
kf_SystemClose,
kf_ToggleShadows,
//#endif
NULL // last function!
@ -388,6 +389,7 @@ void keyInitMappings( BOOL bForceDefaults )
keyAddMapping(KEYMAP_ALWAYS,KEY_IGNORE,KEY_Z,KEYMAP_PRESSED,kf_SensorDisplayOn, "Sensor display On");
keyAddMapping(KEYMAP_ALWAYS,KEY_IGNORE,KEY_Z,KEYMAP_RELEASED,kf_SensorDisplayOff, "Sensor display Off");
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_LALT,KEY_S,KEYMAP_PRESSED,kf_ToggleShadows, "Toggles shadows");
// Some extra non QWERTY mappings but functioning in same way
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,KEY_COMMA,KEYMAP_PRESSED,kf_SetDroidRetreatMedium, strresGetString(psStringRes,STR_BIND_LDAM) );

View File

@ -1 +1 @@
#define SVN_REVISION "Revision 41M"
#define SVN_REVISION "Revision 42M"

View File

@ -304,8 +304,7 @@ void loadingScreenCallback(void)
UDWORD currTick;
if(GetTickCount()-lastTick < 16) // cos 1000/60Hz gives roughly 16...:-)
{
if(GetTickCount()-lastTick < 16) {
return;
}
currTick = GetTickCount();
@ -361,6 +360,7 @@ void loadingScreenCallback(void)
DrawEnd();
pie_GlobalRenderEnd(TRUE);//force to black
pie_ScreenFlip(CLEAR_OFF_AND_NO_BUFFER_DOWNLOAD);//loading callback // dont clear.
audio_Update();
}