[Scummvm-git-logs] scummvm master -> 04b237629a7e0f7d9d9eb2f1fd4133e1c3e4c939

aquadran aquadran at gmail.com
Sun Mar 14 07:59:52 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
04b237629a ICB: Reworked global constructor


Commit: 04b237629a7e0f7d9d9eb2f1fd4133e1c3e4c939
    https://github.com/scummvm/scummvm/commit/04b237629a7e0f7d9d9eb2f1fd4133e1c3e4c939
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-03-14T08:59:48+01:00

Commit Message:
ICB: Reworked global constructor

Changed paths:
    engines/icb/camera.cpp
    engines/icb/debug.cpp
    engines/icb/fn_remora_functions.cpp
    engines/icb/function.cpp
    engines/icb/game_script.cpp
    engines/icb/global_switches.cpp
    engines/icb/global_switches.h
    engines/icb/global_vars.cpp
    engines/icb/icon_menu_pc.cpp
    engines/icb/main_menu_pc.cpp
    engines/icb/mission.cpp
    engines/icb/mission_functions.cpp
    engines/icb/options_manager_pc.cpp
    engines/icb/p4.cpp
    engines/icb/p4_pc.cpp
    engines/icb/player.cpp
    engines/icb/player_interaction.cpp
    engines/icb/remora.cpp
    engines/icb/res_man.cpp
    engines/icb/route_manager.cpp
    engines/icb/session.cpp
    engines/icb/set.cpp
    engines/icb/speech.cpp
    engines/icb/stagedraw_pc_poly.cpp
    engines/icb/text_sprites.cpp


