mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-02 14:47:58 +03:00
add -Wall
This commit is contained in:
parent
baa256ede6
commit
aa318f5345
10 changed files with 33 additions and 29 deletions
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
CC=i686-w64-mingw32-gcc
|
||||
CFLAGS=-W -Isrc
|
||||
CFLAGS=-Wall -Isrc
|
||||
|
||||
C_FILES = $(shell find src/ -type f -name '*.c')
|
||||
O_FILES = $(patsubst src/%.c, build/%.o, $(C_FILES))
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#define PhdPersp VAR_U_(0x0069518C, int32_t)
|
||||
#define PhdFarZ VAR_U_(0x00695184, int32_t)
|
||||
#define PhdNearZ VAR_U_(0x006CAD04, int32_t)
|
||||
#define FloorData VAR_U_(0x0045F1BC, uint16_t*)
|
||||
#define FloorData VAR_U_(0x0045F1BC, int16_t*)
|
||||
#define StringToShow ARRAY_(0x00456AD0, char, [128])
|
||||
#define MeshBase VAR_U_(0x0045F1B8, int16_t*)
|
||||
#define Meshes VAR_U_(0x00461F34, int16_t**)
|
||||
|
|
|
@ -202,7 +202,7 @@ void __cdecl AnimateShotgun()
|
|||
|
||||
void __cdecl FireShotgun()
|
||||
{
|
||||
int i, r, fired;
|
||||
int r, fired;
|
||||
PHD_ANGLE angles[2];
|
||||
PHD_ANGLE dangles[2];
|
||||
|
||||
|
|
|
@ -228,11 +228,11 @@ int32_t __cdecl T_GetTextWidth(TEXTSTRING* textstring)
|
|||
int width = 0;
|
||||
char* ptr = textstring->string;
|
||||
for (char letter = *ptr; *ptr; letter = *ptr++) {
|
||||
if (letter == '\x7F' || letter > 10 && letter < 32) {
|
||||
if (letter == 0x7F || (letter > 10 && letter < 32)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (letter == ' ') {
|
||||
if (letter == 32) {
|
||||
width += textstring->word_spacing * textstring->scale_h / PHD_ONE;
|
||||
continue;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ int32_t __cdecl T_GetTextWidth(TEXTSTRING* textstring)
|
|||
letter = letter + 81;
|
||||
}
|
||||
|
||||
width += ((TextSpacing[letter] + textstring->letter_spacing)
|
||||
width += ((TextSpacing[(uint8_t)letter] + textstring->letter_spacing)
|
||||
* textstring->scale_h)
|
||||
/ PHD_ONE;
|
||||
}
|
||||
|
|
|
@ -682,10 +682,10 @@ typedef struct {
|
|||
} PHD_VECTOR;
|
||||
|
||||
typedef struct {
|
||||
/* 0000 */ uint16_t room_num;
|
||||
/* 0002 */ uint16_t x;
|
||||
/* 0004 */ uint16_t y;
|
||||
/* 0006 */ uint16_t z;
|
||||
/* 0000 */ int16_t room_num;
|
||||
/* 0002 */ int16_t x;
|
||||
/* 0004 */ int16_t y;
|
||||
/* 0006 */ int16_t z;
|
||||
/* 0008 */ POS_3D vertex[4];
|
||||
/* 0020 end */
|
||||
} DOOR_INFO;
|
||||
|
@ -795,9 +795,9 @@ typedef struct {
|
|||
} ITEM_INFO;
|
||||
|
||||
typedef struct {
|
||||
/* 0000 */ uint16_t* frame_base;
|
||||
/* 0004 */ uint16_t frame_number;
|
||||
/* 0006 */ uint16_t lock;
|
||||
/* 0000 */ int16_t* frame_base;
|
||||
/* 0004 */ int16_t frame_number;
|
||||
/* 0006 */ int16_t lock;
|
||||
/* 0008 */ PHD_ANGLE y_rot;
|
||||
/* 000A */ PHD_ANGLE x_rot;
|
||||
/* 000C */ PHD_ANGLE z_rot;
|
||||
|
@ -1226,7 +1226,7 @@ typedef struct {
|
|||
/* 0012 end */
|
||||
} AI_INFO;
|
||||
|
||||
#pragma pop
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef void(__cdecl* ControlRoutine)(ITEM_INFO*, COLL_INFO*);
|
||||
typedef void(__cdecl* CollisionRoutine)(ITEM_INFO*, COLL_INFO*);
|
||||
|
|
|
@ -63,8 +63,7 @@ void Tomb1MRenderBar(int value, int value_max, int bar_type)
|
|||
{
|
||||
const int p1 = -100;
|
||||
const int p2 = -200;
|
||||
const int p3 = -300;
|
||||
const int p4 = -400;
|
||||
const int p3 = -400;
|
||||
const int percent_max = 100;
|
||||
|
||||
if (value < 0) {
|
||||
|
@ -147,7 +146,7 @@ void Tomb1MRenderBar(int value, int value_max, int bar_type)
|
|||
for (int i = 0; i < height; i++) {
|
||||
int color_index = i * COLOR_BAR_SIZE / height;
|
||||
Insert2DLine(
|
||||
left, top + i, right, top + i, p4,
|
||||
left, top + i, right, top + i, p3,
|
||||
color_bar[bar_type][color_index]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ int32_t __cdecl S_LoadLevel(int level_id)
|
|||
|
||||
const char* __cdecl GetFullPath(const char* filename)
|
||||
{
|
||||
TRACE(filename);
|
||||
TRACE("%s", filename);
|
||||
#ifdef TOMB1M_FEAT_NOCD
|
||||
sprintf(newpath, ".\\%s", filename);
|
||||
#else
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
void __cdecl DB_Log(char* a1, ...)
|
||||
void __cdecl DB_Log(char* fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
char buffer[256] = { 0 };
|
||||
|
||||
va_start(va, a1);
|
||||
va_start(va, fmt);
|
||||
if (!dword_45A1F0) {
|
||||
vsprintf(buffer, a1, va);
|
||||
vsprintf(buffer, fmt, va);
|
||||
TRACE(buffer);
|
||||
OutputDebugStringA(buffer);
|
||||
OutputDebugStringA("\n");
|
||||
|
|
10
src/util.c
10
src/util.c
|
@ -4,6 +4,16 @@
|
|||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
|
||||
void Tomb1MTraceFunc(
|
||||
const char* file, int line, const char* func, const char* fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
printf("%s %d %s ", file, line, func);
|
||||
vprintf(fmt, va);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void Tomb1MInjectFunc(void* from, void* to)
|
||||
{
|
||||
DWORD tmp;
|
||||
|
|
11
src/util.h
11
src/util.h
|
@ -18,18 +18,13 @@ typedef struct {
|
|||
} JMP;
|
||||
#pragma pack(pop)
|
||||
|
||||
#define TRACE(...) \
|
||||
{ \
|
||||
printf("%s:%d %s ", __FILE__, __LINE__, __func__); \
|
||||
printf(__VA_ARGS__); \
|
||||
printf("\n"); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
|
||||
#define TRACE(...) Tomb1MTraceFunc(__FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
#define VAR_U_(address, type) (*(type*)(address))
|
||||
#define VAR_I_(address, type, value) (*(type*)(address))
|
||||
#define ARRAY_(address, type, length) (*(type(*) length)(address))
|
||||
|
||||
void Tomb1MTraceFunc(
|
||||
const char* file, int line, const char* func, const char* fmt, ...);
|
||||
void Tomb1MInjectFunc(void* from, void* to);
|
||||
void Tomb1MPrintStackTrace();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue