[Scummvm-cvs-logs] CVS: scummvm/wince pocketpc.cpp,1.19,1.20 screen.cpp,1.4,1.5 screen.h,1.4,1.5

Nicolas Bacca arisme at users.sourceforge.net
Tue May 14 15:30:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/wince
In directory usw-pr-cvs1:/tmp/cvs-serv26465

Modified Files:
	pocketpc.cpp screen.cpp screen.h 
Log Message:
Update port for new timer function & fix toolbar in Zak

Index: pocketpc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/wince/pocketpc.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- pocketpc.cpp	14 May 2002 06:52:48 -0000	1.19
+++ pocketpc.cpp	14 May 2002 22:29:08 -0000	1.20
@@ -30,11 +30,16 @@
 #define POCKETSCUMM_BUILD "051302"
 
 #define VERSION "Build " POCKETSCUMM_BUILD " (VM " SCUMMVM_CVS ")"
+
+typedef int (*tTimeCallback)(int);
 
 GameDetector detector;
 Gui gui;
 Scumm *g_scumm;
-Config *scummcfg;
+Config *scummcfg;
+tTimeCallback timer_callback;
+int timer_interval;
+
 
 extern void Cls();
 
@@ -112,7 +117,10 @@
 	void stop_cdrom();
 
 	// Update cdrom audio status
-	void update_cdrom();
+	void update_cdrom();
+
+	// Add a new callback timer
+	void set_timer(int timer, int (*callback)(int));
 
 	// Quit
 	void quit();
@@ -348,29 +356,29 @@
 	
 	int argc = 3;
 	char* argv[3];
-	char argdir[MAX_PATH];
+	char argdir[MAX_PATH];
 	char *game_name;
 
 	sound_activated = true;
 	hide_toolbar = false;
 
-	scummcfg = new Config("scummvm.ini", "scummvm");
+	scummcfg = new Config("scummvm.ini", "scummvm");
 	scummcfg->set_writing(true);
-
-	game_name = GameSelector();
-	if (!game_name)
-		return 0;
+
+	game_name = GameSelector();
+	if (!game_name)
+		return 0;
 
 	argv[0] = NULL;	
 	sprintf(argdir, "-p%s", _directory);
-	argv[1] = argdir;
+	argv[1] = argdir;
 	argv[2] = game_name;
 
 	if (!argv[2])
-		return 0;
-
-	// No default toolbar for zak256
-	if (strcmp(game_name, "zak256") == 0)
+		return 0;
+
+	// No default toolbar for zak256
+	if (strcmp(game_name, "zak256") == 0)
 		hide_toolbar = true;
 
 	if (detector.detectMain(argc, argv))
@@ -467,7 +475,7 @@
 			} else {
 				SHSipPreference(hWnd, SIP_FORCEDOWN);
 			} 
-			*/
+			*/
 			SHSipPreference(hWnd, SIP_FORCEDOWN);
 		}
 //		SHSipPreference(hWnd, SIP_UP); /* Hack! */
@@ -475,12 +483,12 @@
 		wm->update_screen();
 		return 0;
 
-	case WM_ACTIVATE:
+	case WM_ACTIVATE:
 	case WM_SETFOCUS:	
 		GraphicsResume();
 		if (!hide_toolbar)
 			toolbar_drawn = false;
-//		SHHandleWMActivate(hWnd, wParam, lParam, &sai, SHA_INPUTDIALOG);
+//		SHHandleWMActivate(hWnd, wParam, lParam, &sai, SHA_INPUTDIALOG);
 
 		if (LOWORD(wParam) == WA_ACTIVE) {
 			if (GetScreenMode()) {		
@@ -493,11 +501,11 @@
 				SHFullScreen(hWnd, SHFS_SHOWTASKBAR);
 				MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CYSCREEN), GetSystemMetrics(SM_CXSCREEN), TRUE);
 			}
-		}
+		}
 
 		return 0;
 
-	case WM_HIBERNATE:
+	case WM_HIBERNATE:
 	case WM_KILLFOCUS:
 		GraphicsSuspend();
 		if (!hide_toolbar)
@@ -548,25 +556,25 @@
 		
       break;
 
-		case IDC_LANDSCAPE:
-			HWND taskbar;
+		case IDC_LANDSCAPE:
+			//HWND taskbar;
 			//SHFullScreen (hWnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
 			//InvalidateRect(HWND_DESKTOP, NULL, TRUE);
 			SetScreenMode(!GetScreenMode());
 			//SHSipPreference(hWnd,SIP_FORCEDOWN);
 			//MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), TRUE);
-			//SetCapture(hWnd); // to prevent input panel from getting taps						
-			/*taskbar = FindWindow(TEXT("HHTaskBar"), NULL);
-			if (taskbar)
+			//SetCapture(hWnd); // to prevent input panel from getting taps						
+			/*taskbar = FindWindow(TEXT("HHTaskBar"), NULL);
+			if (taskbar)
 				ShowWindow(taskbar, SW_HIDE);*/
 			/*SHSipPreference(hWnd, SIP_FORCEDOWN);
-			SHFullScreen(hWnd, SHFS_HIDETASKBAR);*/
+			SHFullScreen(hWnd, SHFS_HIDETASKBAR);*/
 			SetForegroundWindow(hWnd);
 			MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), TRUE);
-			SetCapture(hWnd);
+			SetCapture(hWnd);
 			UpdateWindow(hWnd);
 			if (!hide_toolbar)
