mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
misc: fix build warnings
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / TR1 (Linux) (push) Waiting to run
Publish a pre-release / TR1 (Windows) (push) Waiting to run
Publish a pre-release / TR1 (Mac) (push) Waiting to run
Publish a pre-release / TR2 (Linux) (push) Waiting to run
Publish a pre-release / TR2 (Windows) (push) Waiting to run
Publish a pre-release / TR2 (Mac) (push) Waiting to run
Publish a pre-release / Create a prerelease (push) Blocked by required conditions
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / TR1 (Linux) (push) Waiting to run
Publish a pre-release / TR1 (Windows) (push) Waiting to run
Publish a pre-release / TR1 (Mac) (push) Waiting to run
Publish a pre-release / TR2 (Linux) (push) Waiting to run
Publish a pre-release / TR2 (Windows) (push) Waiting to run
Publish a pre-release / TR2 (Mac) (push) Waiting to run
Publish a pre-release / Create a prerelease (push) Blocked by required conditions
This commit is contained in:
parent
e22bf087f6
commit
4d5040d15c
6 changed files with 32 additions and 21 deletions
|
@ -283,56 +283,56 @@ MYFILE *File_Open(const char *path, FILE_OPEN_MODE mode)
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void File_ReadData(MYFILE *const file, void *const data, const size_t size)
|
bool File_ReadData(MYFILE *const file, void *const data, const size_t size)
|
||||||
{
|
{
|
||||||
fread(data, size, 1, file->fp);
|
return fread(data, size, 1, file->fp) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void File_ReadItems(
|
bool File_ReadItems(
|
||||||
MYFILE *const file, void *data, const size_t count, const size_t item_size)
|
MYFILE *const file, void *data, const size_t count, const size_t item_size)
|
||||||
{
|
{
|
||||||
fread(data, item_size, count, file->fp);
|
return fread(data, item_size, count, file->fp) == count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t File_ReadS8(MYFILE *const file)
|
int8_t File_ReadS8(MYFILE *const file)
|
||||||
{
|
{
|
||||||
int8_t result;
|
int8_t result;
|
||||||
fread(&result, sizeof(result), 1, file->fp);
|
File_ReadData(file, &result, sizeof(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t File_ReadS16(MYFILE *const file)
|
int16_t File_ReadS16(MYFILE *const file)
|
||||||
{
|
{
|
||||||
int16_t result;
|
int16_t result;
|
||||||
fread(&result, sizeof(result), 1, file->fp);
|
File_ReadData(file, &result, sizeof(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t File_ReadS32(MYFILE *const file)
|
int32_t File_ReadS32(MYFILE *const file)
|
||||||
{
|
{
|
||||||
int32_t result;
|
int32_t result;
|
||||||
fread(&result, sizeof(result), 1, file->fp);
|
File_ReadData(file, &result, sizeof(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t File_ReadU8(MYFILE *const file)
|
uint8_t File_ReadU8(MYFILE *const file)
|
||||||
{
|
{
|
||||||
uint8_t result;
|
uint8_t result;
|
||||||
fread(&result, sizeof(result), 1, file->fp);
|
File_ReadData(file, &result, sizeof(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t File_ReadU16(MYFILE *const file)
|
uint16_t File_ReadU16(MYFILE *const file)
|
||||||
{
|
{
|
||||||
uint16_t result;
|
uint16_t result;
|
||||||
fread(&result, sizeof(result), 1, file->fp);
|
File_ReadData(file, &result, sizeof(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t File_ReadU32(MYFILE *const file)
|
uint32_t File_ReadU32(MYFILE *const file)
|
||||||
{
|
{
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
fread(&result, sizeof(result), 1, file->fp);
|
File_ReadData(file, &result, sizeof(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,12 +108,11 @@ static void M_LoadCommonSettings(
|
||||||
if (tmp_value != nullptr && tmp_value->type == JSON_TYPE_ARRAY) {
|
if (tmp_value != nullptr && tmp_value->type == JSON_TYPE_ARRAY) {
|
||||||
const JSON_ARRAY *const tmp_arr = JSON_ValueAsArray(tmp_value);
|
const JSON_ARRAY *const tmp_arr = JSON_ValueAsArray(tmp_value);
|
||||||
const RGB_F color = {
|
const RGB_F color = {
|
||||||
JSON_ArrayGetDouble(tmp_arr, 0, JSON_INVALID_NUMBER),
|
JSON_ArrayGetDouble(tmp_arr, 0, -1.0),
|
||||||
JSON_ArrayGetDouble(tmp_arr, 1, JSON_INVALID_NUMBER),
|
JSON_ArrayGetDouble(tmp_arr, 1, -1.0),
|
||||||
JSON_ArrayGetDouble(tmp_arr, 2, JSON_INVALID_NUMBER),
|
JSON_ArrayGetDouble(tmp_arr, 2, -1.0),
|
||||||
};
|
};
|
||||||
if (color.r != JSON_INVALID_NUMBER && color.g != JSON_INVALID_NUMBER
|
if (color.r >= 0.0 && color.g >= 0.0 && color.b >= 0.0) {
|
||||||
&& color.b != JSON_INVALID_NUMBER) {
|
|
||||||
settings->water_color.is_present = true;
|
settings->water_color.is_present = true;
|
||||||
settings->water_color.value = (RGB_888) {
|
settings->water_color.value = (RGB_888) {
|
||||||
color.r * 255.0f,
|
color.r * 255.0f,
|
||||||
|
@ -515,7 +514,8 @@ static void M_LoadTitleLevel(JSON_OBJECT *obj, GAME_FLOW *const gf)
|
||||||
JSON_OBJECT *title_obj = JSON_ObjectGetObject(obj, "title");
|
JSON_OBJECT *title_obj = JSON_ObjectGetObject(obj, "title");
|
||||||
if (title_obj != nullptr) {
|
if (title_obj != nullptr) {
|
||||||
gf->title_level = Memory_Alloc(sizeof(GF_LEVEL));
|
gf->title_level = Memory_Alloc(sizeof(GF_LEVEL));
|
||||||
M_LoadLevel(title_obj, gf, gf->title_level, 0, GFL_TITLE);
|
M_LoadLevel(
|
||||||
|
title_obj, gf, gf->title_level, 0, (void *)(intptr_t)GFL_TITLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ char *File_GuessExtension(const char *path, const char **extensions);
|
||||||
|
|
||||||
MYFILE *File_Open(const char *path, FILE_OPEN_MODE mode);
|
MYFILE *File_Open(const char *path, FILE_OPEN_MODE mode);
|
||||||
|
|
||||||
void File_ReadData(MYFILE *file, void *data, size_t size);
|
bool File_ReadData(MYFILE *file, void *data, size_t size);
|
||||||
void File_ReadItems(MYFILE *file, void *data, size_t count, size_t item_size);
|
bool File_ReadItems(MYFILE *file, void *data, size_t count, size_t item_size);
|
||||||
int8_t File_ReadS8(MYFILE *file);
|
int8_t File_ReadS8(MYFILE *file);
|
||||||
int16_t File_ReadS16(MYFILE *file);
|
int16_t File_ReadS16(MYFILE *file);
|
||||||
int32_t File_ReadS32(MYFILE *file);
|
int32_t File_ReadS32(MYFILE *file);
|
||||||
|
|
|
@ -364,7 +364,7 @@ const BOUNDS_16 *Item_GetBoundsAccurate(const ITEM *const item)
|
||||||
ANIM_FRAME *Item_GetBestFrame(const ITEM *const item)
|
ANIM_FRAME *Item_GetBestFrame(const ITEM *const item)
|
||||||
{
|
{
|
||||||
ANIM_FRAME *frames[2];
|
ANIM_FRAME *frames[2];
|
||||||
int32_t rate;
|
int32_t rate = 0;
|
||||||
const int32_t frac = Item_GetFrames(item, frames, &rate);
|
const int32_t frac = Item_GetFrames(item, frames, &rate);
|
||||||
return frames[(frac > rate / 2) ? 1 : 0];
|
return frames[(frac > rate / 2) ? 1 : 0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -473,6 +473,13 @@ void Lara_Draw_I(
|
||||||
Matrix_Rot16_ID(mesh_rots_1[LM_UARM_R], mesh_rots_2[LM_UARM_R]);
|
Matrix_Rot16_ID(mesh_rots_1[LM_UARM_R], mesh_rots_2[LM_UARM_R]);
|
||||||
Output_DrawObjectMesh_I(g_Lara.mesh_ptrs[LM_UARM_R], clip);
|
Output_DrawObjectMesh_I(g_Lara.mesh_ptrs[LM_UARM_R], clip);
|
||||||
|
|
||||||
|
// NOTE: gcc wrongly complains about mesh_rots_1 possibly being NULL.
|
||||||
|
// While this is not the case, it's curious how the pistols subtract the
|
||||||
|
// frame_base from g_Lara.*_arm.frame_num to access the mesh_rots, and the
|
||||||
|
// rifles do not.
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
|
|
||||||
M_DrawBodyPart(LM_LARM_R, bone, mesh_rots_1, mesh_rots_2, clip);
|
M_DrawBodyPart(LM_LARM_R, bone, mesh_rots_1, mesh_rots_2, clip);
|
||||||
M_DrawBodyPart(LM_HAND_R, bone, mesh_rots_1, mesh_rots_2, clip);
|
M_DrawBodyPart(LM_HAND_R, bone, mesh_rots_1, mesh_rots_2, clip);
|
||||||
|
|
||||||
|
@ -486,6 +493,8 @@ void Lara_Draw_I(
|
||||||
M_DrawBodyPart(LM_LARM_L, bone, mesh_rots_1, mesh_rots_2, clip);
|
M_DrawBodyPart(LM_LARM_L, bone, mesh_rots_1, mesh_rots_2, clip);
|
||||||
M_DrawBodyPart(LM_HAND_L, bone, mesh_rots_1, mesh_rots_2, clip);
|
M_DrawBodyPart(LM_HAND_L, bone, mesh_rots_1, mesh_rots_2, clip);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
if (g_Lara.right_arm.flash_gun) {
|
if (g_Lara.right_arm.flash_gun) {
|
||||||
*g_MatrixPtr = saved_matrix;
|
*g_MatrixPtr = saved_matrix;
|
||||||
Gun_DrawFlash(gun_type, clip);
|
Gun_DrawFlash(gun_type, clip);
|
||||||
|
|
|
@ -143,22 +143,24 @@ static int32_t M_CompareSampleOffsets(const void *const a, const void *const b)
|
||||||
static void M_InitialiseSoundEffects(const char *file_name)
|
static void M_InitialiseSoundEffects(const char *file_name)
|
||||||
{
|
{
|
||||||
BENCHMARK benchmark = Benchmark_Start();
|
BENCHMARK benchmark = Benchmark_Start();
|
||||||
|
LEVEL_INFO *info = nullptr;
|
||||||
SAMPLE_ENTRY *entries = nullptr;
|
SAMPLE_ENTRY *entries = nullptr;
|
||||||
|
|
||||||
if (file_name == nullptr) {
|
if (file_name == nullptr) {
|
||||||
file_name = g_GameFlow.settings.sfx_path;
|
file_name = g_GameFlow.settings.sfx_path;
|
||||||
}
|
}
|
||||||
const char *full_path =
|
const char *full_path =
|
||||||
File_GetFullPath(file_name == nullptr ? DEFAULT_SFX_PATH : file_name);
|
File_GetFullPath(file_name == nullptr ? DEFAULT_SFX_PATH : file_name);
|
||||||
LOG_DEBUG("Loading samples from %s", full_path);
|
LOG_DEBUG("Loading samples from %s", full_path);
|
||||||
|
|
||||||
MYFILE *const fp = File_Open(full_path, FILE_OPEN_READ);
|
MYFILE *const fp = File_Open(full_path, FILE_OPEN_READ);
|
||||||
Memory_FreePointer(&full_path);
|
Memory_FreePointer(&full_path);
|
||||||
|
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
Shell_ExitSystemFmt("Could not open %s file", file_name);
|
Shell_ExitSystemFmt("Could not open %s file", file_name);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEVEL_INFO *const info = Level_GetInfo();
|
info = Level_GetInfo();
|
||||||
const int32_t sample_count = info->samples.offset_count;
|
const int32_t sample_count = info->samples.offset_count;
|
||||||
entries = Memory_Alloc(sizeof(SAMPLE_ENTRY) * sample_count);
|
entries = Memory_Alloc(sizeof(SAMPLE_ENTRY) * sample_count);
|
||||||
for (int32_t i = 0; i < sample_count; i++) {
|
for (int32_t i = 0; i < sample_count; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue