Skip to content

Commit

Permalink
move pointer alignment to right
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 7, 2021
1 parent 76707fd commit 64e1d24
Show file tree
Hide file tree
Showing 80 changed files with 1,617 additions and 1,604 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ AllowShortFunctionsOnASingleLine: InlineOnly
BreakBeforeBinaryOperators: NonAssignment
AlignAfterOpenBracket: AlwaysBreak
SortIncludes: false
PointerAlignment: Right
24 changes: 12 additions & 12 deletions src/3dsystem/3d_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define EXTRACT_ROT_X(rots) (((rots >> 20) & 0x3FF) << 6)
#define EXTRACT_ROT_Z(rots) ((rots & 0x3FF) << 6)

void phd_GenerateW2V(PHD_3DPOS* viewpos)
void phd_GenerateW2V(PHD_3DPOS *viewpos)
{
PhdMatrixPtr = &MatrixStack;
int32_t sx = phd_sin(viewpos->x_rot);
Expand Down Expand Up @@ -56,7 +56,7 @@ void phd_LookAt(
phd_GenerateW2V(&viewer);
}

void phd_GetVectorAngles(int32_t x, int32_t y, int32_t z, int16_t* dest)
void phd_GetVectorAngles(int32_t x, int32_t y, int32_t z, int16_t *dest)
{
dest[0] = phd_atan(z, x);

Expand All @@ -80,7 +80,7 @@ void phd_RotX(PHD_ANGLE rx)
return;
}

PHD_MATRIX* mptr = PhdMatrixPtr;
PHD_MATRIX *mptr = PhdMatrixPtr;
int32_t sx = phd_sin(rx);
int32_t cx = phd_cos(rx);

Expand All @@ -107,7 +107,7 @@ void phd_RotY(PHD_ANGLE ry)
return;
}

PHD_MATRIX* mptr = PhdMatrixPtr;
PHD_MATRIX *mptr = PhdMatrixPtr;
int32_t sy = phd_sin(ry);
int32_t cy = phd_cos(ry);

Expand All @@ -134,7 +134,7 @@ void phd_RotZ(PHD_ANGLE rz)
return;
}

PHD_MATRIX* mptr = PhdMatrixPtr;
PHD_MATRIX *mptr = PhdMatrixPtr;
int32_t sz = phd_sin(rz);
int32_t cz = phd_cos(rz);

Expand All @@ -157,7 +157,7 @@ void phd_RotZ(PHD_ANGLE rz)

