[Scummvm-cvs-logs] CVS: scummvm/backends/epoc ScummApp.cpp,1.3,1.4 ScummApp.h,1.4,1.5 SymbianActions.cpp,1.4,1.5 SymbianActions.h,1.3,1.4 SymbianOS.cpp,1.5,1.6 SymbianOS.h,1.4,1.5 portdefs.h,1.5,1.6

Eugene Sandulenko sev at users.sourceforge.net
Sat Dec 3 06:35:01 CET 2005


Update of /cvsroot/scummvm/scummvm/backends/epoc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20945

Modified Files:
	ScummApp.cpp ScummApp.h SymbianActions.cpp SymbianActions.h 
	SymbianOS.cpp SymbianOS.h portdefs.h 
Log Message:
Fix code formatting to be compliant with our rules.
It may happen that I broke something since I have no means to compile it.
Also I changed EScummVM -> ScummVM is several places.


Index: ScummApp.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/epoc/ScummApp.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ScummApp.cpp	18 Oct 2005 01:30:11 -0000	1.3
+++ ScummApp.cpp	3 Dec 2005 14:34:45 -0000	1.4
@@ -21,9 +21,10 @@
  * $Header$
  */
 
-#include "ScummApp.h"
+#include "backends/epoc/ScummApp.h"
+
+#include "backends/epoc/ScummVM.hrh"
 
