AGS: More standardization of int vs int32_t

This commit is contained in:
Paul Gilbert 2021-02-06 22:22:04 -08:00
parent 1b11fe993c
commit f6077152d1
11 changed files with 25 additions and 22 deletions

View File

@ -80,7 +80,7 @@ bool GUIMain::HasAlphaChannel() const {
// Engine-specific implementation split out of acgui.h
//=============================================================================
void check_font(int *fontnum) {
void check_font(int32_t *fontnum) {
// do nothing
}

View File

@ -1549,7 +1549,7 @@ bool ccInstance::AddGlobalVar(const ScriptVariable &glvar) {
*/
Debug::Printf(kDbgMsg_Warn, "WARNING: global variable refers to data beyond allocated buffer (%d, %d)", glvar.ScAddress, globaldatasize);
}
globalvars->insert(std::make_pair(glvar.ScAddress, glvar));
globalvars->insert(std::make_pair((int)glvar.ScAddress, glvar));
return true;
}

View File

@ -108,7 +108,7 @@ struct ScriptPosition {
struct ccInstance {
public:
// TODO: change to std:: if moved to C++11
typedef std::unordered_map<int32_t, ScriptVariable> ScVarMap;
typedef std::unordered_map<int, ScriptVariable> ScVarMap;
typedef std::shared_ptr<ScVarMap> PScVarMap;
public:
int32_t flags;

View File

@ -127,7 +127,7 @@ void GameSetupStruct::read_font_infos(Shared::Stream *in, GameDataVersion data_v
for (int i = 0; i < numfonts; ++i) {
fonts[i].YOffset = in->ReadInt32();
if (data_ver >= kGameVersion_341_2)
fonts[i].LineSpacing = Math::Max(0, in->ReadInt32());
fonts[i].LineSpacing = Math::Max((int32_t)0, in->ReadInt32());
}
} else {
for (int i = 0; i < numfonts; ++i) {
@ -135,7 +135,7 @@ void GameSetupStruct::read_font_infos(Shared::Stream *in, GameDataVersion data_v
fonts[i].SizePt = in->ReadInt32();
fonts[i].Outline = in->ReadInt32();
fonts[i].YOffset = in->ReadInt32();
fonts[i].LineSpacing = Math::Max(0, in->ReadInt32());
fonts[i].LineSpacing = Math::Max((int32_t)0, in->ReadInt32());
AdjustFontInfoUsingFlags(fonts[i], flags);
if (data_ver >= kGameVersion_351) {
fonts[i].AutoOutlineThickness = in->ReadInt32();

View File

@ -50,7 +50,7 @@ struct GameSetupStructBase {
static const int NUM_INTS_RESERVED = 17;
char gamename[GAME_NAME_LENGTH];
int options[MAX_OPTIONS];
int32_t options[MAX_OPTIONS];
unsigned char paluses[256];
color defpal[256];
int numviews;
@ -69,14 +69,14 @@ struct GameSetupStructBase {
int numcursors;
int default_lipsync_frame; // used for unknown chars
int invhotdotsprite;
int reserved[NUM_INTS_RESERVED];
int32_t reserved[NUM_INTS_RESERVED];
char *messages[MAXGLOBALMES];
WordsDictionary *dict;
char *globalscript;
CharacterInfo *chars;
ccScript *compiled_script;
int *load_messages;
int32_t *load_messages;
bool load_dictionary;
bool load_compiled_script;
// [IKM] 2013-03-30

View File

@ -23,6 +23,8 @@
#ifndef AGS_SHARED_AC_INVENTORYITEMINFO_H
#define AGS_SHARED_AC_INVENTORYITEMINFO_H
#include "ags/shared/core/types.h"
namespace AGS3 {
namespace AGS {
@ -38,7 +40,7 @@ struct InventoryItemInfo {
char name[25];
int pic;
int cursorPic, hotx, hoty;
int reserved[5];
int32_t reserved[5];
char flags;
void ReadFromFile(Shared::Stream *in);

View File

@ -489,10 +489,10 @@ void SpriteCache::CompressSprite(Bitmap *sprite, Stream *out) {
cpackbitl(&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), out);
} else if (depth == 2) {
for (int y = 0; y < sprite->GetHeight(); y++)
cpackbitl16((const unsigned short *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
cpackbitl16((const uint16_t *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
} else {
for (int y = 0; y < sprite->GetHeight(); y++)
cpackbitl32((const unsigned int *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
cpackbitl32((const uint32_t *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
}
}
@ -503,10 +503,10 @@ void SpriteCache::UnCompressSprite(Bitmap *sprite, Stream *in) {
cunpackbitl(&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
} else if (depth == 2) {
for (int y = 0; y < sprite->GetHeight(); y++)
cunpackbitl16((unsigned short *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
cunpackbitl16((uint16 *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
} else {
for (int y = 0; y < sprite->GetHeight(); y++)
cunpackbitl32((unsigned int *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
cunpackbitl32((uint32_t *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
}
}

View File

@ -24,6 +24,7 @@
#define AGS_SHARED_AC_VIEW_H
#include "ags/lib/std/vector.h"
#include "ags/shared/core/types.h"
namespace AGS3 {
@ -81,7 +82,7 @@ struct ViewStruct {
struct ViewStruct272 {
short numloops;
short numframes[16];
int loopflags[16];
int32_t loopflags[16];
ViewFrame frames[16][20];
ViewStruct272();

View File

@ -242,8 +242,8 @@ Interaction *Interaction::CreateFromStream(Stream *in) {
if (evt_count > MAX_NEWINTERACTION_EVENTS)
quit("Can't deserialize interaction: too many events");
int types[MAX_NEWINTERACTION_EVENTS];
int load_response[MAX_NEWINTERACTION_EVENTS];
int32_t types[MAX_NEWINTERACTION_EVENTS];
int32_t load_response[MAX_NEWINTERACTION_EVENTS];
in->ReadArrayOfInt32(types, evt_count);
in->ReadArrayOfInt32(load_response, evt_count);

View File

@ -91,7 +91,7 @@ void GUIMain::InitDefaults() {
_ctrlDrawOrder.clear();
}
int GUIMain::FindControlUnderMouse(int leeway, bool must_be_clickable) const {
int32_t GUIMain::FindControlUnderMouse(int leeway, bool must_be_clickable) const {
if (loaded_game_file_version <= kGameVersion_262) {
// Ignore draw order On 2.6.2 and lower
for (size_t i = 0; i < _controls.size(); ++i) {
@ -116,15 +116,15 @@ int GUIMain::FindControlUnderMouse(int leeway, bool must_be_clickable) const {
return -1;
}
int GUIMain::FindControlUnderMouse() const {
int32_t GUIMain::FindControlUnderMouse() const {
return FindControlUnderMouse(0, true);
}
int GUIMain::FindControlUnderMouse(int leeway) const {
int32_t GUIMain::FindControlUnderMouse(int leeway) const {
return FindControlUnderMouse(leeway, true);
}
int GUIMain::GetControlCount() const {
int32_t GUIMain::GetControlCount() const {
return (int32_t)_controls.size();
}

View File

@ -188,7 +188,7 @@ private:
// Array of types and control indexes in global GUI object arrays;
// maps GUI child slots to actual controls and used for rebuilding Controls array
typedef std::pair<GUIControlType, int32_t> ControlRef;
typedef std::pair<GUIControlType, int> ControlRef;
std::vector<ControlRef> _ctrlRefs;
// Array of child control references (not exclusively owned!)
std::vector<GUIObject *> _controls;
@ -238,7 +238,7 @@ extern AGS_INLINE int get_fixed_pixel_size(int pixels);
// Those function have distinct implementations in Engine and Editor
extern void wouttext_outline(Shared::Bitmap *ds, int xxp, int yyp, int usingfont, color_t text_color, const char *texx);
extern int wgettextwidth_compensate(Shared::Bitmap *ds, const char *tex, int font);
extern void check_font(int *fontnum);
extern void check_font(int32_t *fontnum);
extern void set_our_eip(int eip);
#define SET_EIP(x) set_our_eip(x);