[Scummvm-git-logs] scummvm master -> cc123913f48e96213c5eaa8a188a26b0af422938
dreammaster
dreammaster at scummvm.org
Sun Feb 7 04:14:25 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:
cc123913f4 AGS: Change a bunch of int to be explicitly int32_t & uint32_t
Commit: cc123913f48e96213c5eaa8a188a26b0af422938
https://github.com/scummvm/scummvm/commit/cc123913f48e96213c5eaa8a188a26b0af422938
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-02-06T20:13:05-08:00
Commit Message:
AGS: Change a bunch of int to be explicitly int32_t & uint32_t
This should solve the errors on some systems where int didn't
match int32
Changed paths:
engines/ags/engine/ac/character.cpp
engines/ags/engine/ac/character.h
engines/ags/engine/ac/dialog.cpp
engines/ags/engine/ac/game.cpp
engines/ags/engine/ac/gamestate.cpp
engines/ags/engine/ac/gamestate.h
engines/ags/engine/ac/lipsync.h
engines/ags/engine/ac/movelist.h
engines/ags/engine/ac/roomobject.cpp
engines/ags/engine/ac/roomobject.h
engines/ags/engine/ac/roomstatus.h
engines/ags/engine/game/game_init.cpp
engines/ags/engine/game/savegame_internal.h
engines/ags/engine/main/engine.cpp
engines/ags/engine/main/update.cpp
engines/ags/engine/main/update.h
engines/ags/engine/platform/base/agsplatformdriver.h
engines/ags/lib/allegro/fixed.h
engines/ags/lib/allegro/system.cpp
engines/ags/lib/allegro/system.h
engines/ags/shared/ac/characterinfo.h
engines/ags/shared/ac/dialogtopic.h
engines/ags/shared/core/platform.h
engines/ags/shared/util/geometry.h
diff --git a/engines/ags/engine/ac/character.cpp b/engines/ags/engine/ac/character.cpp
index 5e7623a7aa..7db64928e7 100644
--- a/engines/ags/engine/ac/character.cpp
+++ b/engines/ags/engine/ac/character.cpp
@@ -1856,7 +1856,7 @@ int doNextCharMoveStep(CharacterInfo *chi, int &char_index, CharacterExtras *che
return 0;
}
-int find_nearest_walkable_area_within(int *xx, int *yy, int range, int step) {
+int find_nearest_walkable_area_within(int32_t *xx, int32_t *yy, int range, int step) {
int ex, ey, nearest = 99999, thisis, nearx = 0, neary = 0;
int startx = 0, starty = 14;
int roomWidthLowRes = room_to_mask_coord(thisroom.Width);
@@ -1914,7 +1914,7 @@ int find_nearest_walkable_area_within(int *xx, int *yy, int range, int step) {
return 0;
}
-void find_nearest_walkable_area(int *xx, int *yy) {
+void find_nearest_walkable_area(int32_t *xx, int32_t *yy) {
int pixValue = thisroom.WalkAreaMask->GetPixel(room_to_mask_coord(xx[0]), room_to_mask_coord(yy[0]));
// only fix this code if the game was built with 2.61 or above
diff --git a/engines/ags/engine/ac/character.h b/engines/ags/engine/ac/character.h
index c2ee1c668a..41aba50dc2 100644
--- a/engines/ags/engine/ac/character.h
+++ b/engines/ags/engine/ac/character.h
@@ -184,8 +184,8 @@ void fix_player_sprite(MoveList *cmls, CharacterInfo *chinf);
// Check whether two characters have walked into each other
int has_hit_another_character(int sourceChar);
int doNextCharMoveStep(CharacterInfo *chi, int &char_index, CharacterExtras *chex);
-int find_nearest_walkable_area_within(int *xx, int *yy, int range, int step);
-void find_nearest_walkable_area(int *xx, int *yy);
+int find_nearest_walkable_area_within(int32_t *xx, int32_t *yy, int range, int step);
+void find_nearest_walkable_area(int32_t *xx, int32_t *yy);
void walk_character(int chac, int tox, int toy, int ignwal, bool autoWalkAnims);
void FindReasonableLoopForCharacter(CharacterInfo *chap);
void walk_or_move_character(CharacterInfo *chaa, int x, int y, int blocking, int direct, bool isWalk);
diff --git a/engines/ags/engine/ac/dialog.cpp b/engines/ags/engine/ac/dialog.cpp
index cd7f1b294e..70d568525e 100644
--- a/engines/ags/engine/ac/dialog.cpp
+++ b/engines/ags/engine/ac/dialog.cpp
@@ -1030,7 +1030,7 @@ int show_dialog_options(int _dlgnum, int sayChosenOption, bool _runGameLoopsInBa
int dialog_choice = DlgOpt.chose;
if (dialog_choice != CHOSE_TEXTPARSER) {
DialogTopic *dialog_topic = DlgOpt.dtop;
- int &option_flags = dialog_topic->optionflags[dialog_choice];
+ int32_t &option_flags = dialog_topic->optionflags[dialog_choice];
const char *option_name = DlgOpt.dtop->optionnames[dialog_choice];
option_flags |= DFLG_HASBEENCHOSEN;
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index abd02ed02e..37967c343c 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -1191,7 +1191,7 @@ void restore_game_play(Stream *in, RestoredData &r_data) {
int screenfadedout_was = play.screen_is_faded_out;
int roomchanges_was = play.room_changes;
// make sure the pointer is preserved
- int *gui_draw_order_was = play.gui_draw_order;
+ int32_t *gui_draw_order_was = play.gui_draw_order;
ReadGameState_Aligned(in, r_data);
r_data.Cameras[0].Flags = r_data.Camera0_Flags;
diff --git a/engines/ags/engine/ac/gamestate.cpp b/engines/ags/engine/ac/gamestate.cpp
index 347899db76..3d89843686 100644
--- a/engines/ags/engine/ac/gamestate.cpp
+++ b/engines/ags/engine/ac/gamestate.cpp
@@ -234,7 +234,7 @@ PViewport GameState::CreateRoomViewport() {
viewport->SetRect(_mainViewport.GetRect());
ScriptViewport *scv = new ScriptViewport(index);
_roomViewports.push_back(viewport);
- _scViewportRefs.push_back(std::make_pair(scv, 0));
+ _scViewportRefs.push_back(std::make_pair(scv, (int32_t)0));
_roomViewportsSorted.push_back(viewport);
_roomViewportZOrderChanged = true;
on_roomviewport_created(index);
@@ -291,7 +291,7 @@ PCamera GameState::CreateRoomCamera() {
camera->SetAt(0, 0);
camera->SetSize(_mainViewport.GetRect().GetSize());
ScriptCamera *scam = new ScriptCamera(index);
- _scCameraRefs.push_back(std::make_pair(scam, 0));
+ _scCameraRefs.push_back(std::make_pair(scam, (int32_t)0));
_roomCameras.push_back(camera);
return camera;
}
diff --git a/engines/ags/engine/ac/gamestate.h b/engines/ags/engine/ac/gamestate.h
index 0285962a5e..486dd2423e 100644
--- a/engines/ags/engine/ac/gamestate.h
+++ b/engines/ags/engine/ac/gamestate.h
@@ -73,7 +73,7 @@ struct GameState {
int disabled_user_interface; // >0 while in cutscene/etc
int gscript_timer; // obsolete
int debug_mode; // whether we're in debug mode
- int globalvars[MAXGLOBALVARS]; // obsolete
+ int32_t globalvars[MAXGLOBALVARS]; // obsolete
int messagetime; // time left for auto-remove messages
int usedinv; // inventory item last used
int inv_top, inv_numdisp, obsolete_inv_numorder, inv_numinline;
@@ -147,7 +147,7 @@ struct GameState {
int speech_display_post_time_ms; // keep speech text/portrait on screen after text/voice has finished playing;
// no speech animation is supposed to be played at this time
int dialog_options_highlight_color; // The colour used for highlighted (hovered over) text in dialog options
- int reserved[GAME_STATE_RESERVED_INTS]; // make sure if a future version adds a var, it doesn't mess anything up
+ int32_t reserved[GAME_STATE_RESERVED_INTS]; // make sure if a future version adds a var, it doesn't mess anything up
// ** up to here is referenced in the script "game." object
long randseed; // random seed
int player_on_region; // player's current region
@@ -161,7 +161,7 @@ struct GameState {
short mboundx1, mboundx2, mboundy1, mboundy2;
int fade_effect;
int bg_frame_locked;
- int globalscriptvars[MAXGSVALUES];
+ int32_t globalscriptvars[MAXGSVALUES];
int cur_music_number, music_repeat;
int music_master_volume;
int digital_master_volume;
@@ -170,7 +170,7 @@ struct GameState {
int entered_at_x, entered_at_y, entered_edge;
int want_speech;
int cant_skip_speech;
- int script_timers[MAX_TIMERS];
+ int32_t script_timers[MAX_TIMERS];
int sound_volume, speech_volume;
int normal_font, speech_font;
char key_skip_wait;
@@ -183,7 +183,7 @@ struct GameState {
short parsed_words[MAX_PARSED_WORDS];
char bad_parsed_word[100];
int raw_color;
- int raw_modified[MAX_ROOM_BGFRAMES];
+ int32_t raw_modified[MAX_ROOM_BGFRAMES];
Shared::PBitmap raw_drawing_surface;
short filenumbers[MAXSAVEGAMES];
int room_changes;
@@ -222,11 +222,11 @@ struct GameState {
int gamma_adjustment;
short temporarily_turned_off_character; // Hide Player Charactr ticked
short inv_backwards_compatibility;
- int *gui_draw_order;
+ int32_t *gui_draw_order;
std::vector<AGS::Shared::String> do_once_tokens;
int text_min_display_time_ms;
int ignore_user_input_after_text_timeout_ms;
- int default_audio_type_volumes[MAX_AUDIO_TYPES];
+ int32_t default_audio_type_volumes[MAX_AUDIO_TYPES];
// Dynamic custom property values for characters and items
std::vector<AGS::Shared::StringIMap> charProps;
diff --git a/engines/ags/engine/ac/lipsync.h b/engines/ags/engine/ac/lipsync.h
index d5ef6e2bbf..ec36cbed00 100644
--- a/engines/ags/engine/ac/lipsync.h
+++ b/engines/ags/engine/ac/lipsync.h
@@ -23,11 +23,13 @@
#ifndef AGS_ENGINE_AC_LIPSYNC_H
#define AGS_ENGINE_AC_LIPSYNC_H
+#include "ags/shared/core/types.h"
+
namespace AGS3 {
struct SpeechLipSyncLine {
char filename[14];
- int *endtimeoffs;
+ int32_t *endtimeoffs;
short *frame;
short numPhonemes;
};
diff --git a/engines/ags/engine/ac/movelist.h b/engines/ags/engine/ac/movelist.h
index d9672b1d80..e8cc8570b6 100644
--- a/engines/ags/engine/ac/movelist.h
+++ b/engines/ags/engine/ac/movelist.h
@@ -41,7 +41,7 @@ using namespace AGS; // FIXME later
#define MAXNEEDSTAGES_LEGACY 40
struct MoveList {
- int pos[MAXNEEDSTAGES];
+ int32_t pos[MAXNEEDSTAGES];
int numstage;
fixed xpermove[MAXNEEDSTAGES], ypermove[MAXNEEDSTAGES];
int fromx, fromy;
diff --git a/engines/ags/engine/ac/roomobject.cpp b/engines/ags/engine/ac/roomobject.cpp
index 858ab3737d..cc1ed9fbe4 100644
--- a/engines/ags/engine/ac/roomobject.cpp
+++ b/engines/ags/engine/ac/roomobject.cpp
@@ -153,14 +153,20 @@ void RoomObject::update_cycle_view_backwards() {
}
void RoomObject::ReadFromFile(Stream *in) {
- in->ReadArrayOfInt32(&x, 3);
+ x = in->ReadInt32();
+ y = in->ReadInt32();
+ transparent = in->ReadInt32();
+
in->ReadArrayOfInt16(&tint_r, 15);
in->ReadArrayOfInt8((int8_t *)&cycling, 4);
in->ReadArrayOfInt16(&blocking_width, 2);
}
void RoomObject::WriteToFile(Stream *out) const {
- out->WriteArrayOfInt32(&x, 3);
+ out->WriteInt32(x);
+ out->WriteInt32(y);
+ out->WriteInt32(transparent);
+
out->WriteArrayOfInt16(&tint_r, 15);
out->WriteArrayOfInt8((const int8_t *)&cycling, 4);
out->WriteArrayOfInt16(&blocking_width, 2);
diff --git a/engines/ags/engine/ac/roomobject.h b/engines/ags/engine/ac/roomobject.h
index d14c5a33fd..d3398cc4de 100644
--- a/engines/ags/engine/ac/roomobject.h
+++ b/engines/ags/engine/ac/roomobject.h
@@ -24,6 +24,7 @@
#define AGS_ENGINE_AC_ROOMOBJECT_H
#include "ags/shared/ac/common_defines.h"
+#include "ags/shared/core/types.h"
namespace AGS3 {
@@ -37,8 +38,8 @@ using namespace AGS; // FIXME later
// IMPORTANT: this struct is restricted by plugin API!
struct RoomObject {
- int x, y;
- int transparent; // current transparency setting
+ int32_t x, y;
+ int32_t transparent; // current transparency setting
short tint_r, tint_g; // specific object tint
short tint_b, tint_level;
short tint_light;
diff --git a/engines/ags/engine/ac/roomstatus.h b/engines/ags/engine/ac/roomstatus.h
index 89d982539a..3be1e11ee0 100644
--- a/engines/ags/engine/ac/roomstatus.h
+++ b/engines/ags/engine/ac/roomstatus.h
@@ -66,7 +66,7 @@ struct RoomStatus {
char hotspot_enabled[MAX_ROOM_HOTSPOTS];
char region_enabled[MAX_ROOM_REGIONS];
short walkbehind_base[MAX_WALK_BEHINDS];
- int interactionVariableValues[MAX_GLOBAL_VARIABLES];
+ int32_t interactionVariableValues[MAX_GLOBAL_VARIABLES];
RoomStatus();
~RoomStatus();
diff --git a/engines/ags/engine/game/game_init.cpp b/engines/ags/engine/game/game_init.cpp
index 5813e7e6c9..7f33733c53 100644
--- a/engines/ags/engine/game/game_init.cpp
+++ b/engines/ags/engine/game/game_init.cpp
@@ -415,7 +415,7 @@ HGameInitError InitGameState(const LoadedGameEntities &ents, GameDataVersion dat
// labels are not clickable by default
guilabels[i].SetClickable(false);
}
- play.gui_draw_order = (int *)calloc(game.numgui * sizeof(int), 1);
+ play.gui_draw_order = (int32_t *)calloc(game.numgui * sizeof(int32_t), 1);
update_gui_zorder();
calculate_reserved_channel_count();
diff --git a/engines/ags/engine/game/savegame_internal.h b/engines/ags/engine/game/savegame_internal.h
index 29661bdc7c..cbd1d81847 100644
--- a/engines/ags/engine/game/savegame_internal.h
+++ b/engines/ags/engine/game/savegame_internal.h
@@ -81,10 +81,10 @@ struct RestoredData {
std::vector<ScriptData> ScriptModules;
// Room data (has to be be preserved until room is loaded)
PBitmap RoomBkgScene[MAX_ROOM_BGFRAMES];
- short RoomLightLevels[MAX_ROOM_REGIONS];
- int RoomTintLevels[MAX_ROOM_REGIONS];
- short RoomZoomLevels1[MAX_WALK_AREAS + 1];
- short RoomZoomLevels2[MAX_WALK_AREAS + 1];
+ int16_t RoomLightLevels[MAX_ROOM_REGIONS];
+ int32_t RoomTintLevels[MAX_ROOM_REGIONS];
+ int16_t RoomZoomLevels1[MAX_WALK_AREAS + 1];
+ int16_t RoomZoomLevels2[MAX_WALK_AREAS + 1];
RoomVolumeMod RoomVolume;
// Mouse cursor parameters
int CursorID;
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index cd1940f046..ed3911a7aa 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -344,7 +344,7 @@ void engine_locate_speech_pak() {
for (int ee = 0; ee < numLipLines; ee++) {
splipsync[ee].numPhonemes = speechsync->ReadInt16();
speechsync->Read(splipsync[ee].filename, 14);
- splipsync[ee].endtimeoffs = (int *)malloc(splipsync[ee].numPhonemes * sizeof(int));
+ splipsync[ee].endtimeoffs = (int32_t *)malloc(splipsync[ee].numPhonemes * sizeof(int32_t));
speechsync->ReadArrayOfInt32(splipsync[ee].endtimeoffs, splipsync[ee].numPhonemes);
splipsync[ee].frame = (short *)malloc(splipsync[ee].numPhonemes * sizeof(short));
speechsync->ReadArrayOfInt16(splipsync[ee].frame, splipsync[ee].numPhonemes);
diff --git a/engines/ags/engine/main/update.cpp b/engines/ags/engine/main/update.cpp
index 4f8298bc8f..65a67b5034 100644
--- a/engines/ags/engine/main/update.cpp
+++ b/engines/ags/engine/main/update.cpp
@@ -74,7 +74,7 @@ extern int numLipLines, curLipLine, curLipLinePhoneme;
extern int is_text_overlay;
extern IGraphicsDriver *gfxDriver;
-int do_movelist_move(short *mlnum, int *xx, int *yy) {
+int do_movelist_move(int16_t *mlnum, int32_t *xx, int32_t *yy) {
int need_to_fix_sprite = 0;
if (mlnum[0] < 1) quit("movelist_move: attempted to move on a non-exist movelist");
MoveList *cmls;
diff --git a/engines/ags/engine/main/update.h b/engines/ags/engine/main/update.h
index 8d478685b1..796441d645 100644
--- a/engines/ags/engine/main/update.h
+++ b/engines/ags/engine/main/update.h
@@ -27,8 +27,8 @@ namespace AGS3 {
#define MAX_SHEEP 30 // sheep == follower
-int do_movelist_move(short *mlnum, int *xx, int *yy);
-void update_stuff();
+extern int do_movelist_move(int16_t *mlnum, int32_t *xx, int32_t *yy);
+extern void update_stuff();
} // namespace AGS3
diff --git a/engines/ags/engine/platform/base/agsplatformdriver.h b/engines/ags/engine/platform/base/agsplatformdriver.h
index a925fbaf3e..4f056c3341 100644
--- a/engines/ags/engine/platform/base/agsplatformdriver.h
+++ b/engines/ags/engine/platform/base/agsplatformdriver.h
@@ -154,7 +154,7 @@ struct AGSPlatformDriver
virtual void UnRegisterGameWithGameExplorer();
virtual int ConvertKeycodeToScanCode(int keyCode);
// Adjust window size to ensure it is in the supported limits
- virtual void ValidateWindowSize(int &x, int &y, bool borderless) const {
+ virtual void ValidateWindowSize(int32_t &x, int32_t &y, bool borderless) const {
}
virtual int InitializeCDPlayer() = 0; // return 0 on success
diff --git a/engines/ags/lib/allegro/fixed.h b/engines/ags/lib/allegro/fixed.h
index da0a7a5d85..d658c6d817 100644
--- a/engines/ags/lib/allegro/fixed.h
+++ b/engines/ags/lib/allegro/fixed.h
@@ -24,10 +24,11 @@
#define AGS_LIB_ALLEGRO_FIXED_H
#include "common/scummsys.h"
+#include "ags/shared/core/types.h"
namespace AGS3 {
-typedef int32 fixed;
+typedef int32_t fixed;
extern fixed fixtorad_r;
extern fixed radtofix_r;
diff --git a/engines/ags/lib/allegro/system.cpp b/engines/ags/lib/allegro/system.cpp
index 765fdee3c4..d256e0f813 100644
--- a/engines/ags/lib/allegro/system.cpp
+++ b/engines/ags/lib/allegro/system.cpp
@@ -105,7 +105,7 @@ int get_color_depth() {
return _color_depth;
}
-int get_desktop_resolution(int *width, int *height) {
+int get_desktop_resolution(int32_t *width, int32_t *height) {
// TODO: ScummVM has a hardcoded dummy desktop resolution. See if there's any
// need to change the values, given we're hardcoded for pretend full-screen
if (width)
diff --git a/engines/ags/lib/allegro/system.h b/engines/ags/lib/allegro/system.h
index aef878d8ed..295f4af48c 100644
--- a/engines/ags/lib/allegro/system.h
+++ b/engines/ags/lib/allegro/system.h
@@ -26,6 +26,7 @@
#include "ags/lib/allegro/base.h"
#include "ags/lib/allegro/color.h"
#include "ags/lib/allegro/gfx.h"
+#include "ags/shared/core/types.h"
namespace AGS3 {
@@ -141,7 +142,7 @@ extern _DRIVER_INFO _system_driver_list[];
extern void set_color_depth(int depth);
extern int get_color_depth();
-extern int get_desktop_resolution(int *width, int *height);
+extern int get_desktop_resolution(int32_t *width, int32_t *height);
extern void request_refresh_rate(int rate);
extern void set_close_button_callback(void(*proc)());
diff --git a/engines/ags/shared/ac/characterinfo.h b/engines/ags/shared/ac/characterinfo.h
index b8175c0062..47cda1b149 100644
--- a/engines/ags/shared/ac/characterinfo.h
+++ b/engines/ags/shared/ac/characterinfo.h
@@ -24,6 +24,7 @@
#define AGS_SHARED_AC_CHARACTERINFO_H
#include "ags/shared/ac/common_defines.h" // constants
+#include "ags/shared/core/types.h"
namespace AGS3 {
@@ -69,7 +70,7 @@ struct CharacterInfo {
int talkview;
int view;
int room, prevroom;
- int x, y, wait;
+ int32_t x, y, wait;
int flags;
short following;
short followinfo;
diff --git a/engines/ags/shared/ac/dialogtopic.h b/engines/ags/shared/ac/dialogtopic.h
index 8fb0031e10..3831b3f1e0 100644
--- a/engines/ags/shared/ac/dialogtopic.h
+++ b/engines/ags/shared/ac/dialogtopic.h
@@ -23,6 +23,8 @@
#ifndef AGS_SHARED_AC_DIALOGTOPIC_H
#define AGS_SHARED_AC_DIALOGTOPIC_H
+#include "ags/shared/core/types.h"
+
namespace AGS3 {
namespace AGS {
@@ -62,7 +64,7 @@ using namespace AGS; // FIXME later
#define DCHAR_PLAYER 998
struct DialogTopic {
char optionnames[MAXTOPICOPTIONS][150];
- int optionflags[MAXTOPICOPTIONS];
+ int32_t optionflags[MAXTOPICOPTIONS];
unsigned char *optionscripts;
short entrypoints[MAXTOPICOPTIONS];
short startupentrypoint;
diff --git a/engines/ags/shared/core/platform.h b/engines/ags/shared/core/platform.h
index 93479a49d5..3f64d691c4 100644
--- a/engines/ags/shared/core/platform.h
+++ b/engines/ags/shared/core/platform.h
@@ -23,7 +23,7 @@
#ifndef AGS_SHARED_CORE_PLATFORM_H
#define AGS_SHARED_CORE_PLATFORM_H
-#include <common/scummsys.h>
+#include "common/scummsys.h"
namespace AGS3 {
diff --git a/engines/ags/shared/util/geometry.h b/engines/ags/shared/util/geometry.h
index d24e33ada2..540a1de627 100644
--- a/engines/ags/shared/util/geometry.h
+++ b/engines/ags/shared/util/geometry.h
@@ -30,6 +30,7 @@
#define AGS_SHARED_UTIL_GEOMETRY_H
#include "ags/shared/util/math.h"
+#include "ags/shared/core/types.h"
namespace AGS3 {
@@ -143,15 +144,15 @@ inline Line VLine(int x, int y1, int y2) {
}
struct Size {
- int Width;
- int Height;
+ int32_t Width;
+ int32_t Height;
Size() {
Width = 0;
Height = 0;
}
- Size(int width, int height) {
+ Size(int32_t width, int32_t height) {
Width = width;
Height = height;
}
More information about the Scummvm-git-logs
mailing list