-#include "ScummVM.hrh"
 #ifdef __WINS__
 extern "C" int _chkstk(int /*a*/) {
 	return 1;
@@ -32,7 +33,7 @@
 
 #ifdef EPOC_AS_APP
 // this function is called by Symbian to deliver the new CApaApplication object
-EXPORT_C CApaApplication* NewApplication() {
+EXPORT_C CApaApplication *NewApplication() {
 	// Return pointer to newly created CQMApp
 	return (new CScummApp);
 }

Index: ScummApp.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/epoc/ScummApp.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ScummApp.h	18 Oct 2005 01:30:11 -0000	1.4
+++ ScummApp.h	3 Dec 2005 14:34:45 -0000	1.5
@@ -31,7 +31,7 @@
 #include "ECompXL.h"
 #endif
 
-class CScummApp:public CSDLApp {
+class CScummApp : public CSDLApp {
 public:
 	CScummApp();
 	~CScummApp();

Index: SymbianActions.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/epoc/SymbianActions.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- SymbianActions.cpp	18 Oct 2005 01:30:11 -0000	1.4
+++ SymbianActions.cpp	3 Dec 2005 14:34:45 -0000	1.5
@@ -19,8 +19,8 @@
  *
  */
 
-#include "stdafx.h"
-#include "SymbianActions.h"
+#include "common/stdafx.h"
+#include "backends/epoc/SymbianActions.h"
 
 #include "gui/message.h"
 #include "scumm/scumm.h"
@@ -83,11 +83,10 @@
 }
 
 SymbianActions::SymbianActions(GameDetector &detector) :
-	Actions(detector)
-{
+	Actions(detector) {
 	int i;
 
-	for (i=0; i<ACTION_LAST; i++) {
+	for (i = 0; i < ACTION_LAST; i++) {
 		_action_mapping[i] = ACTIONS_DEFAULT[i];
 		_action_enabled[i] = false;
 	}
@@ -136,17 +135,13 @@
 	// Save
 	if (is_simon || is_gob) 
 		_action_enabled[ACTION_SAVE] = false;
-	else
-	if (is_queen) {
+	else if (is_queen) {
 		_action_enabled[ACTION_SAVE] = true;
 		_key_action[ACTION_SAVE].setAscii(SDLK_F1); // F1 key for FOTAQ or F5??!?
-	}
-	else
-	if (is_sky) {
+	} else if (is_sky) {
 		_action_enabled[ACTION_SAVE] = true;
 		_key_action[ACTION_SAVE].setAscii(63); 
-	}
-	else {
+	} else {
 		_action_enabled[ACTION_SAVE] = true;
 		_key_action[ACTION_SAVE].setAscii(SDLK_F5); // F5 key
 	}
@@ -161,13 +156,13 @@
 	// FT Cheat
 	_action_enabled[ACTION_FT_CHEAT] = true;
 	_key_action[ACTION_FT_CHEAT].setAscii(86); // shift-V
+
 	// Skip text
-	_action_enabled[ACTION_SKIP_TEXT]=true;
+	_action_enabled[ACTION_SKIP_TEXT] = true;
 	if (is_queen) {
-	_key_action[ACTION_SKIP_TEXT].setAscii(SDLK_SPACE);
-	}
-	else {
-	_key_action[ACTION_SKIP_TEXT].setAscii(SDLK_PERIOD);
+		_key_action[ACTION_SKIP_TEXT].setAscii(SDLK_SPACE);
+	} else {
+		_key_action[ACTION_SKIP_TEXT].setAscii(SDLK_PERIOD);
 	}
 
 	// Pause

Index: SymbianActions.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/epoc/SymbianActions.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- SymbianActions.h	18 Oct 2005 01:30:11 -0000	1.3
+++ SymbianActions.h	3 Dec 2005 14:34:45 -0000	1.4
@@ -67,6 +67,7 @@
 	int version();
 
 	~SymbianActions();
+
 private:
 	SymbianActions(GameDetector &detector);
 	bool _right_click_needed;

Index: SymbianOS.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/epoc/SymbianOS.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- SymbianOS.cpp	18 Oct 2005 01:30:11 -0000	1.5
+++ SymbianOS.cpp	3 Dec 2005 14:34:45 -0000	1.6
@@ -21,11 +21,12 @@
  * $Header$
  */
 
-#include "SymbianOS.h"
-#include "SymbianActions.h"
-#include "Actions.h"
-#include "Key.h"
-#include "gui\message.h"
+#include "backends/epoc/SymbianOS.h"
+#include "backends/epoc/SymbianActions.h"
+#include "gui/Actions.h"
+#include "gui/Key.h"
+#include "gui/message.h"
+
 static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
 	{"1x", "Fullscreen", GFX_NORMAL},
 	{0, 0, 0}
@@ -36,7 +37,7 @@
 }
 
 
-#include "config-manager.h"
+#include "common/config-manager.h"
 
 extern Common::ConfigManager *g_config;
 
@@ -45,16 +46,18 @@
         { 0, 145, 150, 55 },
         { 150, 145, 170, 55 }
 };
-OSystem_SDL_Symbian::OSystem_SDL_Symbian() :_channels(0),_stereo_mix_buffer(0)
-{
+
+OSystem_SDL_Symbian::OSystem_SDL_Symbian() : _channels(0), _stereo_mix_buffer(0) {
 	ConfMan.set("FM_high_quality", false);
 	ConfMan.set("FM_medium_quality", true);
-	ConfMan.set("joystick_num",0); // Symbian OS  should have joystick_num set to 0 in the ini file , but uiq devices might refuse opening the joystick
+	ConfMan.set("joystick_num" ,0); // Symbian OS  should have joystick_num set to 0 in the ini file , but uiq devices might refuse opening the joystick
 	ConfMan.flushToDisk();
+
 	// Initialize global key mapping for Smartphones
-	GUI::Actions* actions = GUI::Actions::Instance();
+	GUI::Actions *actions = GUI::Actions::Instance();
 	actions->initInstanceMain(this);	
 	actions->loadMapping();
+
 	initZones();
 }
 
@@ -149,9 +152,8 @@
 	_channels = obtained.channels;
 
 	// Need to create mixbuffer for stereo mix to downmix
-	if(_channels != 2)
-	{
-		_stereo_mix_buffer = new byte [obtained.size*2];//*2 for stereo values
+	if(_channels != 2) {
+		_stereo_mix_buffer = new byte [obtained.size * 2]; // *2 for stereo values
 	}
 
 	SDL_PauseAudio(0);
@@ -162,7 +164,7 @@
  * The mixer callback function, passed on to OSystem::setSoundCallback().
  * This simply calls the mix() method.
  */
-void OSystem_SDL_Symbian::symbianMixCallback(void *s, byte *samples, int len){
+void OSystem_SDL_Symbian::symbianMixCallback(void *s, byte *samples, int len) {
 	static_cast <OSystem_SDL_Symbian*>(s)->symbianMix(samples,len);
 }
 
@@ -170,24 +172,20 @@
 /**
  * Actual mixing implementation
  */
-void OSystem_SDL_Symbian::symbianMix(byte *samples, int len){
-
-
+void OSystem_SDL_Symbian::symbianMix(byte *samples, int len) {
 	// If not stereo then we need to downmix
-	if(_channels != 2){
-	  	_sound_proc(_sound_proc_param,_stereo_mix_buffer,len*2);
-		int16* bitmixDst=(int16*)samples;
-		int16* bitmixSrc=(int16*)_stereo_mix_buffer;
+	if (_channels != 2) {
+	  	_sound_proc(_sound_proc_param, _stereo_mix_buffer, len * 2);
+		int16 *bitmixDst = (int16 *)samples;
+		int16 *bitmixSrc = (int16 *)_stereo_mix_buffer;
 
-		for(int loop=len/2;loop>=0;loop--){
-			*bitmixDst=(*bitmixSrc+*(bitmixSrc+1))>>1;
+		for (int loop = len / 2; loop >= 0; loop --) {
+			*bitmixDst = (*bitmixSrc + *(bitmixSrc + 1)) >> 1;
 			bitmixDst++;
-			bitmixSrc+=2;
+			bitmixSrc += 2;
 		}
-	}
-	else
-		_sound_proc(_sound_proc_param,samples,len);
-
+	} else
+		_sound_proc(_sound_proc_param, samples, len);
 }
 
 /**
@@ -196,85 +194,84 @@
  * @param ScumVM event to modify if special result is requested
  * @return true if Event has a valid return status
  */
-bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
-{
-	if(!GUI::Actions::Instance()->mappingActive() && ev.key.keysym.sym>SDLK_UNKNOWN)
-	for(TInt loop=0;loop<GUI::ACTION_LAST;loop++){
-		if(GUI::Actions::Instance()->getMapping(loop) ==ev.key.keysym.sym && 
-			GUI::Actions::Instance()->isEnabled(loop)){
-		// Create proper event instead
-		switch(loop)
-		{
+bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
+	if (GUI::Actions::Instance()->mappingActive() || ev.key.keysym.sym <= SDLK_UNKNOWN)
+		return false;
+
+	for (TInt loop = 0; loop < GUI::ACTION_LAST; loop++) {
+		if (GUI::Actions::Instance()->getMapping(loop) == ev.key.keysym.sym && 
+			GUI::Actions::Instance()->isEnabled(loop)) {
+			// Create proper event instead
+			switch(loop) {
 			case GUI::ACTION_UP:	
-				if(ev.type == SDL_KEYDOWN)
-				{
-				_km.y_vel =  -1;
-				_km.y_down_count = 1;
-				}
-				else
-				{
+				if (ev.type == SDL_KEYDOWN) {
+					_km.y_vel = -1;
+					_km.y_down_count = 1;
+				} else {
 					_km.y_vel = 0;
 					_km.y_down_count = 0;
 				}
 				event.type = EVENT_MOUSEMOVE;
 				fillMouseEvent(event, _km.x, _km.y);
+
 				return true;			
+
 			case GUI::ACTION_DOWN:
-				if(ev.type == SDL_KEYDOWN)
-				{
-				_km.y_vel =  1;
-				_km.y_down_count = 1;
-				}
-				else
-				{
+				if(ev.type == SDL_KEYDOWN) {
+					_km.y_vel = 1;
+					_km.y_down_count = 1;
+				} else {
 					_km.y_vel = 0;
 					_km.y_down_count = 0;
 				}
 				event.type = EVENT_MOUSEMOVE;
 				fillMouseEvent(event, _km.x, _km.y);
+
 				return true;	
+
 			case GUI::ACTION_LEFT:
-				if(ev.type == SDL_KEYDOWN)
-				{
-					_km.x_vel =  -1;
+				if(ev.type == SDL_KEYDOWN) {
+					_km.x_vel = -1;
 					_km.x_down_count = 1;
-				}
-				else
-				{
+				} else {
 					_km.x_vel = 0;
 					_km.x_down_count = 0;
 				}
 				event.type = EVENT_MOUSEMOVE;
 				fillMouseEvent(event, _km.x, _km.y);
+
 				return true;
+
 			case GUI::ACTION_RIGHT:
-				if(ev.type == SDL_KEYDOWN)
-				{
-					_km.x_vel =  1;
+				if(ev.type == SDL_KEYDOWN) {
+					_km.x_vel = 1;
 					_km.x_down_count = 1;
-				}
-				else
-				{
+				} else {
 					_km.x_vel = 0;
 					_km.x_down_count = 0;
 				}
 				event.type = EVENT_MOUSEMOVE;
 				fillMouseEvent(event, _km.x, _km.y);
+
 				return true;
+
 			case GUI::ACTION_LEFTCLICK:
-				event.type = ev.type == SDL_KEYDOWN?EVENT_LBUTTONDOWN:EVENT_LBUTTONUP;
+				event.type = (ev.type == SDL_KEYDOWN ? EVENT_LBUTTONDOWN : EVENT_LBUTTONUP);
 				fillMouseEvent(event, _km.x, _km.y);
+
 				return true;
+
 			case GUI::ACTION_RIGHTCLICK:
-				event.type = ev.type == SDL_KEYDOWN?EVENT_RBUTTONDOWN:EVENT_RBUTTONUP;
+				event.type = (ev.type == SDL_KEYDOWN ? EVENT_RBUTTONDOWN : EVENT_RBUTTONUP);
 				fillMouseEvent(event, _km.x, _km.y);
+
 				return true;
+
 			case GUI::ACTION_ZONE:
-				if(ev.type == SDL_KEYDOWN)
-				{
+				if(ev.type == SDL_KEYDOWN) {
 					int i;				
 					
-					for (i=0; i<TOTAL_ZONES; i++)
+					for (i=0; i < TOTAL_ZONES; i++)
 						if (_km.x >= _zones[i].x && _km.y >= _zones[i].y &&
 							_km.x <= _zones[i].x + _zones[i].width && _km.y <= _zones[i].y + _zones[i].height
 							) {
@@ -286,31 +283,38 @@
 						if (_currentZone >= TOTAL_ZONES)
 							_currentZone = 0;
 						event.type = EVENT_MOUSEMOVE;
-						fillMouseEvent(event, _mouseXZone[_currentZone],_mouseYZone[_currentZone]);
-						SDL_WarpMouse(event.mouse.x,event.mouse.y);					
+						fillMouseEvent(event, _mouseXZone[_currentZone], _mouseYZone[_currentZone]);
+						SDL_WarpMouse(event.mouse.x, event.mouse.y);					
 				}
+
 				return true;
+
 			case GUI::ACTION_SAVE:
 			case GUI::ACTION_SKIP:
 			case GUI::ACTION_FT_CHEAT:
 			case GUI::ACTION_SKIP_TEXT:
 			case GUI::ACTION_PAUSE:
 				{
-					GUI::Key& key = GUI::Actions::Instance()->getKeyAction(loop);
-					ev.key.keysym.sym =(SDLKey) key.ascii();
+					GUI::Key &key = GUI::Actions::Instance()->getKeyAction(loop);
+					ev.key.keysym.sym = (SDLKey)key.ascii();
 					ev.key.keysym.scancode= key.keycode();
-					ev.key.keysym.mod =(SDLMod) key.flags();
+					ev.key.keysym.mod = (SDLMod)key.flags();
+
 					return false;
 				}			
-			case GUI::ACTION_QUIT:{
-			GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
-			if (alert.runModal() == GUI::kMessageOK)
-				quit();
-			return true;
+
+			case GUI::ACTION_QUIT:
+				{
+					GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
+					if (alert.runModal() == GUI::kMessageOK)
+						quit();
+
+					return true;
+				}
 			}
 		}
 	}
-	}
+
 	return false;
 }
 
@@ -327,13 +331,14 @@
 }
 
 void OSystem_SDL_Symbian::initZones() {
-        int i;
+	int i;
 
-		_currentZone = 0;
-        for (i=0; i<TOTAL_ZONES; i++) {
-                _mouseXZone[i] = (_zones[i].x + (_zones[i].width / 2));
-                _mouseYZone[i] = (_zones[i].y + (_zones[i].height / 2));
-        }
+	_currentZone = 0;
+
+	for (i = 0; i < TOTAL_ZONES; i++) {
+		_mouseXZone[i] = (_zones[i].x + (_zones[i].width / 2));
+		_mouseYZone[i] = (_zones[i].y + (_zones[i].height / 2));
+	}
 }
 
 /*

Index: SymbianOS.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/epoc/SymbianOS.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- SymbianOS.h	18 Oct 2005 01:30:11 -0000	1.4
+++ SymbianOS.h	3 Dec 2005 14:34:45 -0000	1.5
@@ -24,7 +24,7 @@
 #ifndef SDLSYMBIANH
 #define SDLSYMBIANH
 
-#include "sdl-common.h"
+#include "backends/sdl/sdl-common.h"
 
 #define TOTAL_ZONES 3
 
@@ -32,42 +32,44 @@
 public:
 	OSystem_SDL_Symbian();
 	~OSystem_SDL_Symbian();
+
 	int getDefaultGraphicsMode() const;
 	const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
 	bool setGraphicsMode(const char *name);
 
 	// Set function that generates samples
-	/**
-	 * This function is overridden by the symbian port in order to provide MONO audio
-	 * downmix is done by supplying our own audiocallback
-	 */
+	//
+	// This function is overridden by the symbian port in order to provide MONO audio
+	// downmix is done by supplying our own audiocallback
+	//
 	virtual bool setSoundCallback(SoundProc proc, void *param); // overloaded by CE backend
+
 protected:
-	/**
-	 * The mixer callback function, passed on to OSystem::setSoundCallback().
-	 * This simply calls the mix() method.
-	 * and then does downmixing for symbian if needed
-	 */
+	//
+	// The mixer callback function, passed on to OSystem::setSoundCallback().
+	// This simply calls the mix() method.
+	// and then does downmixing for symbian if needed
+	//
 	static void symbianMixCallback(void *s, byte *samples, int len);
 
-	/**
-	 * Actual mixing implementation
-	 */
+	//
+	// Actual mixing implementation
+	//
 	void symbianMix(byte *samples, int len);
 
-	/**
-	 * This is an implementation by the remapKey function
-	 * @param SDL_Event to remap
-	 * @param ScumVM event to modify if special result is requested
-	 * @return true if Event has a valid return status
-	 */
-	bool remapKey(SDL_Event &ev,Event &event);
+	//
+	// This is an implementation by the remapKey function
+	// @param SDL_Event to remap
+	// @param ScumVM event to modify if special result is requested
+	// @return true if Event has a valid return status
+	//
+	bool remapKey(SDL_Event &ev, Event &event);
 
 	void setWindowCaption(const char *caption);
 
-	/**
-	 * Used to intialized special game mappings
-	 */
+	//
+	// Used to intialized special game mappings
+	//
 	void check_mappings();
 
 	void initZones();
@@ -77,7 +79,7 @@
 
 	SoundProc _sound_proc;
 	void *_sound_proc_param;
-	byte* _stereo_mix_buffer;
+	byte *_stereo_mix_buffer;
 
 	// Used to handle joystick navi zones
 	int _mouseXZone[TOTAL_ZONES];

Index: portdefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/epoc/portdefs.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- portdefs.h	18 Oct 2005 01:30:11 -0000	1.5
+++ portdefs.h	3 Dec 2005 14:34:45 -0000	1.6
@@ -35,43 +35,44 @@
 
 
 // the place in Symbian FS where scummvm.ini & std***.txt are saved
-#define SYMBIAN32_DOC_DIR "C:\\documents\\EScummVM\\" // includes final \\!
+#define SYMBIAN32_DOC_DIR "C:\\documents\\ScummVM\\" // includes final \\!
 #define DISABLE_SCALERS // we only need 1x
 
 // hack in some tricks to work around not having these fcns for Symbian
 // and we _really_ don't wanna link with any other windows LIBC library!
 #ifdef __GCC32__
 
-	#define snprintf(buf,len,args...)	sprintf(buf,args)
-	#define vsnprintf					snprintf
+#define snprintf(buf,len,args...)	sprintf(buf, args)
+#define vsnprintf					snprintf
 
 #else // WINS
 
-	// let's just blatantly ignore this for now and just get it to work :P but does n't work from the debug function
-	int inline scumm_snprintf (char *str, unsigned long /*n*/, char const *fmt, ...)
-	{
-		va_list args;
-		va_start(args, fmt);
-		vsprintf(str, fmt, args);
-		va_end(args);
-		return strlen(str);
-	}
+// let's just blatantly ignore this for now and just get it to work :P but does n't work from the debug function
+int inline scumm_snprintf (char *str, unsigned long /*n*/, char const *fmt, ...) {
+	va_list args;
+	va_start(args, fmt);
+	vsprintf(str, fmt, args);
+	va_end(args);
 
-	#define snprintf					scumm_snprintf
-	#define vsnprintf					scumm_snprintf
+	return strlen(str);
+}
+
+#define snprintf					scumm_snprintf
+#define vsnprintf					scumm_snprintf
 
 #endif
 
 // somehow nobody has this function...
-#define hypot(a, b)					sqrt((a)*(a) + (b)*(b))
+#define hypot(a, b)					sqrt((a) * (a) + (b) * (b))
 
 // Symbian bsearch implementation is flawed
 void inline *scumm_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
 	size_t i;
 
-	for (i=0; i<nmemb; i++)
+	for (i = 0; i < nmemb; i++)
 		if (compar(key, (void*)((size_t)base + size * i)) == 0)
 			return (void*)((size_t)base + size * i);
+
 	return NULL;
 }
 #define bsearch						scumm_bsearch





More information about the Scummvm-git-logs mailing list