[Scummvm-cvs-logs] CVS: scummvm/saga isomap.cpp,1.3,1.4 isomap.h,1.3,1.4 isomap_mod.h,1.2,1.3 ite_introproc.cpp,1.6,1.7 ite_introproc.h,1.3,1.4 ite_introproc_mod.h,1.1,1.2 music.cpp,1.11,1.12 music.h,1.4,1.5 objectmap.cpp,1.5,1.6 objectmap.h,1.3,1.4 objectmap_mod.h,1.2,1.3

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat May 1 06:05:03 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1495

Modified Files:
	isomap.cpp isomap.h isomap_mod.h ite_introproc.cpp 
	ite_introproc.h ite_introproc_mod.h music.cpp music.h 
	objectmap.cpp objectmap.h objectmap_mod.h 
Log Message:
indent

Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- isomap.cpp	30 Apr 2004 23:02:23 -0000	1.3
+++ isomap.cpp	1 May 2004 13:04:31 -0000	1.4
@@ -20,27 +20,16 @@
  * $Header$
  *
  */
-/*
- Description:   
- 
-    Isometric level module
 
- Notes: 
-*/
+// Isometric level module
 
 #include "reinherit.h"
 
 #include "yslib.h"
 
-/*
- * Uses the following modules:
-\*--------------------------------------------------------------------------*/
 #include "game_mod.h"
 #include "gfx_mod.h"
 
-/*
- * Begin module component
-\*--------------------------------------------------------------------------*/
 #include "isomap_mod.h"
 #include "isomap.h"
 
@@ -48,16 +37,13 @@
 
 static R_ISOMAP_MODULE IsoModule;
 
