src/video/dedicated_v.cpp
branchgamebalance
changeset 9911 0b8b245a2391
parent 9895 7bd07f43b0e3
child 9913 e79cd19772dd
equal deleted inserted replaced
9910:0b2aebc8283e 9911:0b8b245a2391
   110 }
   110 }
   111 
   111 
   112 #endif
   112 #endif
   113 
   113 
   114 
   114 
   115 static void *_dedicated_video_mem;
   115 static Pixel *_dedicated_video_mem;
   116 
   116 
   117 extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
   117 extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
   118 extern void SwitchMode(int new_mode);
   118 extern void SwitchMode(int new_mode);
   119 
   119 
   120 
   120 
   121 static const char *DedicatedVideoStart(const char * const *parm)
   121 static const char *DedicatedVideoStart(const char * const *parm)
   122 {
   122 {
   123 	_screen.width = _screen.pitch = _cur_resolution[0];
   123 	_screen.width = _screen.pitch = _cur_resolution[0];
   124 	_screen.height = _cur_resolution[1];
   124 	_screen.height = _cur_resolution[1];
   125 	_dedicated_video_mem = malloc(_cur_resolution[0]*_cur_resolution[1]);
   125 	_dedicated_video_mem = (Pixel *)malloc(_cur_resolution[0] * _cur_resolution[1] * sizeof(Pixel));
   126 
   126 
   127 	SetDebugString("net=6");
   127 	SetDebugString("net=6");
   128 
   128 
   129 #ifdef WIN32
   129 #ifdef WIN32
   130 	// For win32 we need to allocate a console (debug mode does the same)
   130 	// For win32 we need to allocate a console (debug mode does the same)
   281 		cur_ticks = GetTime();
   281 		cur_ticks = GetTime();
   282 		if (cur_ticks >= next_tick || cur_ticks < prev_cur_ticks) {
   282 		if (cur_ticks >= next_tick || cur_ticks < prev_cur_ticks) {
   283 			next_tick = cur_ticks + 30;
   283 			next_tick = cur_ticks + 30;
   284 
   284 
   285 			GameLoop();
   285 			GameLoop();
   286 			_screen.dst_ptr = (Pixel*)_dedicated_video_mem;
   286 			_screen.dst_ptr = _dedicated_video_mem;
   287 			UpdateWindows();
   287 			UpdateWindows();
   288 		}
   288 		}
   289 		CSleep(1);
   289 		CSleep(1);
   290 	}
   290 	}
   291 }
   291 }