Skip to content

Commit

Permalink
Additional clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
winterheart committed Apr 16, 2024
1 parent 61be131 commit 38128ea
Show file tree
Hide file tree
Showing 161 changed files with 815 additions and 811 deletions.
3 changes: 1 addition & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
Language: Cpp
# BasedOnStyle: LLVM
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ void grSurface::xlat16_16(char *data, int w, int h, int format) {
int temp_pix = sptr[(FixToInt(fv) * w) + FixToInt(fu)];
int r = (temp_pix >> 8) & 0xf;
int g = (temp_pix >> 4) & 0xf;
int b = (temp_pix)&0xf;
int b = (temp_pix) & 0xf;

r <<= 4;
g <<= 4;
Expand Down
10 changes: 5 additions & 5 deletions Descent3/AImain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ bool goal_do_avoid_walls(object *obj, vector *mdir) {
}

// mprintf((0, "Dist %f %f (%d, %d)\n", dist, scale,
//facelist[i].room_index, facelist[i].face_index));
// facelist[i].room_index, facelist[i].face_index));

if (dist < closest_dist) {
closest_dist = dist;
Expand Down Expand Up @@ -2999,8 +2999,8 @@ bool AINotify(object *obj, ubyte notify_type, void *info) {
{
if (!(Game_mode & GM_MULTI)) {
for (i = 0; i < AI_NumRendered; i++) {
// mprintf((0, "I know that I could dodge, if I was aware, says robot
//%d.\n", AI_RenderedList[i]));
// mprintf((0, "I know that I could dodge, if I was aware, says
// robot %d.\n", AI_RenderedList[i]));

if (!BOA_IsVisible(Objects[AI_RenderedList[i]].roomnum, other_obj->roomnum))
continue;
Expand Down Expand Up @@ -4976,8 +4976,8 @@ void ai_move(object *obj) {

int g_status = cur_goal->status_reg;

// if((ai_info->ai_type == AIT_MELEE1) && (ai_info->status_reg
//& AISR_MELEE))
// if((ai_info->ai_type == AIT_MELEE1) &&
//(ai_info->status_reg & AISR_MELEE))
// {
// AIMoveTowardsPosition(obj,
//&ai_info->last_see_target_pos, ai_info->attack_vel_percent);
Expand Down
26 changes: 13 additions & 13 deletions Descent3/GameLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@
#include "rtperformance.h"
#include "demofile.h"
#include "d3music.h"
//#include "gamespy.h"
// #include "gamespy.h"
#include "osiris_dll.h"
#include "aiambient.h"
#include "marker.h"
Expand Down Expand Up @@ -908,7 +908,7 @@ bool Rendering_main_view = false;
bool Skip_render_game_frame = false;
bool Menu_interface_mode = false;

//#ifdef GAMEGAUGE
// #ifdef GAMEGAUGE
int frames_one_second = 0;
int min_one_second = 0x7fffffff;
int max_one_second = 0;
Expand All @@ -921,7 +921,7 @@ short gamegauge_fpslog[GAMEGAUGE_MAX_LOG];

bool Game_gauge_do_time_test = false;
char Game_gauge_usefile[_MAX_PATH] = "gg.dem";
//#endif
// #endif

longlong last_timer = 0;

Expand Down Expand Up @@ -1005,7 +1005,7 @@ void ShrinkWindow() {
#define CV_MARKER7 8 // Last marker view
#define CV_MARKER8 9 // Last marker view
#define CV_GUIDEBOT 10 // Guide-Bot
//#define CV_COOP 3 //View from a coop player
// #define CV_COOP 3 //View from a coop player

#define NUM_CAMERA_VIEWS 3

Expand Down Expand Up @@ -1281,16 +1281,16 @@ void ProcessNormalKey(int key) {
Clear_screen = 4; // clears screen.
break;

//#ifndef DEMO
// #ifndef DEMO
case KEY_F5:
Game_interface_mode = GAME_TOGGLE_DEMO;
return;
case KEY_ALTED + KEY_F5:
DemoAbort(true);
return;
//#endif
// case KEY_SHIFTED+KEY_LAPOSTRO: Game_interface_mode = GAME_TELCOM_CARGO;return;
// case KEY_ALTED+KEY_LAPOSTRO: Game_interface_mode = GAME_TELCOM_BRIEFINGS; return;
// #endif
// case KEY_SHIFTED+KEY_LAPOSTRO: Game_interface_mode = GAME_TELCOM_CARGO;return;
// case KEY_ALTED+KEY_LAPOSTRO: Game_interface_mode = GAME_TELCOM_BRIEFINGS; return;
case KEY_SHIFTED + KEY_TAB:
Game_interface_mode = GAME_TELCOM_BRIEFINGS;
return;
Expand Down Expand Up @@ -2474,9 +2474,9 @@ void ProcessKeys() {
ProcessTestKeys(key);
#endif

//#ifdef DEMO
// #ifdef DEMO
DemoCheats(key);
//#endif
// #endif
}
}

Expand Down Expand Up @@ -2719,11 +2719,11 @@ void GameRenderFrame(void) {

// Increment frame count
FrameCount++;
//#ifdef GAMEGAUGE
// #ifdef GAMEGAUGE
frames_one_second++;
gamegauge_total_frames++;
//#endif
// Update our glows
// #endif
// Update our glows
PostUpdateAllLightGlows();

// Reset our powerup sparkle time if it has overflowed
Expand Down
2 changes: 1 addition & 1 deletion Descent3/LoadLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ void WriteAllDoorways(CFILE *ofile);
// Macro to translate old file handles (pre-version 94) to new ones
#define OLD_HANDLE_OBJNUM_MASK 0x3ff // to mask off the object number part of the handle
#define OLD_HANDLE_COUNT_MASK 0xfffffc00 // to maks off the count part of the handle
#define XLATE_HANDLE(handle) ((((handle)&OLD_HANDLE_COUNT_MASK) << 1) + ((handle)&OLD_HANDLE_OBJNUM_MASK))
#define XLATE_HANDLE(handle) ((((handle) & OLD_HANDLE_COUNT_MASK) << 1) + ((handle) & OLD_HANDLE_OBJNUM_MASK))

/*

Expand Down
2 changes: 1 addition & 1 deletion Descent3/Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ bool LoadMission(const char *mssn) {
#endif
#else

//#endif
// #endif
tLevelNode *lvls = NULL; // Temporary storage for level data.
tMission *msn;
CFILE *fp = NULL; // Mission file
Expand Down
4 changes: 3 additions & 1 deletion Descent3/NewPyroGauges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@

//////////////////////////////////////////////////////////////////////////////

static struct { int ringbmp; } NewPyroGaugeData;
static struct {
int ringbmp;
} NewPyroGaugeData;

//////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion Descent3/ObjInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@
#include "sounds.h"
#include "mem.h"
#include "marker.h"
//#include <malloc.h>
// #include <malloc.h>
#include <stdlib.h>
#include "psrand.h"
// Allocate and initialize an effect_info struct for an object
Expand Down
6 changes: 3 additions & 3 deletions Descent3/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2082,9 +2082,9 @@ int PlayerChooseDeathFate(int slot, float damage, bool melee) {
else
is_moving = false;

fate = (damage <= DEATH_BREAKUP_THRESHOLD && is_moving && !melee && OBJECT_OUTSIDE(playerobj))
? DEATH_BREAKUP
: (damage <= DEATH_EXPLODE_THRESHOLD || melee) ? DEATH_FALL : DEATH_INSTANT;
fate = (damage <= DEATH_BREAKUP_THRESHOLD && is_moving && !melee && OBJECT_OUTSIDE(playerobj)) ? DEATH_BREAKUP
: (damage <= DEATH_EXPLODE_THRESHOLD || melee) ? DEATH_FALL
: DEATH_INSTANT;

if (fate == DEATH_BREAKUP) {
if ((ps_rand() % 4) < 2)
Expand Down
136 changes: 68 additions & 68 deletions Descent3/SLEW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,79 +394,79 @@ int SlewFrame(object *obj, int movement_limitations) {
new_room = obj->roomnum;
} else
#endif
// NOTE LINK TO ABOVE IF
if (outside_mine) { // starting outside the mine?

// See if we've moved back into a room
new_room = FindPointRoom(&new_pos);

if (new_room != -1) { // back in the mine
outside_mine = 0;
mprintf((0, "SLEW: Re-entered mine at room %d\n", new_room));
} else // not back in the mine
new_room = obj->roomnum;
} else {
bool was_outside = (ROOMNUM_OUTSIDE(obj->roomnum) != 0);

// Limit new position to terrain bounds if outside
if (was_outside) {
if (new_pos.x < 1.0)
new_pos.x = 1.0;
if (new_pos.x > TERRAIN_WIDTH * TERRAIN_SIZE - 1.0)
new_pos.x = TERRAIN_WIDTH * TERRAIN_SIZE - 1.0;
if (new_pos.z < 1.0)
new_pos.z = 1.0;
if (new_pos.z > TERRAIN_DEPTH * TERRAIN_SIZE - 1.0)
new_pos.z = TERRAIN_WIDTH * TERRAIN_SIZE - 1.0;
}
// NOTE LINK TO ABOVE IF
if (outside_mine) { // starting outside the mine?

// See if we've moved back into a room
new_room = FindPointRoom(&new_pos);

if (new_room != -1) { // back in the mine
outside_mine = 0;
mprintf((0, "SLEW: Re-entered mine at room %d\n", new_room));
} else // not back in the mine
new_room = obj->roomnum;
} else {
bool was_outside = (ROOMNUM_OUTSIDE(obj->roomnum) != 0);

// Limit new position to terrain bounds if outside
if (was_outside) {
if (new_pos.x < 1.0)
new_pos.x = 1.0;
if (new_pos.x > TERRAIN_WIDTH * TERRAIN_SIZE - 1.0)
new_pos.x = TERRAIN_WIDTH * TERRAIN_SIZE - 1.0;
if (new_pos.z < 1.0)
new_pos.z = 1.0;
if (new_pos.z > TERRAIN_DEPTH * TERRAIN_SIZE - 1.0)
new_pos.z = TERRAIN_WIDTH * TERRAIN_SIZE - 1.0;
}

// Call FVI up get updated room number
fq.p0 = &obj->pos;
fq.startroom = obj->roomnum;
fq.p1 = &new_pos;
fq.rad = 0;
fq.thisobjnum = OBJNUM(obj);
fq.ignore_obj_list = NULL;
fq.flags = FQ_IGNORE_RENDER_THROUGH_PORTALS;
fate = fvi_FindIntersection(&fq, &hit_info);

// If bad room, don't move
if ((fate == HIT_OUT_OF_TERRAIN_BOUNDS) || (hit_info.hit_room == -1)) {
new_room = obj->roomnum;
new_pos = obj->pos;
} else
new_room = hit_info.hit_room;

// The object hit a wall, and maybe went outside the mine.
if (fate == HIT_WALL) {
int t;

mprintf((0, "SLEW: hit wall\n"));

// Check if we're in a room
t = FindPointRoom(&new_pos);

if (t != -1) { // We're in a room
new_room = t;
mprintf((0, "SLEW: still in mine in room %d\n", new_room));
} else { // Not in a room. Set a special flag
outside_mine = 1;
mprintf((0, "SLEW: left mine from room %d\n", new_room));
// Call FVI up get updated room number
fq.p0 = &obj->pos;
fq.startroom = obj->roomnum;
fq.p1 = &new_pos;
fq.rad = 0;
fq.thisobjnum = OBJNUM(obj);
fq.ignore_obj_list = NULL;
fq.flags = FQ_IGNORE_RENDER_THROUGH_PORTALS;
fate = fvi_FindIntersection(&fq, &hit_info);

// If bad room, don't move
if ((fate == HIT_OUT_OF_TERRAIN_BOUNDS) || (hit_info.hit_room == -1)) {
new_room = obj->roomnum;
new_pos = obj->pos;
} else
new_room = hit_info.hit_room;

// The object hit a wall, and maybe went outside the mine.
if (fate == HIT_WALL) {
int t;

mprintf((0, "SLEW: hit wall\n"));

// Check if we're in a room
t = FindPointRoom(&new_pos);

if (t != -1) { // We're in a room
new_room = t;
mprintf((0, "SLEW: still in mine in room %d\n", new_room));
} else { // Not in a room. Set a special flag
outside_mine = 1;
mprintf((0, "SLEW: left mine from room %d\n", new_room));
}
}
}

if (new_room != obj->roomnum) { // if we've changed rooms, say so
if (ROOMNUM_OUTSIDE(new_room))
if (was_outside)
mprintf((0, "SLEW: Moved to cell %d, BOA TR %d\n", CELLNUM(new_room), TERRAIN_REGION(new_room)));
if (new_room != obj->roomnum) { // if we've changed rooms, say so
if (ROOMNUM_OUTSIDE(new_room))
if (was_outside)
mprintf((0, "SLEW: Moved to cell %d, BOA TR %d\n", CELLNUM(new_room), TERRAIN_REGION(new_room)));
else
mprintf((0, "SLEW: Moved outside to cell %d\n", CELLNUM(new_room)));
else if (was_outside)
mprintf((0, "SLEW: Moved inside to room %d\n", new_room));
else
mprintf((0, "SLEW: Moved outside to cell %d\n", CELLNUM(new_room)));
else if (was_outside)
mprintf((0, "SLEW: Moved inside to room %d\n", new_room));
else
mprintf((0, "SLEW: Moved into room %d\n", new_room));
mprintf((0, "SLEW: Moved into room %d\n", new_room));
}
}
}

// Now we have the new room, so update the object position
ObjSetPos(obj, &new_pos, new_room, NULL, false);
Expand Down
6 changes: 3 additions & 3 deletions Descent3/TelCom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,9 @@ void TelComMain(bool ingame, bool SelectShip) {
TelcomStartSound(TCSND_RUNNING);
TelcomStopSound(TCSND_STARTUP);

//#ifdef DEMO
// #ifdef DEMO
// Telcom_system.current_status = TS_MISSION;
//#endif
// #endif

// initialize this to -1 so we get events right away
Telcom_mouse_last_effect = -1;
Expand Down Expand Up @@ -1211,7 +1211,7 @@ bool TelComMainMenu(tTelComInfo *tcs) {
}
break;
case TCCARGO:
//#if (defined DEMO)||(defined OEM)
// #if (defined DEMO)||(defined OEM)
MMButtons[mm].enabled = false;
MMButtons[mm].system = TS_OFF;
/*
Expand Down
2 changes: 1 addition & 1 deletion Descent3/TelComAutoMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ void TCAMRenderRoom(int roomnum) {

int r = (texel >> 10) & 0x1f;
int g = (texel >> 5) & 0x1f;
int b = (texel)&0x1f;
int b = (texel) & 0x1f;

p->p3_r = lm_red[r];
p->p3_g = lm_green[g];
Expand Down
6 changes: 3 additions & 3 deletions Descent3/aistruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,9 @@ extern float AI_last_time_room_noise_alert_time[MAX_ROOMS + 8];
#define AIC_STATIC 0
#define AIC_PURE_PATH 1
#define AIC_AIS_FULL 2
//#define AIC_DYNAMIC 3
//#define AIC_AIS_MOVEMENT 4
//#define AIC_AIS_FIRING 5
// #define AIC_DYNAMIC 3
// #define AIC_AIS_MOVEMENT 4
// #define AIC_AIS_FIRING 5

// AI Action -- What is it doing?

Expand Down
4 changes: 2 additions & 2 deletions Descent3/aiterrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ void ait_terrain_clean() {
ai_terrain_check_list[CELLNUM(ai_segs_checked[i]) >> 3] = 0;
}

//#ifdef _DEBUG
// #ifdef _DEBUG
// for(i = 0; i < ((TERRAIN_WIDTH*TERRAIN_DEPTH)>>3)+1; i++)
// {
// ASSERT(ai_terrain_check_list[i] == 0);
// }
//#endif
// #endif

ai_num_segs_checked = 0;
}
Expand Down
Loading

0 comments on commit 38128ea

Please sign in to comment.