-int ISOMAP_Init(void)
-{
+int ISOMAP_Init() {
 	IsoModule.init = 1;
 
 	return R_SUCCESS;
 }
 
-int ISOMAP_LoadTileset(const byte * tileres_p, size_t tileres_len)
-{
-
+int ISOMAP_LoadTileset(const byte *tileres_p, size_t tileres_len) {
 	R_ISOTILE_ENTRY first_entry;
 	R_ISOTILE_ENTRY *tile_tbl;
 
@@ -83,10 +69,8 @@
 	}
 
 	for (i = 0; i < IsoModule.tile_ct; i++) {
-
 		tile_tbl[i].tile_h = ys_read_u8(read_p, &read_p);
 		tile_tbl[i].unknown01 = ys_read_u8(read_p, &read_p);
-
 		tile_tbl[i].tile_offset = ys_read_u16_le(read_p, &read_p);
 		tile_tbl[i].unknown04 = ys_read_s16_le(read_p, &read_p);
 		tile_tbl[i].unknown06 = ys_read_s16_le(read_p, &read_p);
@@ -100,17 +84,12 @@
 	return R_SUCCESS;
 }
 
-int ISOMAP_LoadMetaTileset(const byte * mtileres_p, size_t mtileres_len)
-{
-
+int ISOMAP_LoadMetaTileset(const byte *mtileres_p, size_t mtileres_len) {
 	R_ISO_METATILE_ENTRY *mtile_tbl;
-
 	const byte *read_p = mtileres_p;
 	size_t read_len = mtileres_len;
-
 	uint16 mtile_ct;
 	uint16 ct;
-
 	int i;
 
 	assert(IsoModule.init);
@@ -119,22 +98,19 @@
 	(void)read_len;
 
 	mtile_ct = mtileres_len / SAGA_METATILE_ENTRY_LEN;
-
 	mtile_tbl = (R_ISO_METATILE_ENTRY *)malloc(mtile_ct * sizeof *mtile_tbl);
 	if (mtile_tbl == NULL) {
 		return R_MEM;
 	}
 
 	for (ct = 0; ct < mtile_ct; ct++) {
-
 		mtile_tbl[ct].mtile_n = ys_read_u16_le(read_p, &read_p);
 		mtile_tbl[ct].unknown02 = ys_read_s16_le(read_p, &read_p);
 		mtile_tbl[ct].unknown04 = ys_read_s16_le(read_p, &read_p);
 		mtile_tbl[ct].unknown06 = ys_read_s16_le(read_p, &read_p);
 
 		for (i = 0; i < SAGA_METATILE_SIZE; i++) {
-			mtile_tbl[ct].tile_tbl[i] =
-			    ys_read_u16_le(read_p, &read_p);
+			mtile_tbl[ct].tile_tbl[i] = ys_read_u16_le(read_p, &read_p);
 		}
 	}
 
@@ -148,12 +124,9 @@
 	return R_SUCCESS;
 }
 
-int ISOMAP_LoadMetamap(const byte * mm_res_p, size_t mm_res_len)
-{
-
+int ISOMAP_LoadMetamap(const byte *mm_res_p, size_t mm_res_len) {
 	const byte *read_p = mm_res_p;
 	size_t read_len = mm_res_len;
-
 	int i;
 
 	(void)read_len;
@@ -161,7 +134,6 @@
 	IsoModule.metamap_n = ys_read_s16_le(read_p, &read_p);
 
 	for (i = 0; i < SAGA_METAMAP_SIZE; i++) {
-
 		IsoModule.metamap_tbl[i] = ys_read_u16_le(read_p, &read_p);
 	}
 
@@ -172,47 +144,31 @@
 	return R_SUCCESS;
 }
 
-int ISOMAP_Draw(R_SURFACE * dst_s)
-{
-
+int ISOMAP_Draw(R_SURFACE *dst_s) {
 	R_GAME_DISPLAYINFO disp_info;
-
 	GAME_GetDisplayInfo(&disp_info);
-
 	R_RECT iso_rect(disp_info.logical_w - 1, disp_info.scene_h - 1);
-
 	GFX_DrawRect(dst_s, &iso_rect, 0);
-
 	ISOMAP_DrawMetamap(dst_s, -1000, -500);
 
 	return R_SUCCESS;
 }
 
-int ISOMAP_DrawMetamap(R_SURFACE * dst_s, int map_x, int map_y)
-{
+int ISOMAP_DrawMetamap(R_SURFACE *dst_s, int map_x, int map_y) {
 	int meta_base_x = map_x;
 	int meta_base_y = map_y;
-
 	int meta_xi;
 	int meta_yi;
-
 	int meta_x;
 	int meta_y;
-
 	int meta_idx;
 
 	for (meta_yi = SAGA_METAMAP_H - 1; meta_yi >= 0; meta_yi--) {
-
 		meta_x = meta_base_x;
 		meta_y = meta_base_y;
-
 		for (meta_xi = SAGA_METAMAP_W - 1; meta_xi >= 0; meta_xi--) {
-
 			meta_idx = meta_xi + (meta_yi * 16);
-
-			ISOMAP_DrawMetaTile(dst_s,
-			    IsoModule.metamap_tbl[meta_idx], meta_x, meta_y);
-
+			ISOMAP_DrawMetaTile(dst_s, IsoModule.metamap_tbl[meta_idx], meta_x, meta_y);
 			meta_x += 128;
 			meta_y += 64;
 		}
@@ -224,21 +180,14 @@
 	return R_SUCCESS;
 }
 
-int
-ISOMAP_DrawMetaTile(R_SURFACE * dst_s, uint16 mtile_i, int mtile_x, int mtile_y)
-{
-
+int ISOMAP_DrawMetaTile(R_SURFACE *dst_s, uint16 mtile_i, int mtile_x, int mtile_y) {
 	int tile_xi;
 	int tile_yi;
-
 	int tile_x;
 	int tile_y;
-
 	int tile_base_x;
 	int tile_base_y;
-
 	int tile_i;
-
 	R_ISO_METATILE_ENTRY *mtile_p;
 	assert(IsoModule.init && IsoModule.mtiles_loaded);
 
@@ -252,45 +201,30 @@
 	tile_base_y = mtile_y;
 
 	for (tile_yi = SAGA_METATILE_H - 1; tile_yi >= 0; tile_yi--) {
-
 		tile_y = tile_base_y;
 		tile_x = tile_base_x;
-
 		for (tile_xi = SAGA_METATILE_W - 1; tile_xi >= 0; tile_xi--) {
-
 			tile_i = tile_xi + (tile_yi * SAGA_METATILE_W);
-
-			ISOMAP_DrawTile(dst_s,
-			    mtile_p->tile_tbl[tile_i], tile_x, tile_y);
-
+			ISOMAP_DrawTile(dst_s, mtile_p->tile_tbl[tile_i], tile_x, tile_y);
 			tile_x += SAGA_ISOTILE_WIDTH / 2;
 			tile_y += SAGA_ISOTILE_BASEHEIGHT / 2 + 1;
-
 		}
-
 		tile_base_x -= SAGA_ISOTILE_WIDTH / 2;
 		tile_base_y += SAGA_ISOTILE_BASEHEIGHT / 2 + 1;
-
 	}
 
 	return R_SUCCESS;
 }
 
-int ISOMAP_DrawTile(R_SURFACE * dst_s, uint16 tile_i, int tile_x, int tile_y)
-{
-
+int ISOMAP_DrawTile(R_SURFACE *dst_s, uint16 tile_i, int tile_x, int tile_y) {
 	const byte *tile_p;
 	const byte *read_p;
-
 	byte *draw_p;
-
 	int draw_x;
 	int draw_y;
-
 	int tile_h;
 	int w_count = 0;
 	int row;
-
 	int bg_runct;
 	int fg_runct;
 	int ct;
@@ -324,38 +258,32 @@
 		draw_y = tile_y - (tile_h - SAGA_ISOTILE_BASEHEIGHT);
 	}
 
-	/* temporary y clip */
+	// temporary y clip
 	if (draw_y < 0) {
 		return R_SUCCESS;
 	}
 
 	for (row = 0; row < tile_h; row++) {
-
-		draw_p =
-		    dst_s->buf + draw_x + ((draw_y + row) * dst_s->buf_pitch);
+		draw_p = dst_s->buf + draw_x + ((draw_y + row) * dst_s->buf_pitch);
 		w_count = 0;
 
-		/* temporary y clip */
+		// temporary y clip
 		if ((draw_y + row) >= 137) {
 			return R_SUCCESS;
 		}
 
 		for (;;) {
-
 			bg_runct = *read_p++;
 			w_count += bg_runct;
-
 			if (w_count >= SAGA_ISOTILE_WIDTH) {
 				break;
 			}
 
 			draw_p += bg_runct;
-
 			fg_runct = *read_p++;
 			w_count += fg_runct;
 
 			for (ct = 0; ct < fg_runct; ct++) {
-
 				*draw_p++ = *read_p++;
 			}
 		}

Index: isomap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- isomap.h	30 Apr 2004 23:02:23 -0000	1.3
+++ isomap.h	1 May 2004 13:04:31 -0000	1.4
@@ -20,13 +20,8 @@
  * $Header$
  *
  */
-/*
- Description:   
- 
-    Isometric level module - private header
 
- Notes: 
-*/
+// Isometric level module - private header
 
 #ifndef SAGA_ISOMAP_H_
 #define SAGA_ISOMAP_H_
@@ -34,7 +29,6 @@
 namespace Saga {
 
 struct R_ISOTILE_ENTRY {
-
 	int tile_h;
 	int unknown01;
 	size_t tile_offset;
@@ -56,22 +50,17 @@
 #define SAGA_METAMAP_SIZE 256
 
 struct R_ISO_METATILE_ENTRY {
-
 	int mtile_n;
 	int unknown02;
 	int unknown04;
 	int unknown06;
-
 	int tile_tbl[SAGA_METATILE_SIZE];
-
 };
 
 #define SAGA_METATILE_ENTRY_LEN 136
 
 struct R_ISOMAP_MODULE {
-
 	int init;
-
 	int tiles_loaded;
 	const byte *tileres_p;
 	size_t tileres_len;
@@ -89,16 +78,12 @@
 	uint16 metamap_tbl[SAGA_METAMAP_SIZE];
 	const byte *mm_res_p;
 	size_t mm_res_len;
-
 };
 
-int ISOMAP_DrawTile(R_SURFACE * dst_s, uint16 tile_i, int tile_x, int tile_y);
-
-int
-ISOMAP_DrawMetaTile(R_SURFACE * dst_s, uint16 mtile_i, int mtile_x, int mtile_y);
-
-int ISOMAP_DrawMetamap(R_SURFACE * dst_s, int map_x, int map_y);
+int ISOMAP_DrawTile(R_SURFACE *dst_s, uint16 tile_i, int tile_x, int tile_y);
+int ISOMAP_DrawMetaTile(R_SURFACE *dst_s, uint16 mtile_i, int mtile_x, int mtile_y);
+int ISOMAP_DrawMetamap(R_SURFACE *dst_s, int map_x, int map_y);
 
 } // End of namespace Saga
 
-#endif				/* SAGA_ISOMAP_H_ */
+#endif

Index: isomap_mod.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap_mod.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- isomap_mod.h	30 Apr 2004 23:02:23 -0000	1.2
+++ isomap_mod.h	1 May 2004 13:04:31 -0000	1.3
@@ -20,13 +20,8 @@
  * $Header$
  *
  */
-/*
- Description:   
- 
-    Isometric level module - public module header
 
- Notes: 
-*/
+// Isometric level module - public module header
 
 #ifndef SAGA_ISOMAP_MOD_H_
 #define SAGA_ISOMAP_MOD_H_
@@ -34,15 +29,11 @@
 namespace Saga {
 
 int ISOMAP_Init(void);
-
 int ISOMAP_LoadTileset(const byte *, size_t);
-
 int ISOMAP_LoadMetaTileset(const byte *, size_t);
-
-int ISOMAP_LoadMetamap(const byte * mm_res_p, size_t mm_res_len);
-
-int ISOMAP_Draw(R_SURFACE * dst_s);
+int ISOMAP_LoadMetamap(const byte *mm_res_p, size_t mm_res_len);
+int ISOMAP_Draw(R_SURFACE *dst_s);
 
 } // End of namespace Saga
 
-#endif				/* SAGA_ISOMAP_MOD_H_ */
+#endif

Index: ite_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ite_introproc.cpp	29 Apr 2004 03:52:59 -0000	1.6
+++ ite_introproc.cpp	1 May 2004 13:04:31 -0000	1.7
@@ -20,21 +20,15 @@
  * $Header$
  *
  */
-/*
- Description:   
- 
-    Intro sequence scene procedures
 
- Notes: 
-*/
+
[...1214 lines suppressed...]
 		event.type = R_ONESHOT_EVENT;
 		event.code = R_SCENE_EVENT;
 		event.op = EVENT_END;
 		event.time = 5000;
-
 		q_event = EVENT_Chain(q_event_start, &event);
-
 		break;
-
 	case SCENE_END:
-
 		break;
-
 	default:
 		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
 		break;
-
 	}
 
 	return 0;

Index: ite_introproc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ite_introproc.h	30 Apr 2004 23:02:23 -0000	1.3
+++ ite_introproc.h	1 May 2004 13:04:31 -0000	1.4
@@ -20,13 +20,8 @@
  * $Header$
  *
  */
-/*
- Description:	
- 
-	Intro sequence scene procedures header file
 
- Notes: 
-*/
+// Intro sequence scene procedures header file
 
 #ifndef SAGA_ITE_INTRO_H_
 #define SAGA_ITE_INTRO_H_
@@ -47,7 +42,6 @@
 #define CREDIT_DURATION1 4000
 
 enum R_INTRO_SCENE_DIALOGUE_INFO {
-
 	INTRO_CAVE1_START = 0,
 	INTRO_CAVE1_END = 4,
 
@@ -62,29 +56,23 @@
 };
 
 struct R_INTRO_DIALOGUE {
-
 	uint32 i_voice_rn;
 	const char *i_cvar_name;
 	char i_str[R_INTRO_STRMAX];
-
 };
 
 struct INTRO_CAPTION {
-
 	int res_n;
 	char *caption;
-
 };
 
 struct INTRO_CREDIT {
-
 	int text_x;
 	int text_y;
 	int delta_time;
 	int duration;
 	const char *string;
 	int font_id;
-
 };
 
 } // End of namespace Saga

Index: ite_introproc_mod.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc_mod.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ite_introproc_mod.h	12 Apr 2004 21:40:47 -0000	1.1
+++ ite_introproc_mod.h	1 May 2004 13:04:31 -0000	1.2
@@ -20,13 +20,8 @@
  * $Header$
  *
  */
-/*
- Description:	
- 
-	Intro sequence scene procedures - public header file
 
- Notes: 
-*/
+// Intro sequence scene procedures - public header file
 
 #ifndef SAGA_ITE_INTROPROC_MOD_H_
 #define SAGA_ITE_INTROPROC_MOD_H_
@@ -37,4 +32,4 @@
 
 } // End of namespace Saga
 
-#endif				/* SAGA_ITE_INTROPROC_MOD_H_ */
+#endif

Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/music.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- music.cpp	1 May 2004 09:38:03 -0000	1.11
+++ music.cpp	1 May 2004 13:04:31 -0000	1.12
@@ -28,7 +28,7 @@
 #include "music.h"
 #include "rscfile_mod.h"
 #include "game_mod.h"
-#include "sound/mididrv.h"                                                      
+#include "sound/mididrv.h"
 #include "sound/midiparser.h"
 #include "common/config-manager.h"
 #include "common/file.h"
@@ -52,22 +52,22 @@
 	memset(_channel, 0, sizeof(_channel));
 	this->open();
 }
-	
+
 MusicPlayer::~MusicPlayer() {
 	_driver->setTimerCallback(NULL, NULL);
 	_parser->unloadMusic();
 	this->close();
- }
-	
+}
+
 void MusicPlayer::setVolume(int volume) {
 	if (volume < 0)
 		volume = 0;
 	else if (volume > 255)
 		volume = 255;
-	
+
 	if (_masterVolume == volume)
 		return;
-			
+
 	_masterVolume = volume;
 
 	for (int i = 0; i < 16; ++i) {
@@ -76,12 +76,12 @@
 		}
 	}
 }
-	
+
 int MusicPlayer::open() {
 	// Don't ever call open without first setting the output driver!
 	if (!_driver)
 		return 255;
-			
+
 	int ret = _driver->open();
 	if (ret)
 		return ret;
@@ -89,14 +89,14 @@
 	_driver->setTimerCallback(this, &onTimer);
 	return 0;
 }
-	
+
 void MusicPlayer::close() {
 	stopMusic();
 	if (_driver)
 		_driver->close();
 	_driver = 0;
 }
-	
+
 void MusicPlayer::send(uint32 b) {
 	byte channel = (byte)(b & 0x0F);
 	if ((b & 0xFFF0) == 0x07B0) {
@@ -107,48 +107,47 @@
 		b = (b & 0xFF00FFFF) | (volume << 16);
 	} else if ((b & 0xF0) == 0xC0 && !_isGM && !_nativeMT32) {
 		b = (b & 0xFFFF00FF) | mt32_to_gm[(b >> 8) & 0xFF] << 8;
-	} 
+	}
 	else if ((b & 0xFFF0) == 0x007BB0) {
 		//Only respond to All Notes Off if this channel
 		//has currently been allocated
 		if (_channel[b & 0x0F])
 			return;
 	}
-		
+
 	if (!_channel[channel])
 		_channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
 
 	if (_channel[channel])
 		_channel[channel]->send(b);
 }
-	
+
 void MusicPlayer::metaEvent(byte type, byte *data, uint16 length) {
 	//Only thing we care about is End of Track.
 	if (type != 0x2F)
 		return;
-		
-	if (_looping) 
+
+	if (_looping)
 		_parser->jumpToTick(0);
 	else
 		stopMusic();
 }
-	
+
 void MusicPlayer::onTimer(void *refCon) {
 	MusicPlayer *music = (MusicPlayer *)refCon;
 	if (music->_isPlaying)
 		music->_parser->onTimer();
 }
-	
+
 void MusicPlayer::playMusic() {
 	_isPlaying = true;
 }
-	
+
 void MusicPlayer::stopMusic() {
 	_isPlaying = false;
 	_parser->unloadMusic();
 }
 
-
 Music::Music(MidiDriver *driver, int enabled) : _enabled(enabled) {
 	_player = new MusicPlayer(driver);
 	_musicInitialized = 1;
@@ -319,7 +318,7 @@
 	} else {
 		/* Load XMI resource data */
 		GAME_GetFileContext(&rsc_ctxt, R_GAME_RESOURCEFILE, 0);
-        
+
 		if (RSC_LoadResource(rsc_ctxt, music_rn, &resource_data, 
 				&resource_size) != R_SUCCESS ) {
 			R_printf(R_STDERR, "SYSMUSIC_Play(): Resource load failed: %u",

Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/music.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- music.h	30 Apr 2004 23:02:23 -0000	1.4
+++ music.h	1 May 2004 13:04:31 -0000	1.5
@@ -20,13 +20,8 @@
  * $Header$
  *
  */
-/*
- Description:   
- 
-    Music class
 
- Notes: 
-*/
+// Music class
 
 #ifndef SAGA_MUSIC_H_
 #define SAGA_MUSIC_H_
@@ -39,7 +34,6 @@
 
 namespace Saga {
 enum MUSIC_FLAGS {
-
 	R_MUSIC_LOOP = 0x01
 };
 
@@ -48,25 +42,25 @@
 	MusicPlayer(MidiDriver *driver);
 	~MusicPlayer();
 	void setVolume(int volume);
-	int getVolume()			{ return _masterVolume; }
-	
-	void hasNativeMT32(bool b)	{ _nativeMT32 = b; }
+	int getVolume() { return _masterVolume; }
+
+	void hasNativeMT32(bool b) { _nativeMT32 = b; }
 	void playMusic();
 	void stopMusic();
-	void setLoop(bool loop)		{ _looping = loop; }
+	void setLoop(bool loop) { _looping = loop; }
+
+	void setGM(bool isGM) { _isGM = isGM; }
 
-	void setGM(bool isGM)		{ _isGM = isGM; }
-	
 	//MidiDriver interface implementation
 	int open();
 	void close();
 	void send(uint32 b);
-	
+
 	void metaEvent(byte type, byte *data, uint16 length);
-	
+
 	void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
 	uint32 getBaseTempo(void)	{ return _driver ? _driver->getBaseTempo() : 0; }
-	
+
 	//Channel allocation functions
 	MidiChannel *allocateChannel()		{ return 0; }
 	MidiChannel *getPercussionChannel()	{ return 0; }
@@ -82,19 +76,19 @@
 	byte _channelVolume[16];
 	bool _nativeMT32;
 	bool _isGM;
-	
+
 	bool _isPlaying;
 	bool _looping;
 	bool _randomLoop;
 	byte _masterVolume;
-	
+
 	byte *_musicData;
 	uint16 *_buf;
 	uint32 _musicDataSize;
 };
 
 class Music {
- public:
+public:
 
 	Music(MidiDriver *driver, int enabled);
 	~Music(void);
@@ -105,7 +99,7 @@
 	int resume(void);
 	int stop(void);
 
- private:
+private:
 
 	SagaEngine *_vm;
 	SoundMixer *_mixer;
@@ -114,9 +108,8 @@
 
 	int _musicInitialized;
 	int _enabled;
-
- };
+};
 
 } // End of namespace Saga
 
-#endif				/* SAGA_MUSIC_H_ */
+#endif

Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- objectmap.cpp	30 Apr 2004 23:02:23 -0000	1.5
+++ objectmap.cpp	1 May 2004 13:04:31 -0000	1.6
@@ -20,40 +20,25 @@
  * $Header$
  *
  */
-/*
 
- Description:   
- 
-    Object map / Object click-area module 
 
- Notes: 
+// Object map / Object click-area module 
 
-    Polygon Hit Test code ( HitTestPoly() ) adapted from code (C) Eric Haines
-     appearing in Graphics Gems IV, "Point in Polygon Strategies."
-     p. 24-46, code: p. 34-45
-*/
+// Polygon Hit Test code ( HitTestPoly() ) adapted from code (C) Eric Haines
+// appearing in Graphics Gems IV, "Point in Polygon Strategies."
+// p. 24-46, code: p. 34-45
 
 #include "reinherit.h"
 
 #include "yslib.h"
 
-/*
- * Uses the following modules:
-\*--------------------------------------------------------------------------*/
 #include "cvar_mod.h"
 #include "console_mod.h"
 #include "gfx_mod.h"
 #include "font_mod.h"
 
-/*
- * Module options
-\*--------------------------------------------------------------------------*/
-
 #define R_OBJECTMAP_DEBUG R_DEBUG_INFO
 
-/*
- * Begin module
-\*--------------------------------------------------------------------------*/
 #include "objectmap_mod.h"
 #include "objectmap.h"
 
@@ -61,31 +46,22 @@
 
 static R_OBJECTMAP_INFO OMInfo;
 
-int OBJECTMAP_Register(void)
-{
-
-	CVAR_RegisterFunc(CF_object_info,
-	    "object_info", NULL, R_CVAR_NONE, 0, 0);
+int OBJECTMAP_Register() {
+	CVAR_RegisterFunc(CF_object_info, "object_info", NULL, R_CVAR_NONE, 0, 0);
 
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_Init(void)
-/*--------------------------------------------------------------------------*\
- * Initializes the object map module, creates module allocation context
-\*--------------------------------------------------------------------------*/
-{
+// Initializes the object map module, creates module allocation context
+int OBJECTMAP_Init() {
 	R_printf(R_STDOUT, "OBJECTMAP Module: Initializing...\n");
 
 	OMInfo.initialized = 1;
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_Shutdown(void)
-/*--------------------------------------------------------------------------*\
- * Shuts down the object map module, destroys module allocation context
-\*--------------------------------------------------------------------------*/
-{
+// Shuts down the object map module, destroys module allocation context
+int OBJECTMAP_Shutdown() {
 	if (!OMInfo.initialized) {
 		return R_FAILURE;
 	}
@@ -101,11 +77,8 @@
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_Load(const byte * om_res, size_t om_res_len)
-/*--------------------------------------------------------------------------*\
- * Loads an object map resource ( objects ( clickareas ( points ) ) ) 
-\*--------------------------------------------------------------------------*/
-{
+// Loads an object map resource ( objects ( clickareas ( points ) ) ) 
+int OBJECTMAP_Load(const byte *om_res, size_t om_res_len) {
 	const unsigned char *read_p = om_res;
 
 	R_OBJECTMAP_ENTRY *object_map;
@@ -117,8 +90,7 @@
 	YS_IGNORE_PARAM(om_res_len);
 
 	if (!OMInfo.initialized) {
-		R_printf(R_STDERR,
-		    "Error: Object map module not initialized!\n");
+		R_printf(R_STDERR, "Error: Object map module not initialized!\n");
 		return R_FAILURE;
 	}
 
@@ -126,83 +98,63 @@
 		OBJECTMAP_Free();
 	}
 
-	/* Obtain object count N and allocate space for N objects
-	 * \*------------------------------------------------------------- */
+	// Obtain object count N and allocate space for N objects
 	OMInfo.n_objects = ys_read_u16_le(read_p, &read_p);
 
-	OMInfo.object_maps =
-	  (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
+	OMInfo.object_maps = (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
 
 	if (OMInfo.object_maps == NULL) {
 		R_printf(R_STDERR, "Error: Memory allocation failed.\n");
 		return R_MEM;
 	}
 
-	/* Load all N objects
-	 * \*------------------------------------------------------------- */
+	// Load all N objects
 	for (i = 0; i < OMInfo.n_objects; i++) {
-
 		object_map = &OMInfo.object_maps[i];
 		object_map->unknown0 = ys_read_u8(read_p, &read_p);
 		object_map->n_clickareas = ys_read_u8(read_p, &read_p);
 		object_map->flags = ys_read_u16_le(read_p, &read_p);
 		object_map->object_num = ys_read_u16_le(read_p, &read_p);
 		object_map->script_num = ys_read_u16_le(read_p, &read_p);
-
-		object_map->clickareas =
-			(R_CLICKAREA *)malloc(object_map->n_clickareas *
-		    sizeof *(object_map->clickareas));
+		object_map->clickareas = (R_CLICKAREA *)malloc(object_map->n_clickareas * sizeof *(object_map->clickareas));
 
 		if (object_map->clickareas == NULL) {
-			R_printf(R_STDERR,
-			    "Error: Memory allocation failed.\n");
+			R_printf(R_STDERR, "Error: Memory allocation failed.\n");
 			return R_MEM;
 		}
 
-		/* Load all clickareas for this object */
+		// Load all clickareas for this object
 		for (k = 0; k < object_map->n_clickareas; k++) {
-
 			clickarea = &object_map->clickareas[k];
 			clickarea->n_points = ys_read_u16_le(read_p, &read_p);
 			assert(clickarea->n_points != 0);
 
-			clickarea->points =
-			    (R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
-
+			clickarea->points = (R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
 			if (clickarea->points == NULL) {
-				R_printf(R_STDERR,
-				    "Error: Memory allocation failed.\n");
+				R_printf(R_STDERR, "Error: Memory allocation failed.\n");
 				return R_MEM;
 			}
 
-			/* Load all points for this clickarea */
+			// Load all points for this clickarea
 			for (m = 0; m < clickarea->n_points; m++) {
-
 				point = &clickarea->points[m];
 				point->x = ys_read_s16_le(read_p, &read_p);
 				point->y = ys_read_s16_le(read_p, &read_p);
 			}
+#if R_OBJECTMAP_DEBUG >= R_DEBUG_PARANOID
+			R_printf(R_STDOUT, "OBJECTMAP_Load(): Read %d points for clickarea %d in object %d.\n",
+					clickarea->n_points, k, object_map->object_num);
+#endif
+		}
+	}
 
-#           if R_OBJECTMAP_DEBUG >= R_DEBUG_PARANOID
-			R_printf(R_STDOUT,
-			    "OBJECTMAP_Load(): "
-			    "Read %d points for clickarea %d in object %d.\n",
-			    clickarea->n_points, k, object_map->object_num);
-#           endif
-		}		/* End load all clickareas */
-	}			/* End load all objects */
-
-    /*-------------------------------------------------------------*/
 	OMInfo.objects_loaded = 1;
 
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_Free(void)
-/*--------------------------------------------------------------------------*\
- * Frees all storage allocated for the current object map data
-\*--------------------------------------------------------------------------*/
-{
+// Frees all storage allocated for the current object map data
+int OBJECTMAP_Free() {
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
 
@@ -214,7 +166,6 @@
 
 	for (i = 0; i < OMInfo.n_objects; i++) {
 		object_map = &OMInfo.object_maps[i];
-
 		for (k = 0; k < object_map->n_clickareas; k++) {
 			clickarea = &object_map->clickareas[k];
 			free(clickarea->points);
@@ -231,11 +182,8 @@
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
-/*--------------------------------------------------------------------------*\
- * Loads an object name list resource
-\*--------------------------------------------------------------------------*/
-{
+// Loads an object name list resource
+int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len) {
 	const unsigned char *read_p = onl_res;
 
 	int table_len;
@@ -256,9 +204,9 @@
 	OMInfo.n_names = n_names;
 
 #if 0
-#   if R_OBJECTMAP_DEBUG >= R_DEBUG_INFO
+#if R_OBJECTMAP_DEBUG >= R_DEBUG_INFO
 	R_printf(R_STDOUT, "OBJECTMAP_LoadNames: Loading %d object names.\n", n_names);
-#   endif
+#endif
 #endif
 	OMInfo.names = (const char **)malloc(n_names * sizeof *OMInfo.names);
 
@@ -271,10 +219,9 @@
 		name_offset = ys_read_u16_le(read_p, &read_p);
 		OMInfo.names[i] = (const char *)(onl_res + name_offset);
 
-#       if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
-		R_printf(R_STDOUT,
-		    "Loaded object name string: %s\n", OMInfo.names[i]);
-#       endif
+#if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
+		R_printf(R_STDOUT, "Loaded object name string: %s\n", OMInfo.names[i]);
+#endif
 	}
 
 	OMInfo.names_loaded = 1;
@@ -282,11 +229,8 @@
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_FreeNames(void)
-/*--------------------------------------------------------------------------*\
- * Frees all storage allocated for the current object name list data
-\*--------------------------------------------------------------------------*/
-{
+// Frees all storage allocated for the current object name list data
+int OBJECTMAP_FreeNames() {
 	if (!OMInfo.names_loaded) {
 		return R_FAILURE;
 	}
@@ -299,14 +243,11 @@
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_GetName(int object, const char **name)
-/*--------------------------------------------------------------------------*\
- * If 'object' is a valid object number in the currently loaded object 
- *  name list resource, the funciton sets '*name' to the descriptive string
- *  corresponding to 'object' and returns R_SUCCESS. Otherwise it returns
- *  R_FAILURE.
-\*--------------------------------------------------------------------------*/
-{
+// If 'object' is a valid object number in the currently loaded object 
+// name list resource, the funciton sets '*name' to the descriptive string
+// corresponding to 'object' and returns R_SUCCESS. Otherwise it returns
+// R_FAILURE.
+int OBJECTMAP_GetName(int object, const char **name) {
 	if (!OMInfo.names_loaded) {
 		return R_FAILURE;
 	}
@@ -320,8 +261,7 @@
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_GetFlags(int object, uint16 * flags)
-{
+int OBJECTMAP_GetFlags(int object, uint16 *flags) {
 	int i;
 
 	if (!OMInfo.names_loaded) {
@@ -333,9 +273,7 @@
 	}
 
 	for (i = 0; i < OMInfo.n_objects; i++) {
-
 		if (OMInfo.object_maps[i].object_num == object) {
-
 			*flags = OMInfo.object_maps[i].flags;
 			return R_SUCCESS;
 		}
@@ -344,14 +282,11 @@
 	return R_FAILURE;
 }
 
-int OBJECTMAP_GetEPNum(int object, int *ep_num)
-/*--------------------------------------------------------------------------*\
- * If 'object' is a valid object number in the currently loaded object 
- *  name list resource, the funciton sets '*ep_num' to the entrypoint number
- *  corresponding to 'object' and returns R_SUCCESS. Otherwise, it returns
- *  R_FAILURE.
-\*--------------------------------------------------------------------------*/
-{
+// If 'object' is a valid object number in the currently loaded object 
+// name list resource, the funciton sets '*ep_num' to the entrypoint number
+// corresponding to 'object' and returns R_SUCCESS. Otherwise, it returns
+// R_FAILURE.
+int OBJECTMAP_GetEPNum(int object, int *ep_num) {
 	int i;
 
 	if (!OMInfo.names_loaded) {
@@ -374,13 +309,9 @@
 	return R_FAILURE;
 }
 
-int OBJECTMAP_Draw(R_SURFACE * ds, R_POINT * imouse_pt, int color, int color2)
-/*--------------------------------------------------------------------------*\
- * Uses GFX_DrawLine to display all clickareas for each object in the 
- *  currently loaded object map resource.
-\*--------------------------------------------------------------------------*/
-{
-
+// Uses GFX_DrawLine to display all clickareas for each object in the 
+// currently loaded object map resource.
+int OBJECTMAP_Draw(R_SURFACE *ds, R_POINT *imouse_pt, int color, int color2) {
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
 
@@ -402,26 +333,18 @@
 	}
 
 	if (imouse_pt != NULL) {
-
 		if (OBJECTMAP_HitTest(imouse_pt, &object_num) == R_SUCCESS) {
 			hit_object = 1;
 		}
 	}
 
 	for (i = 0; i < OMInfo.n_objects; i++) {
-
 		draw_color = color;
-
-		if (hit_object &&
-		    (object_num == OMInfo.object_maps[i].object_num)) {
-
-			snprintf(txt_buf,
-			    sizeof txt_buf,
-			    "obj %d: ? %d, f %X",
-			    OMInfo.object_maps[i].object_num,
-			    OMInfo.object_maps[i].unknown0,
-			    OMInfo.object_maps[i].flags);
-
+		if (hit_object && (object_num == OMInfo.object_maps[i].object_num)) {
+			snprintf(txt_buf, sizeof txt_buf, "obj %d: ? %d, f %X",
+					OMInfo.object_maps[i].object_num,
+					OMInfo.object_maps[i].unknown0,
+					OMInfo.object_maps[i].flags);
 			draw_txt = 1;
 			draw_color = color2;
 		}
@@ -429,44 +352,26 @@
 		object_map = &OMInfo.object_maps[i];
 
 		for (k = 0; k < object_map->n_clickareas; k++) {
-
 			clickarea = &object_map->clickareas[k];
 			pointcount = 0;
-
 			if (clickarea->n_points == 2) {
-
-				/* 2 points represent a box */
-				GFX_DrawFrame(ds,
-				    &clickarea->points[0],
-				    &clickarea->points[1], draw_color);
+				// 2 points represent a box
+				GFX_DrawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
 			} else if (clickarea->n_points > 2) {
-
-				/* Otherwise draw a polyline */
-
-				GFX_DrawPolyLine(ds,
-				    clickarea->points,
-				    clickarea->n_points, draw_color);
-
+				// Otherwise draw a polyline
+				GFX_DrawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
 			}
-
-		}		/* end for() clickareas */
-	}			/* end for() objects */
+		}
+	}
 
 	if (draw_txt) {
-
-		FONT_Draw(SMALL_FONT_ID,
-		    ds,
-		    txt_buf,
-		    0,
-		    2, 2, SYSGFX_GetWhite(), SYSGFX_GetBlack(), FONT_OUTLINE);
+		FONT_Draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2, SYSGFX_GetWhite(), SYSGFX_GetBlack(), FONT_OUTLINE);
 	}
 
 	return R_SUCCESS;
 }
 
-static bool
-MATH_HitTestPoly(R_POINT * points, unsigned int npoints, R_POINT test_point)
-{
+static bool MATH_HitTestPoly(R_POINT *points, unsigned int npoints, R_POINT test_point) {
 	int yflag0;
 	int yflag1;
 	bool inside_flag = false;
@@ -476,17 +381,11 @@
 	R_POINT *vtx1 = &points[0];
 
 	yflag0 = (vtx0->y >= test_point.y);
-
 	for (pt = 0; pt < npoints; pt++, vtx1++) {
-
 		yflag1 = (vtx1->y >= test_point.y);
-
 		if (yflag0 != yflag1) {
-
 			if (((vtx1->y - test_point.y) * (vtx0->x - vtx1->x) >=
-				(vtx1->x - test_point.x) * (vtx0->y -
-				    vtx1->y)) == yflag1) {
-
+				(vtx1->x - test_point.x) * (vtx0->y - vtx1->y)) == yflag1) {
 				inside_flag = !inside_flag;
 			}
 		}
@@ -497,9 +396,7 @@
 	return inside_flag;
 }
 
-int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num)
-{
-
+int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num) {
 	R_POINT imouse;
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
@@ -513,50 +410,40 @@
 	imouse.x = imouse_pt->x;
 	imouse.y = imouse_pt->y;
 
-	/* Loop through all scene objects */
+	// Loop through all scene objects
 	for (i = 0; i < OMInfo.n_objects; i++) {
-
 		object_map = &OMInfo.object_maps[i];
 
-		/* Hit-test all clickareas for this object */
+		// Hit-test all clickareas for this object
 		for (k = 0; k < object_map->n_clickareas; k++) {
-
 			clickarea = &object_map->clickareas[k];
-
 			n_points = clickarea->n_points;
 			points = clickarea->points;
 
 			if (n_points == 2) {
-				/* Hit-test a box region */
-				if ((imouse.x > points[0].x) &&
-				    (imouse.x <= points[1].x) &&
-				    (imouse.y > points[0].y) &&
-				    (imouse.y <= points[1].y)) {
-
-					*object_num = object_map->object_num;
-
-					return R_SUCCESS;
+				// Hit-test a box region
+				if ((imouse.x > points[0].x) && (imouse.x <= points[1].x) &&
+					(imouse.y > points[0].y) &&
+					(imouse.y <= points[1].y)) {
+						*object_num = object_map->object_num;
+						return R_SUCCESS;
 				}
 			} else if (n_points > 2) {
-				/* Hit-test a polygon */
+				// Hit-test a polygon
 				if (MATH_HitTestPoly(points, n_points, imouse)) {
-
 					*object_num = object_map->object_num;
-
 					return R_SUCCESS;
 				}
 			}
-
-		}		/* end for() clickareas */
-	}			/* end for() objects */
+		}
+	}
 
 	*object_num = 0;
 
 	return R_FAILURE;
 }
 
-static void CF_object_info(int argc, char *argv[])
-{
+static void CF_object_info(int argc, char *argv[]) {
 	int i;
 
 	YS_IGNORE_PARAM(argc);
@@ -569,16 +456,12 @@
 	CON_Print("%d objects loaded.", OMInfo.n_objects);
 
 	for (i = 0; i < OMInfo.n_objects; i++) {
-
 		CON_Print("%s:", OMInfo.names[i]);
-		CON_Print
-		    ("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d",
-		    i, OMInfo.object_maps[i].unknown0,
-		    OMInfo.object_maps[i].flags,
-		    OMInfo.object_maps[i].object_num,
-		    OMInfo.object_maps[i].script_num,
-		    OMInfo.object_maps[i].n_clickareas);
-
+		CON_Print("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i, OMInfo.object_maps[i].unknown0,
+					OMInfo.object_maps[i].flags,
+					OMInfo.object_maps[i].object_num,
+					OMInfo.object_maps[i].script_num,
+					OMInfo.object_maps[i].n_clickareas);
 	}
 
 	return;

Index: objectmap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- objectmap.h	30 Apr 2004 23:02:23 -0000	1.3
+++ objectmap.h	1 May 2004 13:04:31 -0000	1.4
@@ -20,14 +20,8 @@
  * $Header$
  *
  */
-/*
-
- Description:   
- 
-    Object map / Object click-area module header file
 
- Notes: 
-*/
+// Object map / Object click-area module header file
 
 #ifndef SAGA_OBJECTMAP_H_
 #define SAGA_OBJECTMAP_H_
@@ -35,14 +29,11 @@
 namespace Saga {
 
 struct R_CLICKAREA {
-
 	int n_points;
 	R_POINT *points;
-
 };
 
 struct R_OBJECTMAP_ENTRY {
-
 	int unknown0;
 	uint16 flags;
 
@@ -51,11 +42,9 @@
 
 	int n_clickareas;
 	R_CLICKAREA *clickareas;
-
 };
 
 struct R_OBJECTMAP_INFO {
-
 	int initialized;
 
 	int objects_loaded;
@@ -65,11 +54,10 @@
 	int names_loaded;
 	int n_names;
 	const char **names;
-
 };
 
 static void CF_object_info(int argc, char *argv[]);
 
 } // End of namespace Saga
 
-#endif				/* SAGA_OBJECTMAP_H_ */
+#endif

Index: objectmap_mod.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap_mod.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- objectmap_mod.h	30 Apr 2004 23:02:23 -0000	1.2
+++ objectmap_mod.h	1 May 2004 13:04:31 -0000	1.3
@@ -20,14 +20,8 @@
  * $Header$
  *
  */
-/*
-
- Description:   
- 
-    Object map module public header file
 
- Notes: 
-*/
+// Object map module public header file
 
 #ifndef SAGA_OBJECTMAP_MOD_H__
 #define SAGA_OBJECTMAP_MOD_H__
@@ -35,36 +29,22 @@
 namespace Saga {
 
 enum R_OBJECT_FLAGS {
-
 	R_OBJECT_NORMAL = 0x02
 };
 
-int OBJECTMAP_Register(void);
-
-int OBJECTMAP_Init(void);
-
-int OBJECTMAP_Shutdown(void);
-
-int OBJECTMAP_Load(const byte * om_res, size_t om_res_len);
-
-int OBJECTMAP_Free(void);
-
-int OBJECTMAP_LoadNames(const byte * onl_res, size_t onl_res_len);
-
-int OBJECTMAP_FreeNames(void);
-
+int OBJECTMAP_Register();
+int OBJECTMAP_Init();
+int OBJECTMAP_Shutdown();
+int OBJECTMAP_Load(const byte *om_res, size_t om_res_len);
+int OBJECTMAP_Free();
+int OBJECTMAP_LoadNames(const byte *onl_res, size_t onl_res_len);
+int OBJECTMAP_FreeNames();
 int OBJECTMAP_GetName(int object, const char **name);
-
-int OBJECTMAP_GetFlags(int object, uint16 * flags);
-
+int OBJECTMAP_GetFlags(int object, uint16 *flags);
 int OBJECTMAP_GetEPNum(int object, int *ep_num);
-
-int
-OBJECTMAP_Draw(R_SURFACE * draw_surface,
-    R_POINT * imouse_pt, int color, int color2);
-
-int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num);
+int OBJECTMAP_Draw(R_SURFACE *draw_surface, R_POINT *imouse_pt, int color, int color2);
+int OBJECTMAP_HitTest(R_POINT *imouse_pt, int *object_num);
 
 } // End of namespace Saga
 
-#endif				/* SAGA_OBJECTMAP_MOD_H__ */
+#endif





More information about the Scummvm-git-logs mailing list