All pastes #962402 Raw Edit

Unnamed

public diff v1 · immutable
#962402 ·published 2008-03-29 19:12 UTC
rendered paste body
Index: lib/ivis_common/piestate.h===================================================================--- lib/ivis_common/piestate.h	(revision 4417)+++ lib/ivis_common/piestate.h	(working copy)@@ -128,7 +128,8 @@ extern void pie_SetTexturePage(SDWORD num); extern void pie_SetAlphaTest(BOOL keyingOn); extern void pie_SetRendMode(REND_MODE rendMode);-+//mouse+extern void pie_SetMouse(uint16_t cursor, uint16_t mouseX,uint16_t mouseY); extern void pie_SetTranslucencyMode(TRANSLUCENCY_MODE transMode);  #endif // _pieState_hIndex: lib/ivis_opengl/piestate.c===================================================================--- lib/ivis_opengl/piestate.c	(revision 4417)+++ lib/ivis_opengl/piestate.c	(working copy)@@ -30,13 +30,13 @@ #include "lib/ivis_common/piedef.h" #include "lib/ivis_common/tex.h" #include "lib/ivis_common/piepalette.h"-+#include "lib/ivis_common/rendmode.h" /*  *	Global Variables  */-+uint16_t  MouseCursorState = 0; extern RENDER_STATE	rendStates;-+extern IMAGEFILE *IntImages; /*  *	Source  */@@ -207,3 +207,14 @@ 	debug(LOG_VIDEO, "%s(%f)", __FUNCTION__, val); 	SDL_SetGamma(val, val, val); }+/***************************************************************************/+// pie_SetMouse()+// \param cursor --Holds the image we want to render+// \param mouseX, mouseY  --mouse coordinate+// Renders the imaged specified by cursor at the mouse coordinates specified+void pie_SetMouse(uint16_t cursor, uint16_t mouseX,uint16_t mouseY)+{+MouseCursorState = cursor ;+iV_DrawImage(IntImages,cursor,mouseX,mouseY);++}Index: src/configuration.c===================================================================--- src/configuration.c	(revision 4417)+++ src/configuration.c	(working copy)@@ -512,7 +512,14 @@ 		setWarzoneKeyNumeric("fullscreen", true); 		war_setFullscreen(true); 	}-+	if (getWarzoneKeyNumeric("HWCursor", &val))+	{+		war_SetHWcursor(val);+	}+	else+	{+		war_SetHWcursor(true);	//leave it true for default ??+	} 	if (getWarzoneKeyNumeric("trapCursor", &val)) 	{ 		war_SetTrapCursor(val);@@ -609,6 +616,7 @@ 	setWarzoneKeyNumeric("radarObjectMode",(SDWORD)bEnemyAllyRadarColor);    // enemy/allies radar view 	setWarzoneKeyNumeric("radarTerrainMode",(SDWORD)radarDrawMode); 	setWarzoneKeyNumeric("trapCursor", war_GetTrapCursor());+	setWarzoneKeyNumeric("HWCursor", war_GetHWcursor()); 	setWarzoneKeyNumeric("textureSize", getTextureSize());  	if(!bMultiPlayer)Index: src/display.c===================================================================--- src/display.c	(revision 4417)+++ src/display.c	(working copy)@@ -28,6 +28,7 @@ #include "lib/framework/frame.h" #include "lib/framework/input.h" #include "lib/framework/strres.h"+#include "lib/ivis_common/piestate.h"  #include "display.h" #include "map.h"@@ -161,7 +162,35 @@ {IDC_FIX,IDC_GUARD,IDC_LOCKON,IDC_GUARD,IDC_GUARD,IDC_GUARD,IDC_MOVE,IDC_MOVE, 	IDC_GUARD,IDC_NOTPOSSIBLE,IDC_NOTPOSSIBLE,IDC_DEST,IDC_MOVE}, };-+// Bring back the bitmap cursor support+UWORD MPointerImageIDs[]={+	IMAGE_CURSOR_DEST,	// IDC_DEST+	IMAGE_CURSOR_DEFAULT,	// IDC_SIGHT+	IMAGE_CURSOR_DEFAULT,	// IDC_TARGET+	IMAGE_CURSOR_DEFAULT,	// IDC_LARROW      +	IMAGE_CURSOR_DEFAULT,	// IDC_RARROW      +	IMAGE_CURSOR_DEFAULT,	// IDC_DARROW      +	IMAGE_CURSOR_DEFAULT,	// IDC_UARROW      +	IMAGE_CURSOR_DEFAULT,	// IDC_DEFAULT     +	IMAGE_CURSOR_DEFAULT,	// IDC_EDGEOFMAP   +	IMAGE_CURSOR_ATTACH,	// IDC_ATTACH      +	IMAGE_CURSOR_ATTACK,	// IDC_ATTACK      +	IMAGE_CURSOR_DEFAULT,	// IDC_BOMB        +	IMAGE_CURSOR_BRIDGE,	// IDC_BRIDGE      +	IMAGE_CURSOR_BUILD,		// IDC_BUILD       +	IMAGE_CURSOR_EMBARK,	// IDC_EMBARK      +	IMAGE_CURSOR_FIX,		// IDC_FIX         +	IMAGE_CURSOR_GUARD,		// IDC_GUARD       +	IMAGE_CURSOR_ECM,		// IDC_JAM         +	IMAGE_CURSOR_LOCKON,	// IDC_LOCKON      +	IMAGE_CURSOR_DEFAULT,	// IDC_MENU        +	IMAGE_CURSOR_MOVE,		// IDC_MOVE        +	IMAGE_CURSOR_NOTPOS,	// IDC_NOTPOSSIBLE +	IMAGE_CURSOR_PICKUP,	// IDC_PICKUP      +	IMAGE_CURSOR_REPAIR,	// IDC_SEEKREPAIR  +	IMAGE_CURSOR_SELECT,	// IDC_SELECT      +};+uint16_t cursor; /// acceleration on scrolling. Game Option. UDWORD	scroll_speed_accel; @@ -236,7 +265,7 @@ static BOOL bSensorAssigned; //used to determine if the player has selected a Las Sat structure static BOOL bLasSatStruct;-+extern BOOL war_GetHWcursor(void);		// used to find out if we want HW or software cursor // Local prototypes static MOUSE_TARGET	itemUnderMouse(BASE_OBJECT **ppObjUnderCursor); static BOOL	bShakingPermitted = true;@@ -726,8 +755,18 @@ 	MOUSE_TARGET	item=MT_NOTARGET; 	BOOL OverRadar = OverRadarAndNotDragging(); +	// Enable/disable mouse cursor based on if we are using colored bitmap ones or not.+	if (war_GetHWcursor())+	{+		SDL_ShowCursor(SDL_ENABLE);+	}+	else+	{+		SDL_ShowCursor(SDL_DISABLE);+	}+ 	// These four functions were embedded in this function but I moved them out for readability. In the-// absense of any comments I had a guess as to there use and named them accordingly PD 28/05/98.+	// absense of any comments I had a guess as to there use and named them accordingly PD 28/05/98. 	//ignoreOrder = CheckFinishedWallDrag(); - this name is misleading since called for all Structures AB 	ignoreOrder = CheckFinishedFindPosition(); @@ -931,8 +970,15 @@ 			{ 				item = MT_BLOCKING; 			}--			frameSetCursorFromRes((SWORD)arnMPointers[item][selection]);+			if (war_GetHWcursor())+			{+				frameSetCursorFromRes((SWORD)arnMPointers[item][selection]);+			}+			else+			{+				cursor = MPointerImageIDs[arnMPointers[item][selection]-IDC_DEST];+				pie_SetMouse(cursor,mouseX(),mouseY());+			} 		} 	} 	else@@ -947,17 +993,38 @@ 			if (item == MT_ENEMYDROID || item == MT_ENEMYSTR || item == MT_DAMFEATURE) 			{ 				//display attack cursor-				frameSetCursorFromRes(IDC_ATTACK);+				if (war_GetHWcursor())+				{+					frameSetCursorFromRes(IDC_ATTACK);+				}+				else+				{+					pie_SetMouse(IMAGE_CURSOR_ATTACK,mouseX(),mouseY());+				} 			} 			else 			{ 				//display block cursor-				frameSetCursorFromRes(IDC_NOTPOSSIBLE);+				if (war_GetHWcursor())+				{+					frameSetCursorFromRes(IDC_NOTPOSSIBLE);+				}+				else+				{+					pie_SetMouse(IMAGE_CURSOR_NOTPOS,mouseX(),mouseY());+				} 			} 		} 		else 		{-			frameSetCursorFromRes(IDC_DEFAULT);+			if (war_GetHWcursor())+			{+				frameSetCursorFromRes(IDC_DEFAULT);+			}+			else+			{+				pie_SetMouse(IMAGE_CURSOR_DEFAULT,mouseX(),mouseY());+			} 		} 	} Index: src/ingameop.c===================================================================--- src/ingameop.c	(revision 4417)+++ src/ingameop.c	(working copy)@@ -50,7 +50,7 @@ #include "mission.h" #include "transporter.h" #include "main.h"-+#include <SDL.h> //status bools.(for hci.h) BOOL	ClosingInGameOp	= false; BOOL	InGameOpUp		= false;@@ -276,7 +276,9 @@ 	intMode		= INT_INGAMEOP;			// change interface mode. 	InGameOpUp	= true;					// inform interface. -	// TODO: find out if the line below is needed (may be for old csnap stuff)+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+	SDL_ShowCursor(SDL_ENABLE); 	frameSetCursorFromRes(IDC_DEFAULT);						// reset cursor	(sw)  	return true;Index: src/init.c===================================================================--- src/init.c	(revision 4417)+++ src/init.c	(working copy)@@ -595,9 +595,11 @@ 	// clear out any existing mappings 	keyClearMappings(); 	keyInitMappings(false);+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+	SDL_ShowCursor(SDL_ENABLE);+	frameSetCursorFromRes(IDC_DEFAULT);		// reset cursor	(sw) -	frameSetCursorFromRes(IDC_DEFAULT);- 	SetFormAudioIDs(-1,ID_SOUND_WINDOWCLOSE);			// disable the open noise since distorted in 3dfx builds.  	initMiscVars();@@ -927,9 +929,11 @@ 	keyClearMappings(); 	keyInitMappings(false); 	LOADBARCALLBACK();	//	loadingScreenCallback();+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+	SDL_ShowCursor(SDL_ENABLE);+	frameSetCursorFromRes(IDC_DEFAULT);		// reset cursor	(sw) -	frameSetCursorFromRes(IDC_DEFAULT);- 	SetFormAudioIDs(ID_SOUND_WINDOWOPEN,ID_SOUND_WINDOWCLOSE);  	debug(LOG_MAIN, "stageTwoInitialise: done");Index: src/intelmap.c===================================================================--- src/intelmap.c	(revision 4417)+++ src/intelmap.c	(working copy)@@ -61,6 +61,7 @@ #include "lib/sound/cdaudio.h"  #include "scriptextern.h"+#include <SDL.h>  #define NO_VIDEO @@ -1480,7 +1481,11 @@ 	/* so we lied about definately not starting the intelligence screen */ 	addIntelScreen(); 	/* reset mouse cursor, since addIntelScreen() doesn't do that */-	frameSetCursorFromRes(IDC_DEFAULT);+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+	SDL_ShowCursor(SDL_ENABLE);+	frameSetCursorFromRes(IDC_DEFAULT);		// reset cursor	(sw)+ 	/* addIntelScreen() (via addIntelMap()) actually starts 	 * playing psCurrentMsg automatically */ 	return;Index: src/loop.c===================================================================--- src/loop.c	(revision 4417)+++ src/loop.c	(working copy)@@ -211,7 +211,11 @@ 						 && CoordInRadar(mouseX(), mouseY()) 						 && getHQExists(selectedPlayer) ) ) ) 			{-				frameSetCursorFromRes(IDC_DEFAULT);+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+				SDL_ShowCursor(SDL_ENABLE);+				frameSetCursorFromRes(IDC_DEFAULT);		// reset cursor	(sw)+ 				intRetVal = INT_INTERCEPT; 			} @@ -430,6 +434,10 @@ 	} 	else // paused 	{+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+		SDL_ShowCursor(SDL_ENABLE);+		frameSetCursorFromRes(IDC_DEFAULT);		// reset cursor	(sw) 		intRetVal = INT_NONE; 		if (loop_GetVideoStatus()) 		{Index: src/mission.c===================================================================--- src/mission.c	(revision 4417)+++ src/mission.c	(working copy)@@ -3206,7 +3206,10 @@  void intRunMissionResult(void) {-	frameSetCursorFromRes(IDC_DEFAULT);+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+	SDL_ShowCursor(SDL_ENABLE);+	frameSetCursorFromRes(IDC_DEFAULT);		// reset cursor	(sw)  	if(bLoadSaveUp) 	{Index: src/warzoneconfig.c===================================================================--- src/warzoneconfig.c	(revision 4417)+++ src/warzoneconfig.c	(working copy)@@ -51,6 +51,7 @@ 	BOOL		Fullscreen; 	BOOL		soundEnabled; 	BOOL		trapCursor;+	BOOL		HWCursor; 	UDWORD		width; 	UDWORD		height; } WARZONE_GLOBALS;@@ -105,7 +106,14 @@ BOOL war_getFullscreen(void) { 	return warGlobs.Fullscreen; }-+void war_SetHWcursor(BOOL b)+{+	warGlobs.HWCursor= b;+}+BOOL war_GetHWcursor(void)+{+	return warGlobs.HWCursor;+} void war_SetTrapCursor(BOOL b) { 	warGlobs.trapCursor = b;Index: src/warzoneconfig.h===================================================================--- src/warzoneconfig.h	(revision 4417)+++ src/warzoneconfig.h	(working copy)@@ -55,6 +55,8 @@ extern BOOL war_GetAllowSubtitles(void); extern void war_setFullscreen(BOOL); extern BOOL war_getFullscreen(void);+extern BOOL war_GetHWcursor(void);+extern void war_SetHWcursor(BOOL b); extern void war_SetTrapCursor(BOOL b); extern BOOL war_GetTrapCursor(void); extern void war_SetWidth(UDWORD width);Index: src/wrappers.c===================================================================--- src/wrappers.c	(revision 4417)+++ src/wrappers.c	(working copy)@@ -119,8 +119,11 @@ 		firstcall = false;  		changeTitleMode(TITLE);+	// We need to enable the SDL cursor here, since we don't (?) want to render+	// the software bitmap version.  Looks slightly better for menus and such.+	SDL_ShowCursor(SDL_ENABLE);+	frameSetCursorFromRes(IDC_DEFAULT);		// reset cursor	(sw) -		frameSetCursorFromRes(IDC_DEFAULT); // reset cursor (sw) 	}  	switch(titleMode) // run relevant title screen code.