[Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.51,1.52 gui.cpp,1.12,1.13 gui.h,1.6,1.7 resource.cpp,1.51,1.52 scummvm.cpp,1.78,1.79 sdl.cpp,1.42,1.43

James Brown ender at users.sourceforge.net
Thu Mar 14 05:58:07 CET 2002


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

Modified Files:
	gfx.cpp gui.cpp gui.h resource.cpp scummvm.cpp sdl.cpp 
Log Message:
Make some code-execution changes to allow early initilisation of GUI.



Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** gfx.cpp	10 Mar 2002 17:33:02 -0000	1.51
--- gfx.cpp	14 Mar 2002 13:57:28 -0000	1.52
***************
*** 81,87 ****
  	size = vs->width * vs->height;
  	vs->size = size;
  	if (vs->scrollable)
  		size += 320*4;
- 
  	createResource(rtBuffer, slot+1, size);
  
--- 81,87 ----
  	size = vs->width * vs->height;
  	vs->size = size;
+ 
  	if (vs->scrollable)
  		size += 320*4;
  	createResource(rtBuffer, slot+1, size);
  

Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** gui.cpp	13 Mar 2002 01:43:25 -0000	1.12
--- gui.cpp	14 Mar 2002 13:57:28 -0000	1.13
***************
*** 28,31 ****
--- 28,32 ----
  };
  
+ 
  void Gui::draw(int start,int end) {
  	int i;
***************
*** 74,77 ****
--- 75,96 ----
  }
  
+ void Gui::drawChar(const char str, int xx, int yy) { 
+   unsigned int buffer, mask = 0, x, y;    
+   byte *tmp;
+   
+   tmp = &guifont[0];
+   tmp += 224 + (str + 1)*8;
+ 
+   for(y=0;y<8;y++){
+     for(x=0;x<8;x++){
+ 		unsigned char color;
+     	if ((mask >>= 1) == 0) {buffer = *tmp++;  mask = 0x80;}
+         color = ((buffer & mask) != 0);
+         if (color)
+ 				hline(xx + x, yy + y, yy + y + 1);
+       }
+   }
+ 
+ }
  void Gui::drawString(const char *str, int x, int y, int w, byte color, bool center) {
  	StringTab *st = &_s->string[5];
***************
*** 82,87 ****
  	st->ypos = y;
  	st->right = x + w;
! 	_s->_messagePtr = (byte*)str;
! 	_s->drawString(5);
  }
  
--- 101,112 ----
  	st->ypos = y;
  	st->right = x + w;
! 
! 	if (_s->_gameId) {		/* If a game is active.. */
! 		_s->_messagePtr = (byte*)str;
! 		_s->drawString(5);
! 	} else {		
! 		for (uint letter = 0; letter < strlen(str); letter++)
! 			drawChar(str[letter], st->xpos + (letter * 8), st->ypos);		
! 	}
  }
  
***************
*** 182,187 ****
--- 207,214 ----
  	y += _parentY;
  	_vs = _s->findVirtScreen(y);
+ 	
  	if (_vs==NULL)
  		return NULL;
+ 	
  	return _s->getResourceAddress(rtBuffer, _vs->number+1) + x + (y-_vs->topline)*320 + _s->_screenStartStrip*8;
  }
***************
*** 202,205 ****
--- 229,233 ----
  
  	ptr = getBasePtr(x, y);
+ 	
  	if (ptr==NULL)
  		return;
***************
*** 356,360 ****
  	109, /* Select a game to LOAD */
  	108, /* Name your SAVE game */
!   96,  /* Save */
  	97,  /* Load */
  	98,  /* Play */
--- 384,388 ----
  	109, /* Select a game to LOAD */
  	108, /* Name your SAVE game */
! 	96,  /* Save */
  	97,  /* Load */
  	98,  /* Play */
***************
*** 369,373 ****
  	20, /* Select a game to LOAD */
  	19, /* Name your SAVE game */
!   7,  /* Save */
  	8,  /* Load */
  	9,  /* Play */
--- 397,401 ----
  	20, /* Select a game to LOAD */
  	19, /* Name your SAVE game */
! 	7,  /* Save */
  	8,  /* Load */
  	9,  /* Play */