diff --git a/engines/icb/camera.cpp b/engines/icb/camera.cpp
index 3312de63aa..e1589db105 100644
--- a/engines/icb/camera.cpp
+++ b/engines/icb/camera.cpp
@@ -364,7 +364,7 @@ void _game_session::Camera_director() {
 
 		if (floor_to_camera_index[this_rect] == 0xffffffff) { // no named camera so its a more complex logic switch
 			// ok, lets assume that there was no special camera!
-			px.display_mode = TEMP_NETHACK; // stick us into temporary nethack mode which will bounce out again if it can
+			g_px->display_mode = TEMP_NETHACK; // stick us into temporary nethack mode which will bounce out again if it can
 			Zdebug("no named camera! - entering TEMP_NETHACK");
 		} else { // ok, there is a named camera! and we know its different from current
 			// different from current
@@ -375,8 +375,8 @@ void _game_session::Camera_director() {
 			anchor_floor = this_rect;
 
 			// if we're not in NETHACK mode then switch in the set
-			if (px.display_mode != NETHACK) {
-				px.display_mode = THREED; // force back in-case we were in TEMP_NETHACK
+			if (g_px->display_mode != NETHACK) {
+				g_px->display_mode = THREED; // force back in-case we were in TEMP_NETHACK
 
 				// init the new set - Initialise_set will record the name of the new camera
 				// it will also handle missing set files and bung us into TEMP_NETHACK mode if it has to
diff --git a/engines/icb/debug.cpp b/engines/icb/debug.cpp
index 574bf63493..474c406a22 100644
--- a/engines/icb/debug.cpp
+++ b/engines/icb/debug.cpp
@@ -73,7 +73,7 @@ void _game_session::Show_lit_unlit_diagnostics() {
 	            255, 0, 0, 0};
 
 	// cross hair is now a development option
-	if (px.cross_hair == FALSE8)
+	if (g_px->cross_hair == FALSE8)
 		return;
 
 	ad = surface_manager->Lock_surface(working_buffer_id);
diff --git a/engines/icb/fn_remora_functions.cpp b/engines/icb/fn_remora_functions.cpp
index 1bb5c38f0e..81b437e1d5 100644
--- a/engines/icb/fn_remora_functions.cpp
+++ b/engines/icb/fn_remora_functions.cpp
@@ -942,7 +942,7 @@ const char *SkipLineNumber(const char *pcLine) {
 	const char *pcParsePos;
 
 	// If line number display is turned on, don't do anything.
-	if (px.speechLineNumbers)
+	if (g_px->speechLineNumbers)
 		return (pcLine);
 
 	// Initialise parse pointer.
diff --git a/engines/icb/function.cpp b/engines/icb/function.cpp
index 2123d0cf00..29f392afb2 100644
--- a/engines/icb/function.cpp
+++ b/engines/icb/function.cpp
@@ -364,7 +364,7 @@ mcodeFunctionReturnCodes _game_session::socket_force_new_logic(int32 &, int32 *p
 
 	script_hash = HashString(script_name);
 
-	if (px.socket_watch)
+	if (g_px->socket_watch)
 		Message_box("socket_force_new_logic - obj %s, script %s", socket_object->GetName(), script_name);
 
 	// now try and find a script with the passed extention i.e. ???::looping
@@ -376,7 +376,7 @@ mcodeFunctionReturnCodes _game_session::socket_force_new_logic(int32 &, int32 *p
 			// get the address of the script we want to run
 			ad = (char *)scripts->Try_fetch_item_by_hash(socket_object->GetScriptNameFullHash(k));
 
-			if (px.socket_watch)
+			if (g_px->socket_watch)
 				Message_box("replacing logic");
 
 			// write actual offset
@@ -801,7 +801,7 @@ mcodeFunctionReturnCodes _game_session::fn_call_socket(int32 &result, int32 *par
 
 	Zdebug("fn_call_socket - obj %s, script %s", target_object_name, socket_script_name);
 
-	if (px.socket_watch)
+	if (g_px->socket_watch)
 		Message_box("%s fn_call_socket - obj %s, script %s", object->GetName(), target_object_name, socket_script_name);
 
 	script_hash = HashString(socket_script_name);
@@ -2370,7 +2370,7 @@ mcodeFunctionReturnCodes _game_session::fn_set_watch(int32 &, int32 *params) {
 
 	// If we are switching back to the player then we need to put the Remora back up if
 	// it was up when we switched to a manual watch (but only in 3D).
-	if (px.display_mode == THREED) {
+	if (g_px->display_mode == THREED) {
 		// Check if switching to player.
 		if (id == player.Fetch_player_id()) {
 			// If the Remora was active, need to bring it back up.
diff --git a/engines/icb/game_script.cpp b/engines/icb/game_script.cpp
index 5979ad45f3..4713410fd2 100644
--- a/engines/icb/game_script.cpp
+++ b/engines/icb/game_script.cpp
@@ -239,7 +239,7 @@ void _game_script::Process_game_script() {
 		break;
 
 	case 'D': // debugging on again
-		px.debugging_and_console = TRUE8;
+		g_px->debugging_and_console = TRUE8;
 		Fetch_next_line();
 		break;
 
@@ -255,10 +255,10 @@ void _game_script::Process_game_script() {
 		pc += 2;
 		Fetch_next_param(p1);
 		Fetch_next_line();
-		px.current_cd = atoi(p1);
+		g_px->current_cd = atoi(p1);
 
-		if ((!px.current_cd) || (px.current_cd > 3))
-			Fatal_error("gamescript tried to set silly cd number %d", px.current_cd);
+		if ((!g_px->current_cd) || (g_px->current_cd > 3))
+			Fatal_error("gamescript tried to set silly cd number %d", g_px->current_cd);
 		break;
 
 	case 'Z': // Signify that the game has been completed
diff --git a/engines/icb/global_switches.cpp b/engines/icb/global_switches.cpp
index 5b695dd0b5..52ccb06a0c 100644
--- a/engines/icb/global_switches.cpp
+++ b/engines/icb/global_switches.cpp
@@ -30,7 +30,7 @@
 namespace ICB {
 
 // projects x's global flags
-c_global_switches px;
+c_global_switches *g_px;
 
 c_global_switches::c_global_switches() {
 	px_fps = 1;               // 12
diff --git a/engines/icb/global_switches.h b/engines/icb/global_switches.h
index 69143c3271..354980163e 100644
--- a/engines/icb/global_switches.h
+++ b/engines/icb/global_switches.h
@@ -81,7 +81,7 @@ public:
 	bool8 game_completed; // Set by gamescript marker - unlocks title screen bonuses
 };
 
-extern c_global_switches px;
+extern c_global_switches *g_px;
 
 } // End of namespace ICB
 
diff --git a/engines/icb/global_vars.cpp b/engines/icb/global_vars.cpp
index f72e1656dd..6f2014fdcf 100644
--- a/engines/icb/global_vars.cpp
+++ b/engines/icb/global_vars.cpp
@@ -138,7 +138,8 @@ void Init_globals() {
 }
 
 void CreateGlobalObjects() {
-	g_ptrArray = new Common::Array<PointerReference>();
+	g_px = new c_global_switches;
+	g_ptrArray = new Common::Array<PointerReference>;
 	g_globalScriptVariables = new CpxGlobalScriptVariables;
 	g_theSequenceManager = new MovieManager;
 	g_while_u_wait_SequenceManager = new MovieManager;
@@ -181,6 +182,7 @@ void CreateGlobalObjects() {
 }
 
 void DestroyGlobalObjects() {
+	delete g_px;
 	delete g_ptrArray;
 	delete g_globalScriptVariables;
 	delete g_theSequenceManager;
diff --git a/engines/icb/icon_menu_pc.cpp b/engines/icb/icon_menu_pc.cpp
index 6fcde36df5..c92d9422cc 100644
--- a/engines/icb/icon_menu_pc.cpp
+++ b/engines/icb/icon_menu_pc.cpp
@@ -371,7 +371,7 @@ void _icon_menu::DrawIconMenu() {
 			pcIconLabel = (const char *)global_text->Try_fetch_item_by_hash(nHashRef);
 
 			// If we found it, display it.
-			if (pcIconLabel && (px.display_mode == THREED)) {
+			if (pcIconLabel && (g_px->display_mode == THREED)) {
 				SetTextColour(255, 255, 255);
 				MS->Create_remora_text(sToRectangle.left, sToRectangle.top - 17, pcIconLabel, 2, PIN_AT_TOP_LEFT, 3, 2, 600);
 				MS->Render_speech(MS->text_bloc);
@@ -383,7 +383,7 @@ void _icon_menu::DrawIconMenu() {
 		nItemCount = m_sDuplicates.s_pnItemCounts[nIconIndex];
 
 		// Only write the number on in 3D mode.
-		if (px.display_mode == THREED) {
+		if (g_px->display_mode == THREED) {
 			// Write the number if greater than 1 or it is the clips or medipacks count.
 			if (((nItemCount > 1) || (nHashRef == HashString(ARMS_HEALTH_NAME)) || (nHashRef == HashString(ARMS_AMMO_NAME))) && x > 0) {
 				snprintf(pcDigits, 16, "%d", m_sDuplicates.s_pnItemCounts[nIconIndex]);
diff --git a/engines/icb/main_menu_pc.cpp b/engines/icb/main_menu_pc.cpp
index f6488fb2b9..5dc8802343 100644
--- a/engines/icb/main_menu_pc.cpp
+++ b/engines/icb/main_menu_pc.cpp
@@ -166,7 +166,7 @@ void Gameover_menu() {
 }
 
 void GameCompleted() {
-	px.game_completed = TRUE8;
+	g_px->game_completed = TRUE8;
 	// Fill in any gaps in the movie library
 	g_theOptionsManager->UnlockMovies();
 }
diff --git a/engines/icb/mission.cpp b/engines/icb/mission.cpp
index 761993c7f9..2c318dac4c 100644
--- a/engines/icb/mission.cpp
+++ b/engines/icb/mission.cpp
@@ -189,7 +189,7 @@ void _mission::___init_mission(const char *new_mission_name, const char *session
 		Fatal_error("new mission no session name");
 
 	// Work out which CD we should be using
-	px.current_cd = WhichCD(new_mission_name);
+	g_px->current_cd = WhichCD(new_mission_name);
 
 	// Need a mission id number fist of all
 	MISSION_ID m = (MISSION_ID)FindMissionNumber(new_mission_name);
@@ -369,14 +369,14 @@ uint32 _mission::Game_cycle() {
 	MS->prev_save_state = MS->Can_save(); // get previous state - used by lifts to see if player is active
 	MS->Set_can_save(FALSE8);             // cant save as default - this is reversed by states that allow save this game cycle
 
-	px.logic_timing = TRUE8;
+	g_px->logic_timing = TRUE8;
 	logic_time = GetMicroTimer();
 	resman_logic_time = 0; // reset
 	xtra_mega_time = 0;
 	session->One_logic_cycle();
 	// work out overall time
 	logic_time = GetMicroTimer() - logic_time;
-	px.logic_timing = FALSE8;
+	g_px->logic_timing = FALSE8;
 
 	// cancel SAVE if watching another mega
 	if (g_mission->camera_follow_id_overide)
@@ -1104,11 +1104,11 @@ __load_result Load_game(const char *filename) {
 }
 
 void _mission::Create_display() {
-	switch (px.display_mode) {
+	switch (g_px->display_mode) {
 	case THREED:
 		// Need this for development safey - but is redundant in final (console-less) game
 		if (!session->SetOK()) {
-			px.display_mode = TEMP_NETHACK; // so we can bounce out again if a real camera/set is found
+			g_px->display_mode = TEMP_NETHACK; // so we can bounce out again if a real camera/set is found
 
 			// Save the actor's control mode
 			session->player.Push_control_mode(ACTOR_RELATIVE);
@@ -1137,7 +1137,7 @@ void _mission::Create_display() {
 
 				// Only render speech when not in REMORA mode
 				// (as REMORA uses speech system to draw its own text)
-				if (px.on_screen_text) {
+				if (g_px->on_screen_text) {
 					session->Render_speech(session->text_speech_bloc);
 
 					// If there is currently a SFX subtitle active then display it.
@@ -1183,7 +1183,7 @@ void _mission::Create_display() {
 			if (!g_oRemora->IsActive() && g_oIconMenu->IsAdding())
 				g_oIconMenu->DrawAdding();
 
-			if (px.mega_timer)
+			if (g_px->mega_timer)
 				session->Display_mega_times();
 
 			// Crude Interaction Highlight
diff --git a/engines/icb/mission_functions.cpp b/engines/icb/mission_functions.cpp
index f5da100d23..fcb9deed23 100644
--- a/engines/icb/mission_functions.cpp
+++ b/engines/icb/mission_functions.cpp
@@ -63,7 +63,7 @@ int32 LoadMission(int32 m, void * /*usr*/) {
 	warning("rs_anims %d files %dKB rs_bg %d files %dKB", rs_anims->Fetch_files_open(), (rs_anims->Fetch_mem_used() / 1024), rs_bg->Fetch_files_open(),
 	        (rs_bg->Fetch_mem_used() / 1024));
 
-	px.current_cd = WhichCD(g_mission_names[m - 1]);
+	g_px->current_cd = WhichCD(g_mission_names[m - 1]);
 
 	// Load in the session (mission_name, session_name)
 	if (Setup_new_mission(g_mission_startup_names[(m - 1) * 2], g_mission_startup_names[(m - 1) * 2 + 1])) {
diff --git a/engines/icb/options_manager_pc.cpp b/engines/icb/options_manager_pc.cpp
index 69dda6d844..11ae6fabe1 100644
--- a/engines/icb/options_manager_pc.cpp
+++ b/engines/icb/options_manager_pc.cpp
@@ -1921,7 +1921,7 @@ void OptionsManager::MoveSelected(bool8 _down_) {
 		else
 			currentlySelected--;
 
-		if (px.game_completed) {
+		if (g_px->game_completed) {
 			if (currentlySelected < 0)
 				m_M_EXTRA_selected = (M_EXTRA_CHOICES)(NUMBER_OF_EXTRA_CHOICES - 1);
 			else
@@ -2378,10 +2378,10 @@ void OptionsManager::AlterSelected(bool8 _right_) {
 
 		switch (m_VIDEO_selected) {
 		case SUBTITLES:
-			if (px.on_screen_text)
-				px.on_screen_text = FALSE8;
+			if (g_px->on_screen_text)
+				g_px->on_screen_text = FALSE8;
 			else
-				px.on_screen_text = TRUE8;
+				g_px->on_screen_text = TRUE8;
 
 			// Chosen noise please
 			PlayChosenFX();
@@ -2390,15 +2390,15 @@ void OptionsManager::AlterSelected(bool8 _right_) {
 
 		case SHADOWS:
 			if (_right_) {
-				if (px.actorShadows == 3)
-					px.actorShadows = -1;
+				if (g_px->actorShadows == 3)
+					g_px->actorShadows = -1;
 				else
-					px.actorShadows++;
+					g_px->actorShadows++;
 			} else {
-				if (px.actorShadows == -1)
-					px.actorShadows = 3;
+				if (g_px->actorShadows == -1)
+					g_px->actorShadows = 3;
 				else
-					px.actorShadows--;
+					g_px->actorShadows--;
 			}
 			// Chosen noise please
 			PlayChosenFX();
@@ -3885,17 +3885,17 @@ void OptionsManager::DrawExtrasScreen(uint32 surface_id) {
 	msg = GetTextFromReference(HashString("opt_movies"));
 	DisplayText(ad, pitch, msg, 0, 130, (m_M_EXTRA_selected == MOVIES) ? SELECTEDFONT : NORMALFONT, TRUE8);
 	msg = GetTextFromReference(HashString("opt_slideshow"));
-	if (px.game_completed)
+	if (g_px->game_completed)
 		DisplayText(ad, pitch, msg, 0, 150, (m_M_EXTRA_selected == SLIDESHOW) ? SELECTEDFONT : NORMALFONT, TRUE8);
 	else
 		DisplayText(ad, pitch, msg, 0, 150, PALEFONT, TRUE8);
 	msg = GetTextFromReference(HashString("opt_playselect"));
-	if (px.game_completed)
+	if (g_px->game_completed)
 		DisplayText(ad, pitch, msg, 0, 170, (m_M_EXTRA_selected == PLAYSELECT) ? SELECTEDFONT : NORMALFONT, TRUE8);
 	else
 		DisplayText(ad, pitch, msg, 0, 170, PALEFONT, TRUE8);
 	msg = GetTextFromReference(HashString("opt_profiles"));
-	if (px.game_completed)
+	if (g_px->game_completed)
 		DisplayText(ad, pitch, msg, 0, 190, (m_M_EXTRA_selected == PROFILES) ? SELECTEDFONT : NORMALFONT, TRUE8);
 	else
 		DisplayText(ad, pitch, msg, 0, 190, PALEFONT, TRUE8);
@@ -4741,7 +4741,7 @@ void OptionsManager::DrawVideoSettings() {
 	msg = GetTextFromReference(HashString("opt_subtitles"));
 	temp = CalculateStringWidth(msg);
 	DisplayText(ad, pitch, msg, halfScreen - temp - 10, hite, (m_VIDEO_selected == SUBTITLES) ? SELECTEDFONT : NORMALFONT, FALSE8);
-	if (px.on_screen_text)
+	if (g_px->on_screen_text)
 		msg = GetTextFromReference(HashString("opt_on"));
 	else
 		msg = GetTextFromReference(HashString("opt_off"));
@@ -4755,13 +4755,13 @@ void OptionsManager::DrawVideoSettings() {
 		msg = GetTextFromReference(HashString("opt_shadows"));
 		temp = CalculateStringWidth(msg);
 		DisplayText(ad, pitch, msg, halfScreen - temp - 10, hite, (m_VIDEO_selected == SHADOWS) ? SELECTEDFONT : NORMALFONT, FALSE8);
-		if (px.actorShadows == -1)
+		if (g_px->actorShadows == -1)
 			msg = GetTextFromReference(HashString("opt_shadows_simple"));
-		else if (px.actorShadows == 1)
+		else if (g_px->actorShadows == 1)
 			msg = GetTextFromReference(HashString("opt_shadows_1"));
-		else if (px.actorShadows == 2)
+		else if (g_px->actorShadows == 2)
 			msg = GetTextFromReference(HashString("opt_shadows_2"));
-		else if (px.actorShadows == 3)
+		else if (g_px->actorShadows == 3)
 			msg = GetTextFromReference(HashString("opt_shadows_3"));
 		else
 			msg = GetTextFromReference(HashString("opt_shadows_off"));
@@ -5543,7 +5543,7 @@ const char *OptionsManager::GetTextFromReference(uint32 hashRef) {
 		// Right we appear to have a present-and-correct line number.  To display it we don't have
 		// to do anything special.  If the displaying of line numbers is turned off then we must skip
 		// past the line number.
-		if (!px.speechLineNumbers) {
+		if (!g_px->speechLineNumbers) {
 			// Skip to first non-space after the line number.
 			const char *pcTextLine = (const char *)(&textLine[nCloseBracePos + 1]);
 			while ((*pcTextLine != '\0') && (*pcTextLine == ' '))
@@ -5882,7 +5882,7 @@ void OptionsManager::PollInput() {
 
 				g_theOptionsManager->DisplayText(ad, pitch, "Extras unlocked", 0, SCREEN_DEPTH - 30, SELECTEDFONT, TRUE8);
 
-				px.game_completed = TRUE8;
+				g_px->game_completed = TRUE8;
 
 				surface_manager->Unlock_surface(working_buffer_id);
 
diff --git a/engines/icb/p4.cpp b/engines/icb/p4.cpp
index 2cca2633aa..4d04ebdb41 100644
--- a/engines/icb/p4.cpp
+++ b/engines/icb/p4.cpp
@@ -217,7 +217,7 @@ void _stub::Update_screen() {
 
 	// Record the next frame of the video if any
 	static uint32 frameNumber = 0;
-	if (px.recordingVideo)
+	if (g_px->recordingVideo)
 		surface_manager->RecordFrame(pxVString("icb%05d.bmp", frameNumber++));
 
 	// Grab screen shots if required
diff --git a/engines/icb/p4_pc.cpp b/engines/icb/p4_pc.cpp
index 7aec12f00a..e1eadd9ea7 100644
--- a/engines/icb/p4_pc.cpp
+++ b/engines/icb/p4_pc.cpp
@@ -127,16 +127,16 @@ void ReadConfigFromIniFile() {
 	warning("Enabling all extras for development purposes");
 	temp = 1;
 	if (temp == 0)
-		px.game_completed = FALSE8;
+		g_px->game_completed = FALSE8;
 	else
-		px.game_completed = TRUE8;
+		g_px->game_completed = TRUE8;
 
 	// Subtitle switch
 	temp = getConfigValueWithDefault(config, "Video Settings", "Subtitles", 1);
 	if (temp == 0)
-		px.on_screen_text = FALSE8;
+		g_px->on_screen_text = FALSE8;
 	else
-		px.on_screen_text = TRUE8;
+		g_px->on_screen_text = TRUE8;
 
 	// Control method
 	temp = getConfigValueWithDefault(config, "Controller Settings", "Method", ACTOR_RELATIVE);
@@ -162,8 +162,8 @@ void Save_config_file() {
 	ConfMan.setInt("music_volume", GetMusicVolume() * 2);
 	ConfMan.setInt("speech_volume", GetMusicVolume() * 2);
 	ConfMan.setInt("sfx_volume", GetMusicVolume() * 2);
-	ConfMan.setBool("subtitles", px.on_screen_text != 0);
-	ConfMan.setBool("game_completed", px.game_completed);
+	ConfMan.setBool("subtitles", g_px->on_screen_text != 0);
+	ConfMan.setBool("game_completed", g_px->game_completed);
 	ConfMan.setBool("actor_relative", g_icb_session->player.Get_control_mode() == ACTOR_RELATIVE);
 
 	// Write the movie library settings
diff --git a/engines/icb/player.cpp b/engines/icb/player.cpp
index ee4dee9cae..e7a738d8ea 100644
--- a/engines/icb/player.cpp
+++ b/engines/icb/player.cpp
@@ -560,7 +560,7 @@ mcodeFunctionReturnCodes _player::Gateway() {
 	c_game_object *ob;
 
 	// Set the player control mode correctly
-	switch (px.display_mode) {
+	switch (g_px->display_mode) {
 	case NETHACK:
 	case TEMP_NETHACK: {
 		// Set the player into ACTOR_RELATIVE mode for nethack modes
diff --git a/engines/icb/player_interaction.cpp b/engines/icb/player_interaction.cpp
index 6ddb6c58d8..36de9db649 100644
--- a/engines/icb/player_interaction.cpp
+++ b/engines/icb/player_interaction.cpp
@@ -242,7 +242,7 @@ void _player::Render_crude_interact_highlight() {
 		return;
 
 	// cross hair is now a development option
-	if (px.cross_hair == FALSE8)
+	if (g_px->cross_hair == FALSE8)
 		return;
 
 	ad = surface_manager->Lock_surface(working_buffer_id);
diff --git a/engines/icb/remora.cpp b/engines/icb/remora.cpp
index 0048f80bae..9638a1d605 100644
--- a/engines/icb/remora.cpp
+++ b/engines/icb/remora.cpp
@@ -160,7 +160,7 @@ void _remora::SetDefaultOrOverrideMode() {
 
 void _remora::DisplayCharacterSpeech(uint32 nHash) {
 	// No character speech is displayed unless sub_titles are turned on
-	if (px.on_screen_text == TRUE8) {
+	if (g_px->on_screen_text == TRUE8) {
 		const char *pcText;
 
 		// Find the text in the resources.
@@ -886,7 +886,7 @@ void _remora::ClearAllText() {
 
 void _remora::DrawVoiceOverText() const {
 	// Here we draw the text that characters may say inside the Remora.
-	if (px.on_screen_text && (m_nSpeechTimer > 0) && (strlen(m_pcSpeechText) > 0)) {
+	if (g_px->on_screen_text && (m_nSpeechTimer > 0) && (strlen(m_pcSpeechText) > 0)) {
 		// Yes we need to display speech text.
 		MS->Create_remora_text(REMORA_SPEECH_X_POSITION, REMORA_SPEECH_Y_POSITION, m_pcSpeechText, 0, PIN_AT_CENTRE, 0, 0, REMORA_DISPLAY_WIDTH);
 
diff --git a/engines/icb/res_man.cpp b/engines/icb/res_man.cpp
index 49676f44c8..04b5443b64 100644
--- a/engines/icb/res_man.cpp
+++ b/engines/icb/res_man.cpp
@@ -339,13 +339,13 @@ uint8 *res_man::Res_open(const char *url, uint32 &url_hash, const char *cluster,
 	params.compressed = compressed;
 	params.not_ready_yet = 0;
 
-	if ((px.logic_timing) && (px.mega_timer)) {
+	if ((g_px->logic_timing) && (g_px->mega_timer)) {
 		time = GetMicroTimer();
 	}
 
 	uint8 *ret = this->Internal_open(&params, ret_len);
 
-	if ((px.logic_timing) && (px.mega_timer)) {
+	if ((g_px->logic_timing) && (g_px->mega_timer)) {
 		time = GetMicroTimer() - time;
 		g_mission->resman_logic_time += time;
 	}
diff --git a/engines/icb/route_manager.cpp b/engines/icb/route_manager.cpp
index a6b0682fb1..03fc954173 100644
--- a/engines/icb/route_manager.cpp
+++ b/engines/icb/route_manager.cpp
@@ -119,7 +119,7 @@ void _game_session::Create_initial_route(__rtype type) {
 	_route_stat res;
 	uint32 time = 0;
 
-	if ((px.logic_timing) && (px.mega_timer))
+	if ((g_px->logic_timing) && (g_px->mega_timer))
 		time = GetMicroTimer();
 
 	Zdebug("create_initial_route");
@@ -180,7 +180,7 @@ void _game_session::Create_initial_route(__rtype type) {
 		M->m_main_route.request_form.error = __ROUTE_REQUEST_PRIM_FAILED;
 	}
 
-	if ((px.logic_timing) && (px.mega_timer)) {
+	if ((g_px->logic_timing) && (g_px->mega_timer)) {
 		time = GetMicroTimer() - time;
 		L->slowest_cycle_time = time;
 	}
diff --git a/engines/icb/session.cpp b/engines/icb/session.cpp
index 43bd4bca85..e253e1d33d 100644
--- a/engines/icb/session.cpp
+++ b/engines/icb/session.cpp
@@ -784,11 +784,11 @@ void _game_session::One_logic_cycle() {
 			// run appropriate logic
 			switch (L->big_mode) {
 			case __SCRIPT: // just running full scripts
-				if (px.mega_timer)
+				if (g_px->mega_timer)
 					script_cycleTimer = GetMicroTimer();
 				Pre_logic_event_check();
 				Script_cycle();
-				if (px.mega_timer) {
+				if (g_px->mega_timer) {
 					script_cycleTimer = GetMicroTimer() - script_cycleTimer;
 					L->cycle_time = script_cycleTimer;
 				}
@@ -798,10 +798,10 @@ void _game_session::One_logic_cycle() {
 				break;
 
 			case __CUSTOM_SIMPLE_ANIMATE: // special simple animator logic
-				if (px.mega_timer)
+				if (g_px->mega_timer)
 					script_cycleTimer = GetMicroTimer();
 				Custom_simple_animator();
-				if (px.mega_timer) {
+				if (g_px->mega_timer) {
 					script_cycleTimer = GetMicroTimer() - script_cycleTimer;
 					L->cycle_time = script_cycleTimer;
 				}
@@ -809,10 +809,10 @@ void _game_session::One_logic_cycle() {
 				break;
 
 			case __CUSTOM_BUTTON_OPERATED_DOOR: // special button operated door
-				if (px.mega_timer)
+				if (g_px->mega_timer)
 					script_cycleTimer = GetMicroTimer();
 				Custom_button_operated_door();
-				if (px.mega_timer) {
+				if (g_px->mega_timer) {
 					script_cycleTimer = GetMicroTimer() - script_cycleTimer;
 					L->cycle_time = script_cycleTimer;
 				}
@@ -820,10 +820,10 @@ void _game_session::One_logic_cycle() {
 				break;
 
 			case __CUSTOM_AUTO_DOOR:
-				if (px.mega_timer)
+				if (g_px->mega_timer)
 					script_cycleTimer = GetMicroTimer();
 				Custom_auto_door();
-				if (px.mega_timer) {
+				if (g_px->mega_timer) {
 					script_cycleTimer = GetMicroTimer() - script_cycleTimer;
 					L->cycle_time = script_cycleTimer;
 				}
diff --git a/engines/icb/set.cpp b/engines/icb/set.cpp
index 7ec913edd6..922e96daae 100644
--- a/engines/icb/set.cpp
+++ b/engines/icb/set.cpp
@@ -43,7 +43,7 @@ namespace ICB {
 
 int32 _game_session::GetSelectedMegaId(void) {
 	selected_mega_id = -1;
-	if ((px.mega_hilite) && (player.interact_selected)) {
+	if ((g_px->mega_hilite) && (player.interact_selected)) {
 		int32 sel_id = player.cur_interact_id;
 		if (logic_structs[sel_id]->image_type != PROP) {
 			selected_mega_id = player.cur_interact_id;
@@ -82,7 +82,7 @@ void _game_session::GetSelectedMegaRGB(uint8 &r, uint8 &g, uint8 &b) {
 
 int32 _game_session::GetSelectedPropId(void) {
 	selected_prop_id = -1;
-	if ((px.prop_hilite) && (player.interact_selected)) {
+	if ((g_px->prop_hilite) && (player.interact_selected)) {
 		int32 sel_id = player.cur_interact_id;
 		if (logic_structs[sel_id]->image_type == PROP) {
 			selected_prop_id = player.cur_interact_id;
@@ -133,7 +133,7 @@ void _game_session::Render_3d_nicos() {
 	            0, 230, 255, 0};
 
 	// is this mode switched on
-	if (px.nicos_displayed == FALSE8)
+	if (g_px->nicos_displayed == FALSE8)
 		return;
 
 	ad = surface_manager->Lock_surface(working_buffer_id);
diff --git a/engines/icb/speech.cpp b/engines/icb/speech.cpp
index 8c39138a47..9c11676a0d 100644
--- a/engines/icb/speech.cpp
+++ b/engines/icb/speech.cpp
@@ -591,7 +591,7 @@ mcodeFunctionReturnCodes _game_session::fn_speak(int32 &, int32 *params) {
 		if (ret_code != TS_OK)
 			Fatal_error("line [%s] text formating is illegal [%s]", text_label, ascii);
 
-		if (px.display_mode == THREED) {
+		if (g_px->display_mode == THREED) {
 
 			// get coords
 			if (logic_structs[speaker_id]->image_type == PROP) {
@@ -753,14 +753,14 @@ void _game_session::Create_remora_text(uint32 x, uint32 y, const char *ascii,
 	else
 		bRemoraLeftFormatting = FALSE8;
 
-	int32 oldFlag = px.speechLineNumbers;
+	int32 oldFlag = g_px->speechLineNumbers;
 
 	// Turn off line numbers for non-spoken lines of dialogue
 	if (*ascii == TS_NON_SPOKEN_LINE)
-		px.speechLineNumbers = 0;
+		g_px->speechLineNumbers = 0;
 
 	text_bloc->MakeTextSprite(analysisAlreadyDone, stopAtLine, bRemoraLeftFormatting);
-	px.speechLineNumbers = (uint8)oldFlag;
+	g_px->speechLineNumbers = (uint8)oldFlag;
 	text_bloc->GetRenderCoords(x, y, pin_pos, margin);
 
 	text_bloc->please_render = TRUE8;
diff --git a/engines/icb/stagedraw_pc_poly.cpp b/engines/icb/stagedraw_pc_poly.cpp
index cc92ceb648..0e4706e4fa 100644
--- a/engines/icb/stagedraw_pc_poly.cpp
+++ b/engines/icb/stagedraw_pc_poly.cpp
@@ -381,7 +381,7 @@ void drawObjects(SDactor &act, PSXLampList &lamplist, PSXrgb *pAmbient, PSXShade
 	_drawGouraud = 1;
 	_drawDebugMesh = 0;
 
-	if (px.texturedActors) {
+	if (g_px->texturedActors) {
 		ChooseTexture(texHan);
 		_drawTxture = 1;
 	} else {
@@ -389,20 +389,20 @@ void drawObjects(SDactor &act, PSXLampList &lamplist, PSXrgb *pAmbient, PSXShade
 		_drawDebugMesh = 1;
 	}
 
-	if (px.litActors) {
+	if (g_px->litActors) {
 		_drawLit = 1;
 	} else {
 		_drawLit = 0;
 	}
 
-	if (px.polyActors) {
+	if (g_px->polyActors) {
 		_drawPolys = 1;
 	} else {
 		_drawPolys = 0;
 		_drawDebugMesh = 1;
 	}
 
-	if (px.wireframeActors) {
+	if (g_px->wireframeActors) {
 		_drawWfrm = 1;
 		_drawDebugMesh = 1;
 	} else {
@@ -413,7 +413,7 @@ void drawObjects(SDactor &act, PSXLampList &lamplist, PSXrgb *pAmbient, PSXShade
 	if (mega->drawShadow) {
 		// Complex shadows have up to nShadows of them
 		// Note: a top-down BLACK will get added if NO shadows are cast
-		nShadows = px.actorShadows;
+		nShadows = g_px->actorShadows;
 	}
 
 	SVECTORPC p_n[MAX_SHADOWS];
@@ -566,7 +566,7 @@ void StageDrawPoly(SDactor *actors, uint32 actorQty) {
 	set->RefreshBackdrop();
 
 	// Call Set Draw to update all the props
-	set->Set_draw(px.frag_help);
+	set->Set_draw(g_px->frag_help);
 
 	// PSX LIGHT RIG SETUP
 	ConvertRLP(set->GetPRig());
@@ -913,7 +913,7 @@ void StageDrawPoly(SDactor *actors, uint32 actorQty) {
 
 							// Now do the semi transparencies for this prop tile
 							uint16 *tilePtrs = pStat->GetSemiTileTable(tileOffset); // pStat->GetSemiTileTable(tileOffset);
-							if ((tilePtrs != NULL) && (px.semitransparencies == TRUE8)) {
+							if ((tilePtrs != NULL) && (g_px->semitransparencies == TRUE8)) {
 								uint16 *tPtr = tilePtrs;
 								uint32 *bufRGB = source + offset;
 								uint16 *bufZ = zActor + offset;
@@ -1053,7 +1053,7 @@ void StageDrawPoly(SDactor *actors, uint32 actorQty) {
 
 						// Now add the static semitransparencies
 						uint16 *tilePtrs = sceneZ->GetSemiTileTable(tileOffset);
-						if ((tilePtrs != NULL) && (px.semitransparencies == TRUE8)) {
+						if ((tilePtrs != NULL) && (g_px->semitransparencies == TRUE8)) {
 							uint16 *tPtr = tilePtrs;
 							uint32 *bufRGB = source + offset;
 							uint16 *bufZ = zActor + offset;
diff --git a/engines/icb/text_sprites.cpp b/engines/icb/text_sprites.cpp
index 7da2950cbd..f99b4328fd 100644
--- a/engines/icb/text_sprites.cpp
+++ b/engines/icb/text_sprites.cpp
@@ -177,7 +177,7 @@ _TSrtn text_sprite::MakeTextSprite(bool8 analysisAlreadyDone, int32 stopAtLine,
 			// Right we appear to have a present-and-correct line number.  To display it we don't have
 			// to do anything special.  If the displaying of line numbers is turned off then we must skip
 			// past the line number.
-			if (!px.speechLineNumbers) {
+			if (!g_px->speechLineNumbers) {
 				// Skip to first non-space after the line number.
 				pcTextLine = (const char *)(&params.textLine[nCloseBracePos + 1]);
 				while ((*pcTextLine != '\0') && (*pcTextLine == ' '))




More information about the Scummvm-git-logs mailing list