void phd_RotYXZ(PHD_ANGLE ry, PHD_ANGLE rx, PHD_ANGLE rz)
{
PHD_MATRIX* mptr = PhdMatrixPtr;
PHD_MATRIX *mptr = PhdMatrixPtr;
int32_t r0, r1;

if (ry) {
Expand Down Expand Up @@ -223,7 +223,7 @@ void phd_RotYXZ(PHD_ANGLE ry, PHD_ANGLE rx, PHD_ANGLE rz)

void phd_RotYXZpack(int32_t rots)
{
PHD_MATRIX* mptr = PhdMatrixPtr;
PHD_MATRIX *mptr = PhdMatrixPtr;
int32_t r0, r1;

PHD_ANGLE ry = EXTRACT_ROT_Y(rots);
Expand Down Expand Up @@ -292,7 +292,7 @@ void phd_RotYXZpack(int32_t rots)

int32_t phd_TranslateRel(int32_t x, int32_t y, int32_t z)
{
PHD_MATRIX* mptr = PhdMatrixPtr;
PHD_MATRIX *mptr = PhdMatrixPtr;
mptr->_03 += mptr->_00 * x + mptr->_01 * y + mptr->_02 * z;
mptr->_13 += mptr->_10 * x + mptr->_11 * y + mptr->_12 * z;
mptr->_23 += mptr->_20 * x + mptr->_21 * y + mptr->_22 * z;
Expand All @@ -302,7 +302,7 @@ int32_t phd_TranslateRel(int32_t x, int32_t y, int32_t z)

void phd_TranslateAbs(int32_t x, int32_t y, int32_t z)
{
PHD_MATRIX* mptr = PhdMatrixPtr;
PHD_MATRIX *mptr = PhdMatrixPtr;
x -= W2VMatrix._03;
y -= W2VMatrix._13;
z -= W2VMatrix._23;
Expand All @@ -311,7 +311,7 @@ void phd_TranslateAbs(int32_t x, int32_t y, int32_t z)
mptr->_23 = mptr->_20 * x + mptr->_21 * y + mptr->_22 * z;
}

int32_t visible_zclip(PHD_VBUF* vn1, PHD_VBUF* vn2, PHD_VBUF* vn3)
int32_t visible_zclip(PHD_VBUF *vn1, PHD_VBUF *vn2, PHD_VBUF *vn3)
{
double v1x = vn1->xv;
double v1y = vn1->yv;
Expand All @@ -331,7 +331,7 @@ int32_t visible_zclip(PHD_VBUF* vn1, PHD_VBUF* vn2, PHD_VBUF* vn3)
void phd_InitWindow(
int32_t x, int32_t y, int32_t width, int32_t height, int32_t nearz,
int32_t farz, int32_t view_angle, int32_t scrwidth, int32_t scrheight,
uint8_t* scrptr)
uint8_t *scrptr)
{
PhdWinPtr = &scrptr[x + y * scrwidth];
PhdWinMaxX = width - 1;
Expand Down Expand Up @@ -390,7 +390,7 @@ void phd_PushMatrix()
// originally in shell.c
void phd_PushUnitMatrix()
{
PHD_MATRIX* mptr = ++PhdMatrixPtr;
PHD_MATRIX *mptr = ++PhdMatrixPtr;
mptr->_00 = W2V_SCALE;
mptr->_01 = 0;
mptr->_02 = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/3dsystem/3d_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
#define phd_RotateLight ((void (*)(PHD_ANGLE pitch, PHD_ANGLE yaw))0x004023A0)
// clang-format on

void phd_GenerateW2V(PHD_3DPOS* viewpos);
void phd_GenerateW2V(PHD_3DPOS *viewpos);
void phd_LookAt(
int32_t xsrc, int32_t ysrc, int32_t zsrc, int32_t xtar, int32_t ytar,
int32_t ztar, int16_t roll);
void phd_GetVectorAngles(int32_t x, int32_t y, int32_t z, int16_t* dest);
void phd_GetVectorAngles(int32_t x, int32_t y, int32_t z, int16_t *dest);
void phd_RotX(PHD_ANGLE rx);
void phd_RotY(PHD_ANGLE ry);
void phd_RotZ(PHD_ANGLE rz);
void phd_RotYXZ(PHD_ANGLE ry, PHD_ANGLE rx, PHD_ANGLE rz);
void phd_RotYXZpack(int32_t rots);
int32_t phd_TranslateRel(int32_t x, int32_t y, int32_t z);
void phd_TranslateAbs(int32_t x, int32_t y, int32_t z);
int32_t visible_zclip(PHD_VBUF* vn1, PHD_VBUF* vn2, PHD_VBUF* vn3);
int32_t visible_zclip(PHD_VBUF *vn1, PHD_VBUF *vn2, PHD_VBUF *vn3);
void phd_InitWindow(
int32_t x, int32_t y, int32_t width, int32_t height, int32_t nearz,
int32_t farz, int32_t view_angle, int32_t scrwidth, int32_t scrheight,
uint8_t* scrptr);
uint8_t *scrptr);
void AlterFOV(PHD_ANGLE fov);

void phd_PushMatrix();
Expand Down
20 changes: 10 additions & 10 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
READ_CUSTOM(ReadBarColor, opt, default_value)

static int8_t ReadBarShowingMode(
struct json_value_s* root, const char* name, int8_t default_value)
struct json_value_s *root, const char *name, int8_t default_value)
{
const char* value_str;
const char *value_str;
if (JSONGetStringValue(root, name, &value_str)) {
if (!strcmp(value_str, "flashing-or-default")) {
return T1M_BSM_FLASHING_OR_DEFAULT;
Expand All @@ -49,9 +49,9 @@ static int8_t ReadBarShowingMode(
}

static int8_t ReadBarLocation(
struct json_value_s* root, const char* name, int8_t default_value)
struct json_value_s *root, const char *name, int8_t default_value)
{
const char* value_str;
const char *value_str;
if (JSONGetStringValue(root, name, &value_str)) {
if (!strcmp(value_str, "top-left")) {
return T1M_BL_TOP_LEFT;
Expand All @@ -71,9 +71,9 @@ static int8_t ReadBarLocation(
}

static int8_t
ReadBarColor(struct json_value_s* root, const char* name, int8_t default_value)
ReadBarColor(struct json_value_s *root, const char *name, int8_t default_value)
{
const char* value_str;
const char *value_str;
if (JSONGetStringValue(root, name, &value_str)) {
if (!strcmp(value_str, "gold")) {
return T1M_BC_GOLD;
Expand All @@ -98,9 +98,9 @@ ReadBarColor(struct json_value_s* root, const char* name, int8_t default_value)
return default_value;
}

void T1MReadConfigFromJson(const char* cfg_data)
void T1MReadConfigFromJson(const char *cfg_data)
{
struct json_value_s* json = json_parse_ex(
struct json_value_s *json = json_parse_ex(
cfg_data, strlen(cfg_data), json_parse_flags_allow_json5, NULL, NULL,
NULL);

Expand Down Expand Up @@ -142,7 +142,7 @@ void T1MReadConfigFromJson(const char* cfg_data)

int T1MReadConfig()
{
FILE* fp = fopen("Tomb1Main.json5", "rb");
FILE *fp = fopen("Tomb1Main.json5", "rb");
if (!fp) {
T1MReadConfigFromJson("");
return 0;
Expand All @@ -152,7 +152,7 @@ int T1MReadConfig()
int cfg_size = ftell(fp);
fseek(fp, 0, SEEK_SET);

char* cfg_data = malloc(cfg_size);
char *cfg_data = malloc(cfg_size);
if (!cfg_data) {
fclose(fp);
T1MReadConfigFromJson("");
Expand Down
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct {
int8_t fov_vertical;
} T1MConfig;

void T1MReadConfigFromJson(const char* json);
void T1MReadConfigFromJson(const char *json);
int T1MReadConfig();

#endif
4 changes: 2 additions & 2 deletions src/game/bat.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static BITE_INFO BatBite = { 0, 16, 45, 4 };

void BatControl(int16_t item_num)
{
ITEM_INFO* item = &Items[item_num];
ITEM_INFO *item = &Items[item_num];

if (item->status == IS_INVISIBLE) {
if (!EnableBaddieAI(item_num, 0)) {
Expand All @@ -31,7 +31,7 @@ void BatControl(int16_t item_num)
item->status = IS_ACTIVE;
}

CREATURE_INFO* bat = item->data;
CREATURE_INFO *bat = item->data;
PHD_ANGLE angle = 0;
if (item->hit_points <= 0) {
if (item->pos.y < item->floor) {
Expand Down
4 changes: 2 additions & 2 deletions src/game/bear.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static BITE_INFO BearHeadBite = { 0, 96, 335, 14 };

void BearControl(int16_t item_num)
{
ITEM_INFO* item = &Items[item_num];
ITEM_INFO *item = &Items[item_num];

if (item->status == IS_INVISIBLE) {
if (!EnableBaddieAI(item_num, 0)) {
Expand All @@ -48,7 +48,7 @@ void BearControl(int16_t item_num)
item->status = IS_ACTIVE;
}

CREATURE_INFO* bear = (CREATURE_INFO*)item->data;
CREATURE_INFO *bear = (CREATURE_INFO *)item->data;
int16_t head = 0;
PHD_ANGLE angle = 0;

Expand Down
Loading

0 comments on commit 64e1d24

Please sign in to comment.