***************
*** 380,383 ****
--- 408,414 ----
  const char *Gui::queryString(int string, int id) {
  	static char namebuf[64];
+ 	if (!_s->_gameId)
+ 		return "blah!";
+ 
  	if (id>=20 && id<=28) {
  		sprintf(namebuf, "%2d. %s", id-20+_slotIndex, game_names[id-20]);
***************
*** 471,479 ****
  void Gui::init(Scumm *s) {
  	_s = s;
! 	_bgcolor = getDefaultColor(0);
! 	_color = getDefaultColor(1);
! 	_textcolor = getDefaultColor(2);
! 	_textcolorhi = getDefaultColor(6);
! 	_shadowcolor = getDefaultColor(8);
  }
  
--- 502,518 ----
  void Gui::init(Scumm *s) {
  	_s = s;
! 	if (_s->_gameId) {
! 		_bgcolor = getDefaultColor(0);
! 		_color = getDefaultColor(1);
! 		_textcolor = getDefaultColor(2);
! 		_textcolorhi = getDefaultColor(6);
! 		_shadowcolor = getDefaultColor(8);
! 	} else {
! 		_bgcolor = 0;
! 		_color = 2;
! 		_textcolor = 6;
! 		_textcolorhi = 3;
! 		_shadowcolor = 2;
! 	}
  }
  

Index: gui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gui.h	8 Mar 2002 08:42:10 -0000	1.6
--- gui.h	14 Mar 2002 13:57:28 -0000	1.7
***************
*** 63,66 ****
--- 63,67 ----
  	void hline(int x, int y, int x2);
  	void vline(int x, int y, int y2);
+ 	void drawChar(const char str, int xx, int yy);
  	void drawString(const char *str, int x, int y, int w, byte color, bool center);
  	void widgetClear(const GuiWidget *w);
***************
*** 81,84 ****
--- 82,113 ----
  	void pause();
  };
+ 
+ // Built-in font
+ static byte guifont[] = {0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7,
+ 7,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,8,5,8,8,7,7,7,6,7,7,7,7,7,5,6,7,5,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,3,5,0,8,7,7,7,7,7,7,0,6,7,7,7,5,5,5,7,0,6,8,8,7,7,7,7,7,0,7,7,0,0,
+ 0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,1,3,6,12,
+ 24,62,3,0,128,192,96,48,24,124,192,0,0,3,62,24,12,6,3,1,0,192,124,24,48,96,192,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,237,74,72,0,0,0,0,0,128,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,60,66,153,161,161,153,66,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,96,96,96,96,0,0,96,0,102,102,102,0,0,0,0,0,102,102,255,102,255,102,102,0,24,62,96,60,6,124,24,0,98,102,12,24,48,102,70,0,60,102,60,56,103,102,63,0,96,48,16,0,0,0,0,0,24,48,96,96,96,48,24,0,96,48,24,24,24,48,96,0,
+ 0,102,60,255,60,102,0,0,0,24,24,126,24,24,0,0,0,0,0,0,0,48,48,96,0,0,0,126,0,0,0,0,0,0,0,0,0,96,96,0,0,3,6,12,24,48,96,0,60,102,102,102,102,102,60,0,24,24,56,24,24,24,126,0,60,102,6,12,48,96,126,0,60,102,6,28,6,102,60,0,6,
+ 14,30,102,127,6,6,0,126,96,124,6,6,102,60,0,60,102,96,124,102,102,60,0,126,102,12,24,24,24,24,0,60,102,102,60,102,102,60,0,60,102,102,62,6,102,60,0,0,0,96,0,0,96,0,0,0,0,48,0,0,48,48,96,14,24,48,96,48,24,14,0,0,0,120,0,120,0,0,0,112,24,
+ 12,6,12,24,112,0,60,102,6,12,24,0,24,0,0,0,0,255,255,0,0,0,24,60,102,126,102,102,102,0,124,102,102,124,102,102,124,0,60,102,96,96,96,102,60,0,120,108,102,102,102,108,120,0,126,96,96,120,96,96,126,0,126,96,96,120,96,96,96,0,60,102,96,110,102,102,60,0,102,102,102,
+ 126,102,102,102,0,120,48,48,48,48,48,120,0,30,12,12,12,12,108,56,0,102,108,120,112,120,108,102,0,96,96,96,96,96,96,126,0,99,119,127,107,99,99,99,0,102,118,126,126,110,102,102,0,60,102,102,102,102,102,60,0,124,102,102,124,96,96,96,0,60,102,102,102,102,60,14,0,124,102,102,124,
+ 120,108,102,0,60,102,96,60,6,102,60,0,126,24,24,24,24,24,24,0,102,102,102,102,102,102,60,0,102,102,102,102,102,60,24,0,99,99,99,107,127,119,99,0,102,102,60,24,60,102,102,0,102,102,102,60,24,24,24,0,126,6,12,24,48,96,126,0,120,96,96,96,96,96,120,0,3,6,12,24,48,
+ 96,192,0,120,24,24,24,24,24,120,0,0,0,0,0,0,219,219,0,0,0,0,0,0,0,0,255,102,102,102,0,0,0,0,0,0,0,60,6,62,102,62,0,0,96,96,124,102,102,124,0,0,0,60,96,96,96,60,0,0,6,6,62,102,102,62,0,0,0,60,102,126,96,60,0,0,14,24,62,24,24,
+ 24,0,0,0,62,102,102,62,6,124,0,96,96,124,102,102,102,0,0,48,0,112,48,48,120,0,0,12,0,12,12,12,12,120,0,96,96,108,120,108,102,0,0,112,48,48,48,48,120,0,0,0,102,127,127,107,99,0,0,0,124,102,102,102,102,0,0,0,60,102,102,102,60,0,0,0,124,102,102,124,96,
+ 96,0,0,62,102,102,62,6,6,0,0,124,102,96,96,96,0,0,0,62,96,60,6,124,0,0,24,126,24,24,24,14,0,0,0,102,102,102,102,62,0,0,0,102,102,102,60,24,0,0,0,99,107,127,62,54,0,0,0,102,60,24,60,102,0,0,0,102,102,102,62,12,120,0,0,126,12,24,48,126,0,
+ 24,48,48,96,48,48,24,0,96,96,96,0,96,96,96,0,96,48,48,24,48,48,96,0,0,0,0,0,0,0,0,0,8,12,14,255,255,14,12,8,60,102,96,96,102,60,24,56,102,0,102,102,102,102,62,0,12,24,60,102,126,96,60,0,24,36,60,6,62,102,62,0,102,0,60,6,62,102,62,0,48,
+ 24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,60,96,96,96,60,24,56,24,36,60,102,126,96,60,0,102,0,60,102,126,96,60,0,48,24,60,102,126,96,60,0,0,216,0,112,48,48,120,0,48,72,0,112,48,48,120,0,96,48,0,112,48,48,120,0,102,24,60,102,126,102,102,0,0,0,
+ 0,0,0,0,0,0,24,48,124,96,120,96,124,0,0,0,108,26,126,216,110,0,30,40,40,126,72,136,142,0,24,36,60,102,102,102,60,0,102,0,60,102,102,102,60,0,48,24,60,102,102,102,60,0,24,36,0,102,102,102,62,0,48,24,102,102,102,102,62,0,0,0,0,0,0,0,0,0,102,60,102,
+ 102,102,102,60,0,102,0,102,102,102,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,28,54,54,124,102,102,124,64,0,0,0};
  
  #endif

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** resource.cpp	14 Mar 2002 08:04:21 -0000	1.51
--- resource.cpp	14 Mar 2002 13:57:28 -0000	1.52
***************
*** 791,795 ****
  
  	CHECK_HEAP
! 	assert( res.address[type] );
  	assert( idx>=0 && idx < res.num[type]);
  
--- 791,797 ----
  
  	CHECK_HEAP
! 	if (!res.address[type])
! 		return;
! 
  	assert( idx>=0 && idx < res.num[type]);
  
***************
*** 1186,1189 ****
--- 1188,1194 ----
  
  void Scumm::allocateArrays() {
+ 	// Note: Buffers are now allocated in scummMain to allow for
+ 	//		 early GUI init.
+ 
  	_objectOwnerTable = (byte*)alloc(_numGlobalObjects);
  	_objectStateTable = (byte*)alloc(_numGlobalObjects);
***************
*** 1211,1215 ****
  	allocResTypeData(rtScaleTable,MKID('NONE'),5, "scale table", 0);
  	allocResTypeData(rtActorName, MKID('NONE'),NUM_ACTORS,"actor name", 0);
- 	allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0);
   	allocResTypeData(rtVerb, MKID('NONE'),_numVerbs,"verb", 0);
  	allocResTypeData(rtString, MKID('NONE'),_numArray,"array", 0);
--- 1216,1219 ----

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** scummvm.cpp	14 Mar 2002 08:04:21 -0000	1.78
--- scummvm.cpp	14 Mar 2002 13:57:28 -0000	1.79
***************
*** 26,29 ****
--- 26,30 ----
  #include "sound.h"
  
+ extern void launcherLoop();
  void Scumm::initRandSeeds() {
  	_randSeed1 = 0xA943DE35;
***************
*** 210,216 ****
  	#endif
  	parseCommandLine(argc, argv);
  
  	if (_exe_name==NULL)
! 		error("Specify the name of the game to start on the command line");
  
  	if (!detectGame()) {
--- 211,223 ----
  	#endif
  	parseCommandLine(argc, argv);
+ 	
+ 	/* Init graphics and create a primary virtual screen */
+ 	initGraphics(this, _fullScreen, _scale);
+ 	allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0);
+ 	initVirtScreen(0, 0, 200, false, false);	
  
  	if (_exe_name==NULL)
! 		//error("Specify the name of the game to start on the command line");
! 		launcherLoop();
  
  	if (!detectGame()) {
***************
*** 248,254 ****
  //	if (_gameId==GID_MONKEY2 && _bootParam==0) {
  //		_bootParam = 10001;
! //	}
! 
! 	initGraphics(this, _fullScreen, _scale);
  
      if (_features & GF_SMALL_HEADER)
--- 255,259 ----
  //	if (_gameId==GID_MONKEY2 && _bootParam==0) {
  //		_bootParam = 10001;
! //	}	
  
      if (_features & GF_SMALL_HEADER)
***************
*** 440,444 ****
  	{
  		printf( USAGE_STRING );
! 		exit(1);
  	}
  
--- 445,449 ----
  	{
  		printf( USAGE_STRING );
! 		//exit(1);
  	}
  

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** sdl.cpp	14 Mar 2002 08:04:21 -0000	1.42
--- sdl.cpp	14 Mar 2002 13:57:28 -0000	1.43
***************
*** 63,67 ****
  	int i;
  	byte *data = s->_currentPalette;
! 
  	data += first*3;
  	for (i=0; i<num; i++,data+=3) {
--- 63,67 ----
  	int i;
  	byte *data = s->_currentPalette;
! 	
  	data += first*3;
  	for (i=0; i<num; i++,data+=3) {
***************
*** 772,775 ****
--- 772,798 ----
  #endif
  
+ 
+ void launcherLoop() {
+ 	int last_time, new_time;
+ 	int delta = 0;
+ 	last_time = SDL_GetTicks();
+ 
+ 	gui.saveLoadDialog();
+ 	do {
+ 		updateScreen(&scumm);
+ 
+ 		new_time = SDL_GetTicks();
+ 		waitForTimer(&scumm, delta * 15 + last_time - new_time);
+ 		last_time = SDL_GetTicks();
+ 
+ 		if (gui._active) {
+ 			gui.loop();
+ 			delta = 5;
+ 		} else
+ 			error("gui closed!");
+ 	} while(1);
+ 
+ };
+ 
  int main(int argc, char* argv[]) {
  	int delta;
***************
*** 811,819 ****
  
  	scumm._gui = &gui;
  	sound.initialize(&scumm, &snd_driv);
      scumm.scummMain(argc, argv);
! 	
!     if (!(scumm._features & GF_SMALL_HEADER))
!        gui.init(&scumm);
  
  	last_time = SDL_GetTicks();
--- 834,841 ----
  
  	scumm._gui = &gui;
+ 	gui.init(&scumm);
  	sound.initialize(&scumm, &snd_driv);
      scumm.scummMain(argc, argv);
! 	gui.init(&scumm);	/* Reinit GUI after loading a game */
  
  	last_time = SDL_GetTicks();





More information about the Scummvm-git-logs mailing list