-				toolbar_drawn = false;
+				toolbar_drawn = false;
 			break;
 
 		}
@@ -731,7 +739,10 @@
 		break;
 	case WM_LBUTTONDBLCLK:  // doesn't seem to work right now
 		//wm->_scumm->_rightBtnPressed |= msClicked | msDown;
-		break;
+		break;
+	case WM_TIMER:
+		timer_callback(timer_interval);
+		break;
 	default:
 		return DefWindowProc(hWnd, message, wParam, lParam);
    }
@@ -865,7 +876,11 @@
 }
 
 void action_hide() {
-	hide_toolbar = !hide_toolbar;
+	hide_toolbar = !hide_toolbar;
+	if (hide_toolbar)
+		RestoreScreenGeometry();
+	else
+		LimitScreenGeometry();
 	Cls();
 	toolbar_drawn = hide_toolbar;
 	g_scumm->_system->update_screen();
@@ -886,17 +901,17 @@
 
 void action_cursoronoff() {
 	hide_cursor = !hide_cursor;
-}
-
-void action_subtitleonoff() {
-	g_scumm->_noSubtitles = !g_scumm->_noSubtitles;
+}
+
+void action_subtitleonoff() {
+	g_scumm->_noSubtitles = !g_scumm->_noSubtitles;
 }
 
 void keypad_init() {
 	static pAction actions[TOTAL_ACTIONS] =
 	{ action_pause, action_save, action_quit, action_skip, action_hide, 
-	  action_keyboard, action_sound, action_right_click, action_cursoronoff,
-	  action_subtitleonoff
+	  action_keyboard, action_sound, action_right_click, action_cursoronoff,
+	  action_subtitleonoff
 	};
 	
 	GAPIKeysInit(actions);
@@ -939,7 +954,7 @@
 	hWnd_Window = syst->hWnd;
 	SetWindowLong(syst->hWnd, GWL_USERDATA, (long)syst);
 
-	ShowWindow(syst->hWnd, SW_SHOW);
+	ShowWindow(syst->hWnd, SW_SHOW);
 	UpdateWindow(syst->hWnd);
 
 	SHMENUBARINFO smbi;
@@ -977,6 +992,12 @@
 OSystem *OSystem_WINCE3_create() {
 	return OSystem_WINCE3::create(0, 0);
 }
+
+void OSystem_WINCE3::set_timer(int timer, int (*callback)(int)) {
+	SetTimer(hWnd, 1, timer, NULL);
+	timer_interval = timer;
+	timer_callback = callback;
+}
 
 void OSystem_WINCE3::set_palette(const byte *colors, uint start, uint num) {
 	const byte *b = colors;
@@ -1001,7 +1022,7 @@
 }
 
 void OSystem_WINCE3::init_size(uint w, uint h) {
-	load_gfx_mode();
+	load_gfx_mode();
 	SetScreenGeometry(w, h);
 }
 
@@ -1165,7 +1186,7 @@
 	Sleep(msecs);
 }
 	
-void *OSystem_WINCE3::create_thread(ThreadProc *proc, void *param) {
+void *OSystem_WINCE3::create_thread(ThreadProc *proc, void *param) {
 	// needed for emulated MIDI support (Sam'n'Max)
 	return CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)proc, param, 0, NULL);
 }

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/wince/screen.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- screen.cpp	14 May 2002 06:50:38 -0000	1.4
+++ screen.cpp	14 May 2002 22:29:08 -0000	1.5
@@ -86,6 +86,9 @@
 static tCls        pCls        = NULL;
 static tBlt		   pBlt	       = NULL;
 
+static int _geometry_w;
+static int _geometry_h;  
+
 HWND hWndMain;
 
 
@@ -133,9 +136,25 @@
 		MessageBox(NULL, TEXT("Unsupported screen geometry !"), TEXT("Error"), MB_OK);
 		exit(1);
 	}
-	geom[0].lineLimit = w*h;
-	geom[1].lineLimit = w*h;
-	geom[2].lineLimit = w*h;
+
+	_geometry_w = w;
+	_geometry_h = h;
+	RestoreScreenGeometry();
+}
+
+void LimitScreenGeometry() {
+
+	if (_geometry_h > 200) {
+		geom[0].lineLimit = _geometry_w*200;
+		geom[1].lineLimit = _geometry_w*200;
+		geom[1].lineLimit = _geometry_w*200;
+	}
+}
+
+void RestoreScreenGeometry() {
+	geom[0].lineLimit = _geometry_w * _geometry_h;
+	geom[1].lineLimit = _geometry_w * _geometry_h;
+	geom[2].lineLimit = _geometry_w * _geometry_h;
 }
 
 int GraphicsOn(HWND hWndMain_param)
@@ -1139,4 +1158,4 @@
 	}
 }
 
-#endif
\ No newline at end of file
+#endif

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/wince/screen.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- screen.h	14 May 2002 06:51:09 -0000	1.4
+++ screen.h	14 May 2002 22:29:08 -0000	1.5
@@ -8,6 +8,8 @@
 #endif
 
 void SetScreenGeometry(int w, int h);
+void LimitScreenGeometry();
+void RestoreScreenGeometry();
 int GraphicsOn(HWND hWndMain);
 void GraphicsOff();
 void GraphicsSuspend();





More information about the Scummvm-git-logs mailing list