Mark functions and variables as static (#185)

* Begin by marking functions and variables as static when needed.

* More work.

* More work.

* More pokes.

* More work.

* More work.

* Initial work on the netgames.

* Revert changes to the license header on source files.

* clutter.cpp poke.

* One final poke.

* Move some declarations to headers:

Move paged_in_count and paged_in_num to gamesequence.h
Move DoneLightInstance and StartLightInstance to polymodel.h

* Look over the AI script/plug-ins.

* Going over the changes one last time.

* Fix rebase errors.

* More migration from bare statics to static inlines.
This commit is contained in:
C.W. Betts 2024-05-07 15:35:28 -06:00 committed by GitHub
parent aaa0d21b87
commit c6da74b069
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
154 changed files with 2063 additions and 1659 deletions

View File

@ -141,6 +141,13 @@
typedef CFILE *FONTFILE;
static inline int READ_FONT_INT(FONTFILE ffile);
static inline short READ_FONT_SHORT(FONTFILE ffile);
static inline ubyte READ_FONT_BYTE(FONTFILE ffile);
static inline int READ_FONT_DATA(FONTFILE ffile, void *buf, int size, int nelem);
static inline FONTFILE OPEN_FONT(char *filename, bool &success);
static inline void CLOSE_FONT(FONTFILE ffile);
#define BITS_TO_BYTES(_c) (((_c) + 7) >> 3)
#define BITS_TO_SHORTS(_c) (((_c) + 15) >> 4)

View File

@ -94,7 +94,7 @@
#include "texture.h"
#include "renderer.h"
inline unsigned XLAT_RGB_TO_16(ddgr_color c) {
static inline unsigned XLAT_RGB_TO_16(ddgr_color c) {
unsigned char r, g, b;
r = (unsigned char)((c & 0x00ff0000) >> 16);
g = (unsigned char)((c & 0x0000ff00) >> 8);

View File

@ -479,6 +479,9 @@
extern int AI_unique_goal_id;
static void GoalInitWanderAround(object *obj, goal *goal_ptr);
static int GoalAllocSlot(object *obj, int level, float influence);
#define BASH_TO_ANIM_SCALER 10.0f
#define MAX_BASH_TO_FLINCH_TIME 2.5f

View File

@ -1563,7 +1563,40 @@ bool AI_debug_robot_do = false;
int AI_debug_robot_index = -2;
#endif
bool compute_dodge_dir(/* vector *dodge_dir, */ object *obj, object *dodge_obj);
static bool compute_dodge_dir(/* vector *dodge_dir, */ object *obj, object *dodge_obj);
static float AIDetermineObjVisLevel(object *obj, object *target);
static bool move_relative_object_vec(object *obj, vector *vec, object *target, float circle_dist, float scalar,
bool f_toward, vector *mdir, bool *f_moved);
static void move_away_from_position(object *obj, vector *pos /*, bool random_evade*/, float scale, vector *mdir,
bool *f_moved);
static bool goal_do_dodge(object *obj, int goal_index);
static bool goal_do_avoid_walls(object *obj, vector *mdir);
static bool MeleeHitOk(object *obj);
static bool AiMelee(object *obj);
static void do_ranged_attack(object *obj);
static bool AIDetermineAimPoint(object *robot, object *target, vector *aim_pt, float weapon_speed = 0.0f);
static vector *AIDetermineFovVec(object *obj, vector *fov);
static void AISeeTarget(object *obj, bool f_see);
static void ai_do_animation(object *obj, float anim_time);
static void ObjSetAIInfo(object *objp);
static void AICheckTargetVis(object *obj);
static void ai_update_registers(object *obj);
static bool AiGoalAvoid(vector *adir, object *obj, object *a_obj, float dist);
static void AIGoalDoRepulse(object *obj, float dist, vector *dir, goal *goal, vector *mdir);
static void AIGoalDoCohesion(object *obj, object *g_obj, float dist, goal *goal, vector *mdir);
static void AIGoalDoAlignment(object *obj, float dist, vector *fvec, goal *goal, vector *mdir);
static void AIDoTrackFrame(object *obj);
static void AIDoOrientVelocity(object *obj);
static void AIDoOrientDefault(object *obj);
static void AIDoOrient(object *obj, int g_index);
static void AIDetermineSpeed(object *obj, int flags, float *speed);
static void ai_move(object *obj);
static void ai_fire(object *obj);
static int AIGetTeam(object *obj);
static void AITargetCheck(object *obj, object *target, object **best_obj, float *best_dot, float *best_dist);
static void AIDetermineTarget(object *obj);
static void AIDoFreud(object *obj);
static void AIDoMemFrame(object *obj);
// chrishack -- AI problems
@ -1598,14 +1631,14 @@ int AI_NumHostileAlert = 0;
int Buddy_handle[MAX_PLAYERS];
int AI_FriendNumNear = 0; // Number of friends found
object *AI_FriendObj[2]; // Friend objects
float AI_FriendDist[2]; // Distances to the friends
vector AI_FriendDir[2]; // Direction to the friends
int AI_EnemyNumNear = 0; // Number of enemies found
object *AI_EnemyObj[2]; // Enemy objects
float AI_EnemyDist[2]; // Distances to the enemies
vector AI_EnemyDir[2]; // Direction to the enemies
static int AI_FriendNumNear = 0; // Number of friends found
static object *AI_FriendObj[2]; // Friend objects
static float AI_FriendDist[2]; // Distances to the friends
static vector AI_FriendDir[2]; // Direction to the friends
static int AI_EnemyNumNear = 0; // Number of enemies found
static object *AI_EnemyObj[2]; // Enemy objects
static float AI_EnemyDist[2]; // Distances to the enemies
static vector AI_EnemyDir[2]; // Direction to the enemies
#define AIVIS_NONE 0.0f
#define AIVIS_BARELY 1.0f
@ -1648,7 +1681,7 @@ float AIDetermineObjVisLevel(object *obj, object *target) {
return vis_level;
}
inline bool ai_target_valid(object *obj) {
static inline bool ai_target_valid(object *obj) {
ai_frame *ai_info = obj->ai_info;
bool f_valid = false;
@ -1917,8 +1950,6 @@ bool goal_do_dodge(object *obj, int goal_index) {
return false;
}
extern uint check_point_to_face(vector *colp, vector *face_normal, int nv, vector **vertex_ptr_list);
#define MAX_WALL_AVOID_INFLUENCE 0.9f
#define MAX_TERRAIN_AVOID_INFLUENCE 0.9f
#define GB_WALL_PULSE_INTERVAL 7
@ -2224,6 +2255,7 @@ bool AITurnTowardsMatrix(object *obj, float turn_rate, matrix *g_orient) {
return false;
}
// MTS: Unused?
void AITurnTowardsPosition(object *obj, /*velocity *new_vel,*/ vector *pos /*, bool remain_level*/) {
vector goal_dir = *pos - obj->pos;
ai_frame *ai_info = obj->ai_info;
@ -2734,7 +2766,7 @@ new_anim_label:
}
}
inline void ApplyConstantForce(object *objp, vector *new_pos, vector *force, float delta_time) {
static inline void ApplyConstantForce(object *objp, vector *new_pos, vector *force, float delta_time) {
const vector velocity = objp->mtype.phys_info.velocity;
const float drag = objp->mtype.phys_info.drag;
const float mass = objp->mtype.phys_info.mass;
@ -2744,7 +2776,7 @@ inline void ApplyConstantForce(object *objp, vector *new_pos, vector *force, flo
(mass / drag) * (velocity - (*force / drag)) * (1 - exp(-(drag / mass) * delta_time));
}
bool AIDetermineAimPoint(object *robot, object *target, vector *aim_pt, float weapon_speed = 0.0f) {
bool AIDetermineAimPoint(object *robot, object *target, vector *aim_pt, float weapon_speed) {
if (DIFF_LEVEL == DIFFICULTY_TRAINEE && ((robot->ai_info->flags & AIF_TEAM_MASK) != AIF_TEAM_REBEL)) {
*aim_pt = target->pos;
return true;
@ -3470,6 +3502,7 @@ done:
#define FRR_MAX_TRIES 15
// MTS: Unused?
int AIGoalGotoRandomRoom() { return -1; }
int AIFindRandomRoom(object *obj, ai_frame *ai_info, goal *goal_ptr, int avoid_room, int min_depth, int max_depth,
@ -4076,8 +4109,10 @@ bool AIStatusCircleFrame(object *obj, object *g_obj, float dist, float c_dist, i
}
}
// MTS: Unused?
bool ai_target_need_path(object *obj) { return true; }
// MTS: Unused?
bool ai_move_need_path(object *obj, vector *pos, int roomnum) {
if (obj->roomnum == roomnum) {
return false;
@ -4146,7 +4181,7 @@ bool AiGoalAvoid(vector *adir, object *obj, object *a_obj, float dist) {
return true;
}
inline bool IsTargetLocal(object *obj, object *target) {
static inline bool IsTargetLocal(object *obj, object *target) {
int target_room = target->roomnum;
int cur_room = obj->roomnum;
int i;
@ -4181,6 +4216,7 @@ inline bool IsTargetLocal(object *obj, object *target) {
#define COHESION_OPTI2_DIST 90.0f
#define COHESION_FALL_OFF 110.0f
// MTS: commented out/returns a bool instead of a float
float AIGoalIsEnabledForDist(goal *goal, float dist) {
return true; // chrishack -- test code -- temp
}
@ -4332,6 +4368,7 @@ void AIDoTrackFrame(object *obj) {
}
}
// MTS: unused?
float AIDetermineGoalInfluence(object *obj, goal *goal) {
float influence = goal->influence;
int g_index = goal - obj->ai_info->goals;
@ -4405,12 +4442,6 @@ void AIDoOrientDefault(object *obj) {
}
}
extern bool AIPathAtEnd(ai_path_info *aip);
extern bool AIPathAtStart(ai_path_info *aip);
extern bool AIPathGetNextNodePos(ai_path_info *aip, vector *pos, int *room = NULL);
extern bool AIPathGetPrevNodePos(ai_path_info *aip, vector *pos, int *room = NULL);
extern bool AIPathGetCurrentNodePos(ai_path_info *aip, vector *pos, int *room = NULL);
void AIDoOrient(object *obj, int g_index) {
ai_frame *ai_info = obj->ai_info;
goal *goal_ptr = &ai_info->goals[g_index];
@ -5512,7 +5543,7 @@ void ai_fire(object *obj) {
#define PERCENT_QUIRK_PER_SEC .1
#define PERCENT_TAUNT_PER_SEC .1
inline void do_awareness_based_anim_stuff(object *obj) {
static inline void do_awareness_based_anim_stuff(object *obj) {
int next_anim;
ai_frame *ai_info = obj->ai_info;
@ -5557,7 +5588,7 @@ inline void do_awareness_based_anim_stuff(object *obj) {
}
}
inline void ai_decrease_awareness(object *obj) {
static inline void ai_decrease_awareness(object *obj) {
ai_frame *ai_info = obj->ai_info;
if (ai_info->awareness == AWARE_NONE && !(ai_info->flags & AIF_PERSISTANT)) {
@ -5583,7 +5614,7 @@ inline void ai_decrease_awareness(object *obj) {
// mprintf((0, "Awareness %f", ai_info->awareness));
}
inline bool ai_do_script_stuff(object *obj) {
static inline bool ai_do_script_stuff(object *obj) {
tOSIRISEventInfo ei;
Osiris_CallEvent(obj, EVT_AI_FRAME, &ei);
//@$-D3XExecScript(obj, EVT_AI_FRAME, NULL, REF_OBJTYPE, NULL);
@ -5591,7 +5622,7 @@ inline bool ai_do_script_stuff(object *obj) {
return true;
}
inline void ai_walker_stuff(object *obj) {
static inline void ai_walker_stuff(object *obj) {
ai_frame *ai_info = obj->ai_info;
// Do standing->walking and walking->standing stuff

View File

@ -141,33 +141,33 @@
#define BOA_VERSION 25
const ubyte bbf_lookup[27] = {(0),
(0x01),
(0x02),
(0x04),
(0x08),
(0x10),
(0x20),
(0x01 | 0x02),
(0x01 | 0x04),
(0x01 | 0x10),
(0x01 | 0x20),
(0x02 | 0x04),
(0x02 | 0x08),
(0x02 | 0x20),
(0x04 | 0x08),
(0x04 | 0x10),
(0x08 | 0x10),
(0x08 | 0x20),
(0x10 | 0x20),
(0x01 | 0x02 | 0x04),
(0x01 | 0x02 | 0x20),
(0x01 | 0x04 | 0x10),
(0x01 | 0x10 | 0x20),
(0x08 | 0x02 | 0x04),
(0x08 | 0x02 | 0x20),
(0x08 | 0x04 | 0x10),
(0x08 | 0x10 | 0x20)};
static const ubyte bbf_lookup[27] = {(0),
(0x01),
(0x02),
(0x04),
(0x08),
(0x10),
(0x20),
(0x01 | 0x02),
(0x01 | 0x04),
(0x01 | 0x10),
(0x01 | 0x20),
(0x02 | 0x04),
(0x02 | 0x08),
(0x02 | 0x20),
(0x04 | 0x08),
(0x04 | 0x10),
(0x08 | 0x10),
(0x08 | 0x20),
(0x10 | 0x20),
(0x01 | 0x02 | 0x04),
(0x01 | 0x02 | 0x20),
(0x01 | 0x04 | 0x10),
(0x01 | 0x10 | 0x20),
(0x08 | 0x02 | 0x04),
(0x08 | 0x02 | 0x20),
(0x08 | 0x04 | 0x10),
(0x08 | 0x10 | 0x20)};
unsigned short BOA_Array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS];
float BOA_cost_array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_PATH_PORTALS];
@ -177,7 +177,7 @@ bool BOA_vis_valid = 0; // Is the vis table up to date and valid to use?
int BOA_AABB_checksum = 0;
int BOA_AABB_ROOM_checksum[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS];
bool BOA_f_making_boa = false;
static bool BOA_f_making_boa = false;
int BOA_num_mines = 0;
int BOA_num_terrain_regions = 0;
@ -185,7 +185,25 @@ int BOA_num_terrain_regions = 0;
int BOA_num_connect[MAX_BOA_TERRAIN_REGIONS];
connect_data BOA_connect[MAX_BOA_TERRAIN_REGIONS][MAX_PATH_PORTALS];
void ComputeBOAVisFaceUpperLeft(room *rp, face *fp, vector *upper_left, float *xdiff, float *ydiff, vector *center);
static void add_mine_room(int room, int mine, char *checked);
static void compute_mine_info();
static void add_terrain_cell(int cell, int t_region, char *checked);
static void compute_terrain_region_info();
static void compute_sound_dist_info();
static void clear_BOA();
static void compute_costs();
static void update_path_info(q_item *node_list[MAX_ROOMS], int start, int end);
static void FindPath(int i, int j);
static void compute_next_segs();
static void compute_blockage_info();
static void ComputeBOAVisFaceUpperLeft(room *rp, face *fp, vector *upper_left, float *xdiff, float *ydiff,
vector *center);
static int BOAGetRoomChecksum(int i);
static bool IsPathPointValid(int room, vector *pos);
static void ValidateRoomPathPoint(int room, char *message, int len);
static void verify_connections();
static void find_small_portals();
static void compute_robot_path_info();
bool BOA_PassablePortal(int room, int portal_index, bool f_for_sound, bool f_making_robot_path_invalid_list) {
if (room == -1) {
@ -1483,8 +1501,6 @@ void ComputeBOAVisFaceUpperLeft(room *rp, face *fp, vector *upper_left, float *x
*center = avg_vert;
}
extern uint check_point_to_face(vector *colp, vector *face_normal, int nv, vector **vertex_ptr_list);
#if (defined(EDITOR) || defined(NEWEDITOR))
#ifdef NEWEDITOR
@ -2082,7 +2098,7 @@ void MakeBOA(void) {
mprintf((0, "BOA is done\n"));
}
int Current_sort_room;
static int Current_sort_room;
static int face_sort_func1(const short *a, const short *b) {
if (Rooms[Current_sort_room].faces[*a].min_xyz.y > Rooms[Current_sort_room].faces[*b].min_xyz.y)

View File

@ -229,21 +229,39 @@ typedef struct {
#define TAG_PLEVELNUM 1
#define TAG_NLEVELNUM 2
tBriefingTag HotTags[] = {
static tBriefingTag HotTags[] = {
{"#LEVELNUM#", TAG_LEVELNUM, -1},
{"#PLEVELNUM#", TAG_PLEVELNUM, -1},
{"#NLEVELNUM#", TAG_NLEVELNUM, -1},
};
int NumHotTags = sizeof(HotTags) / sizeof(tBriefingTag);
static const int NumHotTags = sizeof(HotTags) / sizeof(tBriefingTag);
int osb_xoff = 0, osb_yoff = 0;
int current_screen = -1;
tTelComInfo *pb_tcs = NULL;
bool gottitle = false;
bool pbfirst_call;
char pbtitle[100];
bool ok_to_parse_screen = false;
int skipped_screens;
static int osb_xoff = 0, osb_yoff = 0;
static int current_screen = -1;
static tTelComInfo *pb_tcs = NULL;
static bool gottitle = false;
static bool pbfirst_call;
static char pbtitle[100];
static bool ok_to_parse_screen = false;
static int skipped_screens;
static bool IsMissionMaskOK(uint set, uint unset);
static void ReplaceHotTag(char *string, int tag);
static bool ParseForHotTags(char *src, char **dest);
static bool PlayBriefing(tTelComInfo *tcs);
static void PBAddTextEffect(LPTCTEXTDESC desc, char *text, char *description, int id);
static void PBAddBmpEffect(LPTCBMPDESC desc, char *description);
static void PBAddMovieEffect(LPTCMOVIEDESC desc, char *description);
static void PBAddBkgEffect(LPTCBKGDESC desc, char *description);
static void PBAddPolyEffect(LPTCPOLYDESC desc, char *description);
static void PBAddButtonEffect(LPTCBUTTONDESC desc, char *description, int id);
static void PBStartScreen(int screen_num, char *description, char *layout, uint mask_set, uint mask_unset);
static void PBEndScreen();
static bool PBLoopCallback();
static void PBSetTitle(char *title);
static void PBSetStatic(float amount);
static void PBSetGlitch(float amount);
static void PBAddVoice(char *filename, int flags, char *description);
bool IsMissionMaskOK(uint set, uint unset) {
uint Gamemissionmask = Current_mission.game_state_flags;

View File

@ -142,8 +142,8 @@ void CBriefParse::SetCallbacks(tBriefParseCallbacks *cb) {
#define B_QUIT 4 // exit TelCom
// Keywords. These must match the keyword IDs above
const char *keywords[] = {"screen", "button", "text", "endtext", "bitmap", "endscreen", "movie",
"poly", "title", "sound", "static", "glitch", "voice"};
static const char *const keywords[] = {"screen", "button", "text", "endtext", "bitmap", "endscreen", "movie",
"poly", "title", "sound", "static", "glitch", "voice"};
#define tfxNONE 0
#define tfxFLASH 1
@ -157,10 +157,10 @@ const char *keywords[] = {"screen", "button", "text", "endtext", "bitmap", "end
#define fntSMBRIEF 0
#define fntLGBRIEF 1
const char *FontNames[] = {"sm_brief", "lg_brief", NULL};
static const char *const FontNames[] = {"sm_brief", "lg_brief", NULL};
const char *TextEffectstr[] = {"None", "flash", "scroll_l2r", "scroll_r2l", "scroll_t2b",
"scroll_b2t", "fade_in_and_out", "fade_in", "fade_out", NULL};
static const char *const TextEffectstr[] = {"None", "flash", "scroll_l2r", "scroll_r2l", "scroll_t2b",
"scroll_b2t", "fade_in_and_out", "fade_in", "fade_out", NULL};
#define bfxNONE 0
#define bfxFADE_IN 1
#define bfxFADE_OUT 2
@ -173,8 +173,9 @@ const char *TextEffectstr[] = {"None", "flash", "scroll_l2r", "s
#define bfxSTRETCH_IN 9
#define bfxSTRETCH_OUT 10
const char *BitmapEffectstr[] = {"None", "Fade_in", "Fade_out", "Blur_in", "Blur_out", "Scan_in",
"Scan_out", "Invert_in", "Invert_out", "Stretch_in", "Stretch_out", NULL};
static const char *const BitmapEffectstr[] = {"None", "Fade_in", "Fade_out", "Blur_in",
"Blur_out", "Scan_in", "Scan_out", "Invert_in",
"Invert_out", "Stretch_in", "Stretch_out", NULL};
////////////////////////////////////////////
// These are the types of on screen buttons
@ -185,7 +186,7 @@ const char *BitmapEffectstr[] = {"None", "Fade_in", "Fade_out", "Blur_in
#define osbQUIT 4
#define osbJUMP_PAGE 5
const char *OnScreenButtonTypes[] = {"Down", "Up", "Next", "Prev", "Quit", "Jump", NULL};
static const char *const OnScreenButtonTypes[] = {"Down", "Up", "Next", "Prev", "Quit", "Jump", NULL};
/////////////////////////////////////////////
// These are the different ways an onscreen button will respond to mouse clicks
@ -193,7 +194,7 @@ const char *OnScreenButtonTypes[] = {"Down", "Up", "Next", "Prev", "Quit", "Jump
#define oscCLICK_DOWN 1
#define oscCLICK_UP 2
const char *OnScreenButtonClickTypes[] = {"HoldDown", "ClickDown", "ClickUp", NULL};
static const char *const OnScreenButtonClickTypes[] = {"HoldDown", "ClickDown", "ClickUp", NULL};
#define PARSE_INT(i) \
do { \
@ -226,7 +227,7 @@ const char *OnScreenButtonClickTypes[] = {"HoldDown", "ClickDown", "ClickUp", NU
goto done_parsing; \
} while (0)
int ReadFullLine(char **data, CFILE *ifile) {
static int ReadFullLine(char **data, CFILE *ifile) {
int counter, readin;
char buffer[512];
bool done;
@ -336,7 +337,7 @@ int CBriefParse::ParseBriefing(const char *filename) {
// Read & parse lines
int bytes_read;
const char *p;
const char *p;
linebuf = NULL;

View File

@ -433,7 +433,6 @@
#include <stdlib.h>
#include <memory.h>
float Key_ramp_speed = 0.5f;
#define CONTROL_POLL_RATE (1.0f / 25.0f)
@ -468,18 +467,18 @@ static tSpace Key_ramp;
// PROTOTYPES
void DoMovement(game_controls *controls);
void DoKeyboardMovement(game_controls *controls);
void DoControllerMovement(game_controls *controls);
void DoWeapons(game_controls *controls);
void DoKeyboardWeapons(game_controls *controls);
void DoControllerWeapons(game_controls *controls);
void DoMisc(game_controls *contols);
void DoKeyboardMisc(game_controls *controls);
void DoControllerMisc(game_controls *controls);
static void DoKeyboardMovement(game_controls *controls);
static void DoControllerMovement(game_controls *controls);
static void DoWeapons(game_controls *controls);
static void DoKeyboardWeapons(game_controls *controls);
static void DoControllerWeapons(game_controls *controls);
static void DoMisc(game_controls *contols);
static void DoKeyboardMisc(game_controls *controls);
static void DoControllerMisc(game_controls *controls);
// MTS: no implementation!
void DoCommands();
void ToggleHeadlightControlState();
static void ToggleHeadlightControlState();
// LIST OF NEEDS
ct_function Controller_needs[NUM_CONTROLLER_FUNCTIONS] = {
@ -558,7 +557,7 @@ ct_function Controller_needs[NUM_CONTROLLER_FUNCTIONS] = {
{ctfAUDIOTAUNT4_BTN, ctDownCount, ctButton, ctButton, 0, 0, 0, 0}};
// ramping macros
inline float ramp_control_value(float val, float limit, float &ramp_state, float &old_ramp_delta) {
static inline float ramp_control_value(float val, float limit, float &ramp_state, float &old_ramp_delta) {
float sign = val / fabs(val), old_sign = old_ramp_delta / fabs(old_ramp_delta);
if (sign != old_sign)
ramp_state = -ramp_state;
@ -620,7 +619,7 @@ void InitControls() {
Key_ramp.oy = Key_ramp.y = 0.0f;
Key_ramp.oz = Key_ramp.z = 0.0f;
// Initialize preemptive controller system for non-positonal data.
// Initialize preemptive controller system for non-positonal data.
mprintf((0, "Initialized control system.\n"));
}
@ -1131,9 +1130,9 @@ void DoMisc(game_controls *controls) {
}
// use the currently selected inventory item
bool UseInventoryItem();
extern bool UseInventoryItem();
// use the currently selected countermeasure
bool UseCountermeasure();
extern bool UseCountermeasure();
// Inventory/CounterMeasure states
void DoKeyboardMisc(game_controls *controls) {

View File

@ -128,269 +128,269 @@
#include "joystick.h"
// all controller binding texts
char Ctltext_KeyBindings[][16] = {"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"bspc\0\0\0\0\0\0",
"tab\0\0\0\0\0\0",
"q",
"w",
"e",
"r",
"t",
"y",
"u",
"i",
"o",
"p",
"[",
"]",
"enter\0\0\0\0\0",
"lctrl\0\0\0\0\0",
"a",
"s",
"d",
"f",
"g",
"h",
"j",
"k",
"l",
";",
"'",
"`",
"lshft\0\0\0\0\0",
"\\",
"z",
"x",
"c",
"v",
"b",
"n",
"m",
",",
".",
"/",
"rshft\0\0\0\0\0",
"pad*\0\0\0\0\0",
"lalt\0\0\0\0\0",
"spc\0\0\0\0\0",
"caps\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"num\0\0\0\0\0",
"sclk\0\0\0\0\0",
"pad7\0\0\0\0\0",
"pad8\0\0\0\0\0",
"pad9\0\0\0\0\0",
"pad-\0\0\0\0\0",
"pad4\0\0\0\0\0",
"pad5\0\0\0\0\0",
"pad6\0\0\0\0\0",
"pad+\0\0\0\0\0",
"pad1\0\0\0\0\0",
"pad2\0\0\0\0\0",
"pad3\0\0\0\0\0",
"pad0\0\0\0\0\0",
"pad.\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"pad<EFBFBD>\0\0\0\0\0\0",
"rctrl\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"pad/\0\0\0\0\0\0",
"",
"",
"ralt\0\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"home\0\0\0\0\0\0",
"up\0\0\0\0\0\0\0",
"pgup\0\0\0\0\0\0",
"",
"left\0\0\0\0\0\0",
"",
"right\0\0\0\0\0\0",
"",
"end\0\0\0\0\0\0\0",
"down\0\0\0\0\0\0",
"pgdn\0\0\0\0\0\0",
"ins\0\0\0\0\0\0",
"del\0\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""};
static char Ctltext_KeyBindings[][16] = {"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"bspc\0\0\0\0\0\0",
"tab\0\0\0\0\0\0",
"q",
"w",
"e",
"r",
"t",
"y",
"u",
"i",
"o",
"p",
"[",
"]",
"enter\0\0\0\0\0",
"lctrl\0\0\0\0\0",
"a",
"s",
"d",
"f",
"g",
"h",
"j",
"k",
"l",
";",
"'",
"`",
"lshft\0\0\0\0\0",
"\\",
"z",
"x",
"c",
"v",
"b",
"n",
"m",
",",
".",
"/",
"rshft\0\0\0\0\0",
"pad*\0\0\0\0\0",
"lalt\0\0\0\0\0",
"spc\0\0\0\0\0",
"caps\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"num\0\0\0\0\0",
"sclk\0\0\0\0\0",
"pad7\0\0\0\0\0",
"pad8\0\0\0\0\0",
"pad9\0\0\0\0\0",
"pad-\0\0\0\0\0",
"pad4\0\0\0\0\0",
"pad5\0\0\0\0\0",
"pad6\0\0\0\0\0",
"pad+\0\0\0\0\0",
"pad1\0\0\0\0\0",
"pad2\0\0\0\0\0",
"pad3\0\0\0\0\0",
"pad0\0\0\0\0\0",
"pad.\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"pad<EFBFBD>\0\0\0\0\0\0",
"rctrl\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"pad/\0\0\0\0\0\0",
"",
"",
"ralt\0\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"home\0\0\0\0\0\0",
"up\0\0\0\0\0\0\0",
"pgup\0\0\0\0\0\0",
"",
"left\0\0\0\0\0\0",
"",
"right\0\0\0\0\0\0",
"",
"end\0\0\0\0\0\0\0",
"down\0\0\0\0\0\0",
"pgdn\0\0\0\0\0\0",
"ins\0\0\0\0\0\0",
"del\0\0\0\0\0\0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""};
static short key_binding_indices[] = {
KEY_BACKSP, KEY_TAB, KEY_ENTER, KEY_LCTRL, KEY_LSHIFT, KEY_RSHIFT, KEY_PADMULTIPLY, KEY_LALT,
KEY_SPACEBAR, KEY_CAPSLOCK, 0x45, KEY_SCROLLOCK, KEY_PAD7, KEY_PAD8, KEY_PAD9, KEY_PADMINUS,
KEY_PAD4, KEY_PAD5, KEY_PAD6, KEY_PADPLUS, KEY_PAD1, KEY_PAD2, KEY_PAD3, KEY_PAD0,
KEY_PADPERIOD, KEY_PADENTER, KEY_RCTRL, KEY_PADDIVIDE, KEY_RALT, KEY_HOME, KEY_UP, KEY_PAGEUP,
KEY_LEFT, KEY_RIGHT, KEY_END, KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE,
0xff};
KEY_BACKSP, KEY_TAB, KEY_ENTER, KEY_LCTRL, KEY_LSHIFT, KEY_RSHIFT, KEY_PADMULTIPLY, KEY_LALT,
KEY_SPACEBAR, KEY_CAPSLOCK, 0x45, KEY_SCROLLOCK, KEY_PAD7, KEY_PAD8, KEY_PAD9, KEY_PADMINUS,
KEY_PAD4, KEY_PAD5, KEY_PAD6, KEY_PADPLUS, KEY_PAD1, KEY_PAD2, KEY_PAD3, KEY_PAD0,
KEY_PADPERIOD, KEY_PADENTER, KEY_RCTRL, KEY_PADDIVIDE, KEY_RALT, KEY_HOME, KEY_UP, KEY_PAGEUP,
KEY_LEFT, KEY_RIGHT, KEY_END, KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, 0xff};
#define NUM_KEYBINDSTRINGS (sizeof(Ctltext_KeyBindings) / sizeof(char *))
@ -536,7 +536,7 @@ UIBitmapItem *cfg_element::m_xbtn_bmp_lit = NULL;
UIBitmapItem *cfg_element::m_xbtn_bmp = NULL;
short cfg_element::m_count = 0;
const char *cfg_binding_text(ct_type ctype, ubyte binding);
// MTS: unused?
bool key_cfg_element(ubyte *element, ubyte *flags);
//////////////////////////////////////////////////////////////////////////////

View File

@ -119,7 +119,7 @@ typedef struct tCfgDataParts {
ubyte bind_0, bind_1, ctrl_0, ctrl_1;
} tCfgDataParts;
inline void parse_config_data(tCfgDataParts *parts, ct_type type0, ct_type type1, ct_config_data cfgdata) {
static inline void parse_config_data(tCfgDataParts *parts, ct_type type0, ct_type type1, ct_config_data cfgdata) {
switch (type0) {
case ctKey:
parts->bind_0 = CONTROLLER_KEY1_VALUE(CONTROLLER_VALUE(cfgdata));
@ -160,9 +160,11 @@ inline void parse_config_data(tCfgDataParts *parts, ct_type type0, ct_type type1
parts->ctrl_1 = CONTROLLER_CTL2_INFO(CONTROLLER_INFO(cfgdata));
}
inline ct_config_data unify_config_data(tCfgDataParts *parts) {
static inline ct_config_data unify_config_data(tCfgDataParts *parts) {
return MAKE_CONFIG_DATA(CONTROLLER_CTL_INFO(parts->ctrl_0, parts->ctrl_1),
CONTROLLER_CTL_VALUE(parts->bind_0, parts->bind_1));
}
extern const char *cfg_binding_text(ct_type ctype, ubyte ctrl, ubyte binding);
#endif

View File

@ -72,7 +72,7 @@ extern int Camera_view_mode[NUM_CAMERA_VIEWS];
// Purpose:
// This function initializes a Module Init Struct with all the needed data to get sent
// to the module during initialization.
void Osiris_CreateModuleInitStruct(tOSIRISModuleInit *mi);
extern void Osiris_CreateModuleInitStruct(tOSIRISModuleInit *mi);
module GameDLLHandle = {NULL};
extern ddgr_color Player_colors[];
typedef struct {

View File

@ -877,6 +877,7 @@
#include "gamefont.h"
#include "renderobject.h"
#include "vibeinterface.h"
#include "buddymenu.h"
#ifdef EDITOR
#include "editor\d3edit.h"
@ -1178,8 +1179,6 @@ void ProcessButtons() {
#define GBC_RTYPE 39 // Use Gaurdian Powerup
#define GBC_ANTI_VIRUS 40 // Use Anti-virus Powerup
#define GBC_RETURN_TO_SHIP 43 // Return to ship
extern int Buddy_handle[MAX_PLAYERS];
extern void MultiSendGuidebotMenuSelection(gb_com *);
// Handles guidebot shortcut keys
void ProcessGuidebotKeys(int key) {
if (!(key & KEY_SHIFTED))

View File

@ -671,6 +671,7 @@
#include "BOA.h"
#include "terrain.h"
#include "multi.h"
#include "hud.h"
// ---------------------------------------------------------------------------
// Data
// ---------------------------------------------------------------------------
@ -699,14 +700,14 @@ bool mn3_GetInfo(const char *mn3file, tMissionInfo *msn);
// closes the current mn3 file
void mn3_Close();
inline bool IS_MN3_FILE(const char *fname) {
static inline bool IS_MN3_FILE(const char *fname) {
char name[PSFILENAME_LEN + 1];
char ext[PSFILENAME_LEN + 1];
ddio_SplitPath(fname, NULL, name, ext);
return (strcmpi(ext, ".mn3") == 0) ? true : false;
}
inline char *MN3_TO_MSN_NAME(const char *mn3name, char *msnname) {
static inline char *MN3_TO_MSN_NAME(const char *mn3name, char *msnname) {
char fname[PSFILENAME_LEN + 1];
ddio_SplitPath(mn3name, NULL, fname, NULL);
@ -1276,7 +1277,7 @@ void LoadLevelText(const char *level_filename) {
DestroyStringTable(goal_strings, n_strings);
}
}
extern bool Hud_show_controls;
/* loads a level and sets it as current level in mission
*/
bool LoadMissionLevel(int level) {
@ -1315,8 +1316,6 @@ bool LoadMissionLevel(int level) {
#define LOADBAR_W (260 * (float)Max_window_w / (float)FIXED_SCREEN_WIDTH)
#define LOADBAR_H (22 * (float)Max_window_h / (float)FIXED_SCREEN_HEIGHT)
#define N_LOAD_MSGS 12
extern int need_to_page_in;
extern int paged_in_count;
bool started_page = 0;
/*
$$TABLE_GAMEFILE "tunnelload.ogf"

View File

@ -105,22 +105,22 @@ struct object;
struct trigger;
// assigns scripts for a level.
void AssignScriptsForLevel();
extern void AssignScriptsForLevel();
// free scripts for a level
void FreeScriptsForLevel();
extern void FreeScriptsForLevel();
// allocates and initializes the scripts for an object.
void InitObjectScripts(object *objp, bool do_evt_created = true);
extern void InitObjectScripts(object *objp, bool do_evt_created = true);
// frees all scripts for an object.
void FreeObjectScripts(object *objp, bool level_end = false);
extern void FreeObjectScripts(object *objp, bool level_end = false);
// allocates and initializes the scripts for a trigger.
void InitTriggerScript(trigger *tp);
extern void InitTriggerScript(trigger *tp);
// frees all scripts for an trigger.
void FreeTriggerScript(trigger *tp, bool level_end = false);
extern void FreeTriggerScript(trigger *tp, bool level_end = false);
//@@// called to reinitialize an object's 'state' given the current script element of object.
//@@// refuses to call EVT_CREATED too. this just restores the state of a script given the current script_info

View File

@ -490,7 +490,7 @@ typedef struct {
#endif
} tOSIRISModule;
tOSIRISModule OSIRIS_loaded_modules[MAX_LOADED_MODULES];
static tOSIRISModule OSIRIS_loaded_modules[MAX_LOADED_MODULES];
tOSIRISModuleInit Osiris_module_init;
struct {
bool level_loaded;
@ -512,17 +512,17 @@ typedef struct {
char *temp_filename;
char *real_filename;
} tExtractedScriptInfo;
tExtractedScriptInfo OSIRIS_Extracted_scripts[MAX_LOADED_MODULES];
char *OSIRIS_Extracted_script_dir = NULL;
static tExtractedScriptInfo OSIRIS_Extracted_scripts[MAX_LOADED_MODULES];
static char *OSIRIS_Extracted_script_dir = NULL;
// Osiris_CreateModuleInitStruct
// Purpose:
// This function initializes a Module Init Struct with all the needed data to get sent
// to the module during initialization.
void Osiris_CreateModuleInitStruct(tOSIRISModuleInit *mi);
extern void Osiris_CreateModuleInitStruct(tOSIRISModuleInit *mi);
void Osiris_RestoreOMMS(CFILE *file);
void Osiris_SaveOMMS(CFILE *file);
static void Osiris_RestoreOMMS(CFILE *file);
static void Osiris_SaveOMMS(CFILE *file);
// Osiris_CreateGameChecksum
// Purpose:
@ -533,21 +533,21 @@ uint Osiris_CreateGameChecksum(void);
// Osiris_IsEventEnabled
// Purpose:
// Returns true if the event is allowed to be called
bool Osiris_IsEventEnabled(int event);
static bool Osiris_IsEventEnabled(int event);
void Cinematic_StartCannedScript(tCannedCinematicInfo *info);
extern void Cinematic_StartCannedScript(tCannedCinematicInfo *info);
// Osiris_DumpLoadedObjects
//
// Debug. Dumps all loaded objects to given file
void Osiris_DumpLoadedObjects(char *file);
void Osiris_ForceUnloadModules(void);
static void Osiris_DumpLoadedObjects(char *file);
static void Osiris_ForceUnloadModules(void);
uint Osiris_game_checksum;
ubyte Osiris_event_mask = OEM_OBJECTS | OEM_TRIGGERS | OEM_LEVELS;
bool Osiris_create_events_disabled = false;
bool Osiris_level_script_loaded = false;
static ubyte Osiris_event_mask = OEM_OBJECTS | OEM_TRIGGERS | OEM_LEVELS;
static bool Osiris_create_events_disabled = false;
static bool Osiris_level_script_loaded = false;
#define HAVECUSTOMONLY(type) (type == OBJ_CAMERA)
#define CANBEASSIGNEDSCRIPT(obj) \
@ -2283,9 +2283,9 @@ typedef struct {
} tOSIRISINTERNALTIMER;
tOSIRISINTERNALTIMER OsirisTimers[MAX_OSIRIS_TIMERS];
inline int FORM_HANDLE(int counter, int slot) { return (((counter & 0xFFFFFF) << 8) | (slot & 0xFF)); }
static inline int FORM_HANDLE(int counter, int slot) { return (((counter & 0xFFFFFF) << 8) | (slot & 0xFF)); }
inline int GET_SLOT(int handle) { return (handle & 0xFF); }
static inline int GET_SLOT(int handle) { return (handle & 0xFF); }
int Osiris_timer_counter = 0;
@ -3380,15 +3380,15 @@ tOMMSNode *Osiris_OMMS_FindHandle(OMMSHANDLE handle, tOMMSHashNode **hash = NULL
// the script) Returns -1 if there isn't enough available memory Returns -2 if the unique identifier passed in is
// already used, but the requested amount_of_memory is different Returns -3 if the unique identifier passed in is
// already used, same size requested
OMMSHANDLE Osiris_OMMS_Malloc(size_t amount_of_memory, uint unique_identifier, char *script_identifier);
static OMMSHANDLE Osiris_OMMS_Malloc(size_t amount_of_memory, uint unique_identifier, char *script_identifier);
// Attaches to a block of global OMMS memory. As long as at least one module (or script) is
// attached to a module, the memory will not be deleted. (Increments the reference count)
// Returns NULL if the memory couldn't be attached (it has been either free'd or never malloced)
void *Osiris_OMMS_Attach(OMMSHANDLE handle);
static void *Osiris_OMMS_Attach(OMMSHANDLE handle);
// Detaches a block of global OMMS memory. (Reduces the reference count).
void Osiris_OMMS_Detach(OMMSHANDLE handle);
static void Osiris_OMMS_Detach(OMMSHANDLE handle);
// Frees a block of global memory
// Only has affect if you are attached to the memory. Memory will _ONLY_ be deleted when the
@ -3400,19 +3400,19 @@ void Osiris_OMMS_Detach(OMMSHANDLE handle);
// invalid.
//
// handle : the value returned by OMMS_Malloc()
void Osiris_OMMS_Free(OMMSHANDLE handle);
static void Osiris_OMMS_Free(OMMSHANDLE handle);
// Returns an OMMSHANDLE to a block of global memory allocated by a module/script. Pass
// in the unique_identifier and the script_identifier that was passed in the OMMS_Malloc().
// Note: script_identifier is really the filename of the module that called the OMMS_Malloc().
// Returns -1 if the module was never OMMS_Malloc()'d.
OMMSHANDLE Osiris_OMMS_Find(uint unique_identifier, char *script_identifier);
static OMMSHANDLE Osiris_OMMS_Find(uint unique_identifier, char *script_identifier);
// Returns information about the OMMS memory given it's handle returned from the OMMS_Find() or
// OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in;
// Pass NULL in for those parameters you don't need information about.
char Osiris_OMMS_GetInfo(OMMSHANDLE handle, uint *mem_size, uint *uid, ushort *reference_count,
ubyte *has_free_been_called);
static char Osiris_OMMS_GetInfo(OMMSHANDLE handle, uint *mem_size, uint *uid, ushort *reference_count,
ubyte *has_free_been_called);
void Osiris_InitOMMS(void) {
OMMS_Current_base_id = 0;

View File

@ -75,11 +75,11 @@
#define PILOTPIC_DATABASE_HOG "PPics.Hog"
#define PILOTPIC_DATABASE_INDEX "PPics.idx"
CFILE *PilotPic_database_index_handle = NULL;
int PilotPic_database_hog_handle = 0;
int PilotPic_find_offset;
char PilotPic_find_name[PILOT_STRING_SIZE];
bool PilotPic_init = false;
static CFILE *PilotPic_database_index_handle = NULL;
static int PilotPic_database_hog_handle = 0;
static int PilotPic_find_offset;
static char PilotPic_find_name[PILOT_STRING_SIZE];
static bool PilotPic_init = false;
// -----------------------------------------------
// PPic_BuildDatabase
@ -87,13 +87,13 @@ bool PilotPic_init = false;
// Builds up some databases for fast access
// based off the index file.
// -----------------------------------------------
bool PPic_BuildDatabases(void);
static bool PPic_BuildDatabases(void);
// -----------------------------------------------
// PPic_FreeDatabase
// Purpose:
// Frees up memory associated with the databases
// -----------------------------------------------
void PPic_FreeDatabase(void);
static void PPic_FreeDatabase(void);
// -------------------------------------------------
// PPic_JumpToPilot
// Purpose:
@ -101,20 +101,20 @@ void PPic_FreeDatabase(void);
// the first pilot that matches pilot_name is. -1
// is returned if no match
// --------------------------------------------------
int PPic_JumpToPilot(char *pilot_name);
static int PPic_JumpToPilot(char *pilot_name);
// -------------------------------------
// PPic_GetIndexFromID
// Purpose:
// Returns the file index into the Pilot_id_to_offset
// list for the given id, -1 if not found.
// -------------------------------------
int PPic_GetIndexFromID(int id);
static int PPic_GetIndexFromID(int id);
// -------------------------------------
// PPic_GetOffsetByID
// Purpose:
// Returns the file offset of the given pilot id. -1 if not found
// -------------------------------------
int PPic_GetOffsetByID(ushort pilot_id);
static int PPic_GetOffsetByID(ushort pilot_id);
//===========================================================================
@ -745,4 +745,4 @@ int PPic_GetIndexFromID(int id) {
max = index_to_check - 1;
}
return -1;
}
}

View File

@ -1137,7 +1137,6 @@
player Players[MAX_PLAYERS];
int Player_num;
extern bool IsCheater;
int Num_teams = 0;
int Team_game = 0;
@ -1146,7 +1145,7 @@ float HudNameTan = -1;
team Teams[MAX_TEAMS];
int Highest_player_start = 0;
static int Highest_player_start = 0;
// Only one of these waypoint variable can be active at one time; the other will be -1
int Current_waypoint = 0; // the most recent manually-set waypoint, or -1
@ -1167,18 +1166,18 @@ float Player_energy_saved_from_last_level = -1.0f;
uint Players_typing; // information about which players are typing messages (to display an icon)
float Player_camera_last_sample_time = 0;
float Player_camera_last_follow_time = 0;
static float Player_camera_last_sample_time = 0;
static float Player_camera_last_follow_time = 0;
int Camera_sample_index = 0;
int Camera_follow_index = 0;
vector Camera_sample_vectors[MAX_CAMERA_SAMPLES];
matrix Camera_sample_matrix[MAX_CAMERA_SAMPLES];
int Camera_sample_rooms[MAX_CAMERA_SAMPLES];
static int Camera_sample_index = 0;
static int Camera_follow_index = 0;
static vector Camera_sample_vectors[MAX_CAMERA_SAMPLES];
static matrix Camera_sample_matrix[MAX_CAMERA_SAMPLES];
static int Camera_sample_rooms[MAX_CAMERA_SAMPLES];
float Total_time_dead = 0;
void StartPlayerDeath(int slot, float damage, bool melee, int fate);
static void StartPlayerDeath(int slot, float damage, bool melee, int fate);
// Sets up the players array
void InitPlayers() {

View File

@ -178,10 +178,10 @@ typedef struct {
} small_view;
// The array of small views
small_view Small_views[NUM_SMALL_VIEWS];
static small_view Small_views[NUM_SMALL_VIEWS];
// Saved copies of small views for while a pop-up is active
small_view Small_views_save[NUM_SMALL_VIEWS];
static small_view Small_views_save[NUM_SMALL_VIEWS];
// guided missile in small view? if so, then true.
bool Guided_missile_smallview = false;

View File

@ -528,32 +528,33 @@
//------------------------------New TelCom Stuff---------------------------------------
void TelCom_BltToMem(int dest_bmp, int dx, int dy, int src_bmp, int sx, int sy, int sw, int sh, bool trans = true);
void TelCom_BltToScreen(int dx, int dy, chunked_bitmap *src_bmp);
void TelCom_BltToScreen(int dx, int dy, chunked_bitmap *src_bmp, int sx, int sy, int sw, int sh);
void DrawHotSpotOn(int hotspot);
static void TelCom_BltToMem(int dest_bmp, int dx, int dy, int src_bmp, int sx, int sy, int sw, int sh,
bool trans = true);
static void TelCom_BltToScreen(int dx, int dy, chunked_bitmap *src_bmp);
static void TelCom_BltToScreen(int dx, int dy, chunked_bitmap *src_bmp, int sx, int sy, int sw, int sh);
static void DrawHotSpotOn(int hotspot);
//*************************************************************************************
// Globals---------------------------------------------------------------------------
bool TelCom_init = false; // Whether the TelComInit() function was called
bool Telcom_first_render = true;
bool Telcom_exit_to_mainmenu = false;
static bool TelCom_init = false; // Whether the TelComInit() function was called
static bool Telcom_first_render = true;
static bool Telcom_exit_to_mainmenu = false;
bool Telcom_called_from_game = false;
int Telcom_mouse_last_effect = -1; // the last efxnum the mouse was over
static int Telcom_mouse_last_effect = -1; // the last efxnum the mouse was over
hotspotmap_t hotspotmap; // Holds hotspot data (position)
windowmap_t windowmap; // Holds window data (position)
tTelComInfo Telcom_system;
chunked_bitmap Telcom_bitmap; // background bitmap for telcom system
chunked_bitmap *hotspot_bitmaps;
int LoadTelcomBitmap(const char *filename, chunked_bitmap *bmp);
bool TelComMainMenu(tTelComInfo *tcs);
static chunked_bitmap *hotspot_bitmaps;
static int LoadTelcomBitmap(const char *filename, chunked_bitmap *bmp);
static bool TelComMainMenu(tTelComInfo *tcs);
void TelCom_PrepareCustomKeyEvents(void);
void TelCom_PostProcessCustomKeyEvents(void);
static void TelCom_PrepareCustomKeyEvents(void);
static void TelCom_PostProcessCustomKeyEvents(void);
static int Telcom_mouse_x, Telcom_mouse_y;
@ -1361,88 +1362,88 @@ bool TelComMainMenu(tTelComInfo *tcs) {
*/
/// internal prototypes *************************************
// Creates the screen overlays for the main monitor
void TelcomCreateScreenOverlays(void);
static void TelcomCreateScreenOverlays(void);
// Destroys the screen overlays that were used for the main monitor
void TelcomDestroyScreenOverlays(void);
static void TelcomDestroyScreenOverlays(void);
// Renders the screen overlays
void TelcomRenderOverlays(void);
static void TelcomRenderOverlays(void);
// Renders the screen hilights
void TelcomRenderDrawHiLites(void);
static void TelcomRenderDrawHiLites(void);
// Loads the Hilites for a monitor
void TelcomLoadHiLites(const char *filelist[], int monitor, int xoff, int yoff);
static void TelcomLoadHiLites(const char *filelist[], int monitor, int xoff, int yoff);
// Frees all the memory allocated for the hilites
void TelcomFreeHiLites(void);
static void TelcomFreeHiLites(void);
// Renders the scanline to be drawn
void TelcomRenderScanline(void);
static void TelcomRenderScanline(void);
// Creates the scanline
void TelcomCreateScanLine(void);
static void TelcomCreateScanLine(void);
// Destroys the scanline
void TelcomDestroyScanLine(void);
static void TelcomDestroyScanLine(void);
// Loads the mouse cursor
void TelcomLoadMouseCursor(void);
static void TelcomLoadMouseCursor(void);
// Frees the mouse cursor
void TelcomFreeMouseCursor(void);
static void TelcomFreeMouseCursor(void);
// Renders the mouse cursor
void TelcomRenderMouse(void);
static void TelcomRenderMouse(void);
// draws the telcom background, handles flickering lights, power button etc
void TelcomDrawScreen(bool poweron, bool powerup);
static void TelcomDrawScreen(bool poweron, bool powerup);
// used to display the rounded corners of the monitor screens
void TelcomDisplayCorners(void);
static void TelcomDisplayCorners(void);
// Frees the bitmaps used for the corners of each monitor
void TelcomFreeCorners(void);
static void TelcomFreeCorners(void);
// Allocates the bitmaps for corners of each monitor
void TelcomCreateCorners(void);
static void TelcomCreateCorners(void);
// Displays static on the screen
void TelcomDisplayStatic(float amount);
static void TelcomDisplayStatic(float amount);
// Frees the static bitmap overlays
void TelcomFreeStaticOverlays(void);
static void TelcomFreeStaticOverlays(void);
// Creates the static bitmap overlays
void TelcomCreateStaticOverlays(void);
static void TelcomCreateStaticOverlays(void);
// Initializes the bitmaps, etc needed for power up/down effect
void TelcomInitPowerEffect(void);
static void TelcomInitPowerEffect(void);
// Frees the bitmaps, etc for power up/down effect
void TelcomFreePowerEffect(void);
static void TelcomFreePowerEffect(void);
// Draws a frame of the power up/down effect
void TelcomDoPowerEffect(bool power_down, float frametime);
static void TelcomDoPowerEffect(bool power_down, float frametime);
/// global variables ****************************************
// Telcom rendering globals
static void (*TC_callback)() = NULL;
int TC_current_screen = DUMMY_SCREEN;
static int TC_current_screen = DUMMY_SCREEN;
int TC_cursor = -1;
// Monitor hilight variables
int TelcomHiLiteCount[MAX_MONITOR];
int *TelcomHiLites[MAX_MONITOR];
static int TelcomHiLiteCount[MAX_MONITOR];
static int *TelcomHiLites[MAX_MONITOR];
struct {
int x, y;
} TelcomHiLiteOffset[MAX_MONITOR];
// Main monitor scanline info
float scanline_nexttime, scanline_speed;
int scanliney, scanline_handle;
float last_rendertime = 0, last_frametime = 0;
static float scanline_nexttime, scanline_speed;
static int scanliney, scanline_handle;
static float last_rendertime = 0;
float last_frametime = 0;
// Monitor corner variables
chunked_bitmap lt_corners[MAX_MONITOR];
chunked_bitmap rt_corners[MAX_MONITOR];
chunked_bitmap lb_corners[MAX_MONITOR];
chunked_bitmap rb_corners[MAX_MONITOR];
bool has_corners[MAX_MONITOR];
static chunked_bitmap lt_corners[MAX_MONITOR];
static chunked_bitmap rt_corners[MAX_MONITOR];
static chunked_bitmap lb_corners[MAX_MONITOR];
static chunked_bitmap rb_corners[MAX_MONITOR];
static bool has_corners[MAX_MONITOR];
// Screen variables
int TCWorking_screen;
static int TCWorking_screen;
// Static variables
#define STATIC_BMPS 12
int StaticBmps[STATIC_BMPS];
bool Telcom_show_static = false;
bool Telcom_static_last_frame = false;
float Telcom_static_setting = 0;
static int StaticBmps[STATIC_BMPS];
static bool Telcom_show_static = false;
static bool Telcom_static_last_frame = false;
static float Telcom_static_setting = 0;
// Glitch variables
bool Telcom_show_glitch = false;
bool Telcom_glitch_screen = false;
float Telcom_glitch_setting = 0;
extern int glitch_dx, glitch_dy;
float myrand(float max);
static bool Telcom_show_glitch = false;
static bool Telcom_glitch_screen = false;
static float Telcom_glitch_setting = 0;
static float myrand(float max);
// Powereffect variables
int PowerBmps[2];
static int PowerBmps[2];
// Initializes the Telcom rendering engine
void TelcomRenderInit(void) {
@ -2388,10 +2389,8 @@ tcpe_adjust:
***************************************************
*/
extern tceffect TCEffects[MAX_TCEFFECTS];
extern int Screen_roots[MAX_TELCOM_SCREENS];
// returns the true if there is a next screen (from the current)
bool TelComIsThereANextScreen(void);
static bool TelComIsThereANextScreen(void);
/*
* Initializes the TelCom Event manager system

View File

@ -64,6 +64,8 @@ $$TABLE_GAMEFILE "TelComOn.OGF"
*/
extern chunked_bitmap Telcom_bitmap;
extern int TC_cursor;
extern float last_frametime;
/*
// Note for above: In TelCom.h there is a section of defines which give names to the above files

View File

@ -179,24 +179,24 @@
#include "hlsoundlib.h"
// Variables needed for automap
vector AM_view_pos = {0, 0, 0};
matrix AM_view_orient;
tTelComInfo *AM_tcs;
int AM_ship_model_handle = -1;
static vector AM_view_pos = {0, 0, 0};
static matrix AM_view_orient;
static tTelComInfo *AM_tcs;
static int AM_ship_model_handle = -1;
ubyte AutomapVisMap[MAX_ROOMS];
float AM_heading;
float AM_pitch;
static float AM_heading;
static float AM_pitch;
int AM_terrain = 0, AM_realign = 0, AM_center_on_player = 0, AM_current_marker;
int Num_AM_rooms;
ushort AM_room_list[MAX_ROOMS];
ubyte AM_rooms_seen[MAX_ROOMS];
g3Point *AM_rotated_points = NULL; //[MAX_VERTS_PER_ROOM];
static int Num_AM_rooms;
static ushort AM_room_list[MAX_ROOMS];
static ubyte AM_rooms_seen[MAX_ROOMS];
static g3Point *AM_rotated_points = NULL; //[MAX_VERTS_PER_ROOM];
void TCAMCallback(void);
static void TCAMCallback(void);
static ubyte *Small_faces[MAX_ROOMS];
@ -568,7 +568,6 @@ void TCAMRenderRoom(int roomnum) {
#define AM_ROTATIONAL_SCALAR 90
// Reads the controls for the automap, and adjusts viewpoint accordingly
extern float last_frametime;
void TCAMReadControls() {
Frametime = last_frametime;
int save_mode = Game_interface_mode;

View File

@ -134,7 +134,7 @@ tLineInfo StatusLines[] = {
#define NUM_LINES (sizeof(StatusLines) / sizeof(tLineInfo))
#define TITLE_X 30 + TCminx
#define VALUE_X 400 + TCminx
int TCminx, TCmaxx, TCminy, TCmaxy;
static int TCminx, TCmaxx, TCminy, TCmaxy;
#define SM_FONT BRIEFING_FONT
#define BG_FONT BIG_BRIEFING_FONT

View File

@ -146,7 +146,7 @@
tceffect TCEffects[MAX_TCEFFECTS];
int Screen_roots[MAX_TELCOM_SCREENS];
bool Screen_has_effect_with_focus[MAX_TELCOM_SCREENS];
static bool Screen_has_effect_with_focus[MAX_TELCOM_SCREENS];
// Initializes the effects
void EfxInit(void) {

View File

@ -283,6 +283,9 @@ typedef struct {
extern int glitch_dx, glitch_dy;
extern tceffect TCEffects[MAX_TCEFFECTS];
extern int Screen_roots[MAX_TELCOM_SCREENS];
/////////////////////////////////////////////////
// Prototypes

View File

@ -122,19 +122,18 @@ typedef struct {
int goal_index;
int lx, rx, ty, by; // bounding box
} tGoalLineInfo;
tGoalLineInfo *TG_Lines;
int TG_NumLines;
int *TG_SortedList;
int TG_CurrObjectiveArrow;
static tGoalLineInfo *TG_Lines;
static int TG_NumLines;
static int *TG_SortedList;
static int TG_CurrObjectiveArrow;
typedef struct {
int w, h;
} tToolTipData;
tToolTipData TG_TT_dest;
tToolTipData TG_TT_curr;
chunked_bitmap TG_Tooltipbitmap;
int TG_MouseOffset_x = -1, TG_MouseOffset_y = -1;
extern int TC_cursor;
static tToolTipData TG_TT_dest;
static tToolTipData TG_TT_curr;
static chunked_bitmap TG_Tooltipbitmap;
static int TG_MouseOffset_x = -1, TG_MouseOffset_y = -1;
// returns true if left < right
bool TG_compare_slots(int left, int right) {
int left_index, right_index;
@ -297,7 +296,6 @@ int FindHighlightedItem(int x, int y) {
#define COLOR_INCOMPLETE GR_RGB(255, 40, 40)
#define COLOR_FAILED GR_RGB(255, 255, 40)
extern float last_frametime;
void TCGoalsRenderCallback(void) {
static bool active_alpha_in = false;
static float active_alpha = ACTIVE_ALPHA_MAX;

View File

@ -57,8 +57,6 @@
#include <stdlib.h>
int glitch_dx = 0, glitch_dy = 0;
extern tceffect TCEffects[MAX_TCEFFECTS];
extern int Screen_roots[MAX_TELCOM_SCREENS];
#define DISABLED_TEXT_COLOR GR_RGB(180, 180, 180);
int GetTextEffectWithTabStopsOnScreen(int screen) {
int count = 0;

View File

@ -231,44 +231,43 @@
#include "dedicated_server.h"
int EvaluateBlock(int x, int z, int lod);
static int EvaluateBlock(int x, int z, int lod);
ushort TS_FrameCount = 0xFFFF;
int SearchQuadTree(int x1, int y1, int x2, int y2, int dir, int *ccount);
static int SearchQuadTree(int x1, int y1, int x2, int y2, int dir, int *ccount);
int GlobalTransCount = 0;
int TotalDepth;
// LOD shutoff stuff
#define MAX_LODOFFS 100
lodoff LODOffs[MAX_LODOFFS];
int Num_lodoffs = 0;
static lodoff LODOffs[MAX_LODOFFS];
static int Num_lodoffs = 0;
// Render the terrain as flat?
ubyte Flat_terrain = 0;
// Variables for LOD engine
float ViewDistance1 = .68f, ViewDistance2 = 1.0f;
float TS_Lambda, TS_SimplifyCondition;
static float ViewDistance1 = .68f, ViewDistance2 = 1.0f;
static float TS_Lambda, TS_SimplifyCondition;
matrix *TS_View_matrix;
vector *TS_View_position;
static matrix *TS_View_matrix;
static vector *TS_View_position;
vector TS_PreRows[TERRAIN_DEPTH];
vector TS_FVectorAdd, TS_RVectorAdd;
static vector TS_PreRows[TERRAIN_DEPTH];
static vector TS_FVectorAdd, TS_RVectorAdd;
ubyte Terrain_y_flags[256];
vector Terrain_y_cache[256];
static ubyte Terrain_y_flags[256];
static vector Terrain_y_cache[256];
ushort LOD_sort_bucket[MAX_TERRAIN_LOD][MAX_CELLS_TO_RENDER];
ushort LOD_sort_num[MAX_TERRAIN_LOD];
static ushort LOD_sort_bucket[MAX_TERRAIN_LOD][MAX_CELLS_TO_RENDER];
static ushort LOD_sort_num[MAX_TERRAIN_LOD];
// Variable to determine if we're in editor or game
extern function_mode View_mode;
extern ubyte Terrain_from_mine;
vector TJoint_VectorAddZ;
vector TJoint_VectorAddX;
static vector TJoint_VectorAddZ;
static vector TJoint_VectorAddX;
// Since our terrain points increment in finite steps we can rotate 2 points (x,z)
// just add them to a base point to get the final rotated point
@ -294,7 +293,7 @@ void PreRotateTerrain() {
}
}
inline vector *GetDYVector(int h) {
static inline vector *GetDYVector(int h) {
vector *dyp;
dyp = &Terrain_y_cache[h];
@ -310,7 +309,7 @@ inline vector *GetDYVector(int h) {
return dyp;
}
inline void GetPreRotatedPointFast(vector *dest, int x, int z, int yvalue) {
static inline void GetPreRotatedPointFast(vector *dest, int x, int z, int yvalue) {
ASSERT(yvalue >= 0 && yvalue <= 255);
// If the terrain is supposed to be flat, bash this to zero

View File

@ -945,7 +945,7 @@
#include <algorithm>
bool AreObjectsAttached(const object *obj1, const object *obj2) {
static bool AreObjectsAttached(const object *obj1, const object *obj2) {
const bool f_o1_a = (obj1->flags & OF_ATTACHED) != 0;
const bool f_o2_a = (obj2->flags & OF_ATTACHED) != 0;
@ -1054,8 +1054,7 @@ bool ObjectsAreRelated(int o1, int o2) {
if (obj1->parent_handle == obj2->parent_handle) {
if ((obj1->mtype.phys_info.flags & PF_HITS_SIBLINGS) || (obj2->mtype.phys_info.flags & PF_HITS_SIBLINGS)) {
return false; // if either is proximity, then can blow up, so say not related
}
else {
} else {
return true;
}
}
@ -3067,9 +3066,6 @@ void FireFlareFromPlayer(object *objp) {
}
}
// Creates a gravity field that sucks objects into it
int CreateGravityField(vector *pos, int roomnum, float size, float time, int parent_handle);
// Plays the animation that accompanies a weapon death
void DoWeaponExploded(object *obj, vector *norm, vector *collision_point, object *hit_object) {
weapon *w = &Weapons[obj->id];

View File

@ -37,7 +37,7 @@ ai_dynamic_path AIDynamicPath[MAX_DYNAMIC_PATHS];
int AIAltPath[MAX_ROOMS];
int AIAltPathNumNodes;
void AIUpdatePathInfo(q_item **node_list, int start, int end) {
static void AIUpdatePathInfo(q_item **node_list, int start, int end) {
int cur_room = end;
int i;
@ -205,7 +205,7 @@ done:
return f_found;
}
bool AIPathGetCurrentNodePos(ai_path_info *aip, vector *pos, int *room = NULL) {
bool AIPathGetCurrentNodePos(ai_path_info *aip, vector *pos, int *room) {
int c_path = aip->cur_path;
int c_node = aip->cur_node;
@ -236,7 +236,7 @@ bool AIPathGetCurrentNodePos(ai_path_info *aip, vector *pos, int *room = NULL) {
}
// Chrishack -- need to add static path flag stuff
bool AIPathMoveToNextNode(ai_path_info *aip) {
static bool AIPathMoveToNextNode(ai_path_info *aip) {
int c_path = aip->cur_path;
int c_node = aip->cur_node;
@ -277,7 +277,7 @@ bool AIPathAtEnd(ai_path_info *aip) {
return false;
}
void AIPathSetAtEnd(ai_path_info *aip) {
static void AIPathSetAtEnd(ai_path_info *aip) {
aip->cur_path = aip->num_paths - 1;
aip->cur_node = aip->path_end_node[aip->num_paths - 1];
}
@ -287,7 +287,7 @@ void AIPathSetAtStart(ai_path_info *aip) {
aip->cur_node = aip->path_start_node[0];
}
bool AIPathMoveToPrevNode(ai_path_info *aip) {
static bool AIPathMoveToPrevNode(ai_path_info *aip) {
int c_path = aip->cur_path;
int c_node = aip->cur_node;
@ -315,7 +315,7 @@ bool AIPathMoveToPrevNode(ai_path_info *aip) {
return false;
}
bool AIPathGetNextNodePos(ai_path_info *aip, vector *pos, int *room = NULL) {
bool AIPathGetNextNodePos(ai_path_info *aip, vector *pos, int *room) {
if (AIPathMoveToNextNode(aip)) {
AIPathGetCurrentNodePos(aip, pos, room);
AIPathMoveToPrevNode(aip);
@ -326,7 +326,7 @@ bool AIPathGetNextNodePos(ai_path_info *aip, vector *pos, int *room = NULL) {
return false;
}
bool AIPathGetPrevNodePos(ai_path_info *aip, vector *pos, int *room = NULL) {
bool AIPathGetPrevNodePos(ai_path_info *aip, vector *pos, int *room) {
if (AIPathMoveToPrevNode(aip)) {
AIPathGetCurrentNodePos(aip, pos, room);
AIPathMoveToNextNode(aip);
@ -337,7 +337,7 @@ bool AIPathGetPrevNodePos(ai_path_info *aip, vector *pos, int *room = NULL) {
return false;
}
void AIPathComplete(object *obj) { GoalPathComplete(obj); }
static void AIPathComplete(object *obj) { GoalPathComplete(obj); }
void AIPathMoveTurnTowardsNode(object *obj, vector *mdir, bool *f_moved) {
ai_path_info *aip = &obj->ai_info->path;
@ -535,7 +535,7 @@ pass_node:
}
}
bool AIPathFreeDPathSlot(int slot) {
static bool AIPathFreeDPathSlot(int slot) {
ASSERT(AIDynamicPath[slot].use_count >= 0);
ASSERT(slot >= 0 && slot < MAX_DYNAMIC_PATHS && AIDynamicPath[slot].use_count != 0);
@ -549,7 +549,7 @@ bool AIPathFreeDPathSlot(int slot) {
return true;
}
bool AIPathGetDPathSlot(int *slot, int handle) {
static bool AIPathGetDPathSlot(int *slot, int handle) {
int i;
for (i = 0; i < MAX_DYNAMIC_PATHS; i++) {
@ -600,7 +600,7 @@ bool AIPathFreePath(ai_path_info *aip) {
return true;
}
bool AIPathAddDPath(ai_path_info *aip, int handle) {
static bool AIPathAddDPath(ai_path_info *aip, int handle) {
int slot;
bool status;
@ -626,7 +626,7 @@ bool AIPathAddDPath(ai_path_info *aip, int handle) {
return status;
}
bool AIPathAddStaticPath(ai_path_info *aip, int path_id, int start_index, int end_index) {
static bool AIPathAddStaticPath(ai_path_info *aip, int path_id, int start_index, int end_index) {
// chrishack -- validation code is needed
if (aip->num_paths >= MAX_JOINED_PATHS) {
@ -644,7 +644,7 @@ bool AIPathAddStaticPath(ai_path_info *aip, int path_id, int start_index, int en
return true;
}
inline bool AIPathAddDPathNode(ai_path_info *aip, int *slot, int *cur_node, vector *pos, int room, int handle) {
static inline bool AIPathAddDPathNode(ai_path_info *aip, int *slot, int *cur_node, vector *pos, int room, int handle) {
int status;
if (*cur_node == MAX_NODES) {
@ -665,8 +665,8 @@ inline bool AIPathAddDPathNode(ai_path_info *aip, int *slot, int *cur_node, vect
return true;
}
bool AIGenerateAltBNodePath(object *obj, vector *start_pos, int *start_room, vector *end_pos, int *end_room,
ai_path_info *aip, int *slot, int *cur_node, int handle) {
static bool AIGenerateAltBNodePath(object *obj, vector *start_pos, int *start_room, vector *end_pos, int *end_room,
ai_path_info *aip, int *slot, int *cur_node, int handle) {
int x;
vector *pos;
bool f_path_exists = true;
@ -773,7 +773,8 @@ done:
return f_path_exists;
}
void AIGenerateAltBOAPath(vector *start_pos, vector *end_pos, ai_path_info *aip, int *slot, int *cur_node, int handle) {
static void AIGenerateAltBOAPath(vector *start_pos, vector *end_pos, ai_path_info *aip, int *slot, int *cur_node,
int handle) {
int x;
vector *pos = NULL;
@ -823,8 +824,8 @@ void AIGenerateAltBOAPath(vector *start_pos, vector *end_pos, ai_path_info *aip,
// next_room = *end_room;
// }
bool AIGenerateBNodePath(object *obj, vector *start_pos, int *start_room, vector *end_pos, int *end_room,
ai_path_info *aip, int *slot, int *cur_node, int handle) {
static bool AIGenerateBNodePath(object *obj, vector *start_pos, int *start_room, vector *end_pos, int *end_room,
ai_path_info *aip, int *slot, int *cur_node, int handle) {
int next_room = BOA_INDEX(*start_room);
bool f_path_exists = true;
vector *pos;
@ -938,8 +939,8 @@ done:
return f_path_exists;
}
bool AIGenerateBOAPath(vector *start_pos, int *start_room, vector *end_pos, int *end_room, ai_path_info *aip, int *slot,
int *cur_node, int handle) {
static bool AIGenerateBOAPath(vector *start_pos, int *start_room, vector *end_pos, int *end_room, ai_path_info *aip,
int *slot, int *cur_node, int handle) {
int next_room = *start_room;
bool f_path_exists = true;
vector *pos;

View File

@ -24,17 +24,23 @@
#include "aistruct.h"
// Exported functions
void AIPathMoveTurnTowardsNode(object *obj, vector *mdir, bool *f_moved);
extern void AIPathMoveTurnTowardsNode(object *obj, vector *mdir, bool *f_moved);
// void AIPathMoveTowardsRoom(object *obj, int room_index);
bool AIPathSetAsStaticPath(object *obj, void *goal_ptr, int path_id, int start_node, int end_node, int cur_node);
bool AIPathAllocPath(object *obj, ai_frame *ai_info, void *goal_ptr, int *start_room, vector *start_pos, int *end_room,
vector *end_pos, float rad, int flags, int handle, int ignore_obj = -1);
bool AIPathInitPath(ai_path_info *aip);
bool AIPathFreePath(ai_path_info *aip);
bool AIFindAltPath(object *obj, int i, int j, float *dist = NULL);
extern bool AIPathSetAsStaticPath(object *obj, void *goal_ptr, int path_id, int start_node, int end_node, int cur_node);
extern bool AIPathAllocPath(object *obj, ai_frame *ai_info, void *goal_ptr, int *start_room, vector *start_pos,
int *end_room, vector *end_pos, float rad, int flags, int handle, int ignore_obj = -1);
extern bool AIPathInitPath(ai_path_info *aip);
extern bool AIPathFreePath(ai_path_info *aip);
extern bool AIFindAltPath(object *obj, int i, int j, float *dist = NULL);
extern bool AIPathAtEnd(ai_path_info *aip);
extern bool AIPathAtStart(ai_path_info *aip);
extern bool AIPathGetNextNodePos(ai_path_info *aip, vector *pos, int *room = NULL);
extern bool AIPathGetPrevNodePos(ai_path_info *aip, vector *pos, int *room = NULL);
extern bool AIPathGetCurrentNodePos(ai_path_info *aip, vector *pos, int *room = NULL);
#ifdef _DEBUG
bool MakeTestPath(int *start_room, vector *pos);
extern bool MakeTestPath(int *start_room, vector *pos);
extern int AIPath_test_end_room;
extern vector AIPath_test_end_pos;

View File

@ -57,15 +57,15 @@
#define AI_MAX_SEGS_CHECKED 200
int ai_num_segs_checked = 0;
ubyte ai_terrain_check_list[((TERRAIN_WIDTH * TERRAIN_DEPTH) >> 3) + 1];
int ai_segs_checked[AI_MAX_SEGS_CHECKED];
static int ai_num_segs_checked = 0;
static ubyte ai_terrain_check_list[((TERRAIN_WIDTH * TERRAIN_DEPTH) >> 3) + 1];
static int ai_segs_checked[AI_MAX_SEGS_CHECKED];
#ifdef _DEBUG
int ai_num_checks_since_init = 0;
static int ai_num_checks_since_init = 0;
#endif
float ai_rad;
ground_information *ai_ground_info_ptr;
static float ai_rad;
static ground_information *ai_ground_info_ptr;
void ait_Init() {
ai_num_segs_checked = 0;
@ -76,7 +76,7 @@ void ait_Init() {
#endif
}
void ait_terrain_clean() {
static void ait_terrain_clean() {
int i;
assert(ai_num_segs_checked >= 0 && ai_num_segs_checked <= AI_MAX_SEGS_CHECKED);
@ -96,7 +96,7 @@ void ait_terrain_clean() {
ai_num_segs_checked = 0;
}
void ai_check_terrain_node(int cur_node, int f_check_local_nodes) {
static void ai_check_terrain_node(int cur_node, int f_check_local_nodes) {
int check_x, check_y;
int new_node;
int xcounter, ycounter;

View File

@ -90,10 +90,10 @@ int Num_ambient_sound_patterns = 0;
// Computes a floating-point pseudo-random number.
// Returns value in the range 0..1, with the precision 1/RAND_MAX
float randf() { return ((float)ps_rand()) / ((float)RAND_MAX); }
static float randf() { return ((float)ps_rand()) / ((float)RAND_MAX); }
// Process an Ambient Sound Pattern
void ProcessASP(asp *asp) {
static void ProcessASP(asp *asp) {
// Check for empty ASP
if (!asp->num_sounds)
return;
@ -161,7 +161,7 @@ void InitAmbientSounds() {
#include "mem.h"
// Close down ambient sound system and free data
void FreeAmbientSoundData() {
static void FreeAmbientSoundData() {
for (int p = 0; p < Num_ambient_sound_patterns; p++)
if (Ambient_sound_patterns[p].num_sounds)
mem_free(Ambient_sound_patterns[p].sounds);

View File

@ -25,7 +25,7 @@
#endif
// rcg07062000 used to be static.
int TotalArgs = 0;
static int TotalArgs = 0;
char GameArgs[MAX_ARGS][MAX_CHARS_PER_ARG];
const char *GetArg(int index) {

View File

@ -142,8 +142,8 @@ PI); rot_angle = acos(dot);
// Finds the position of a attach point on an object
// The uvec is optional as most attaching objects don't need at complete orientation set (only an fvec)
bool AttachPointPos(object *obj, char ap, bool f_compute_pos, vector *attach_pos, bool f_compute_fvec,
vector *attach_fvec, bool *f_computed_uvec = NULL, vector *attach_uvec = NULL) {
static bool AttachPointPos(object *obj, char ap, bool f_compute_pos, vector *attach_pos, bool f_compute_fvec,
vector *attach_fvec, bool *f_computed_uvec = NULL, vector *attach_uvec = NULL) {
poly_model *pm;
vector pnt;
vector normal;
@ -227,7 +227,7 @@ bool AttachPointPos(object *obj, char ap, bool f_compute_pos, vector *attach_pos
return true;
}
void ConvertAxisAmountMatrix(vector *n, float w, matrix *rotmat) {
static void ConvertAxisAmountMatrix(vector *n, float w, matrix *rotmat) {
float s;
float c;
float t;
@ -399,7 +399,7 @@ bool AttachDoPosOrient(object *parent, char parent_ap, object *child, char child
}
// Adds and subtracts from mass from connections and disconnections
void AttachPropagateMass(object *child, bool f_attach = true) {
static void AttachPropagateMass(object *child, bool f_attach = true) {
object *new_parent;
if (!child)
@ -436,7 +436,7 @@ void AttachPropagateMass(object *child, bool f_attach = true) {
} while (child->flags & OF_ATTACHED);
}
inline void ComputeUltimateAttachParent(object *child) {
static inline void ComputeUltimateAttachParent(object *child) {
object *cur_obj = child;
do {
@ -447,7 +447,7 @@ inline void ComputeUltimateAttachParent(object *child) {
} while (cur_obj->flags & OF_ATTACHED);
}
void ProprogateUltimateAttachParent(object *parent, int ultimate_handle) {
static void ProprogateUltimateAttachParent(object *parent, int ultimate_handle) {
int i;
ASSERT(parent);
@ -700,4 +700,4 @@ bool UnattachChildren(object *parent) {
}
return true;
}
}

View File

@ -59,11 +59,11 @@ typedef struct {
// 8: invalid samples
// 9: invalid bit (8 or 16)
// 10: no data
char taunt_LoadWaveFile(char *filename, tWaveFile *wave);
static char taunt_LoadWaveFile(char *filename, tWaveFile *wave);
int TauntLastError = TAUNTIMPERR_NOERROR;
static int TauntLastError = TAUNTIMPERR_NOERROR;
bool Audio_taunts_enabled = true;
float Audio_taunt_delay_time = 5.0f;
static float Audio_taunt_delay_time = 5.0f;
// taunt_Enable
//

View File

@ -172,14 +172,14 @@ public:
}
};
float BNode_QuickDist(vector *pos1, vector *pos2) {
static float BNode_QuickDist(vector *pos1, vector *pos2) {
return fabs(pos1->x - pos2->x) + fabs(pos1->y - pos2->y) + fabs(pos1->z - pos2->z);
}
int BNode_Path[MAX_BNODES_PER_ROOM];
int BNode_PathNumNodes;
void BNode_UpdatePathInfo(pq_item **node_list, int start, int end) {
static void BNode_UpdatePathInfo(pq_item **node_list, int start, int end) {
int cur_node = end;
int i;
@ -287,12 +287,13 @@ done:
return f_found;
}
// TODO: MTS: Unused?
int BNode_GenerateBestPathThroughRoom(int sroom, int spnt, int croom, int eroom, int eportal, int max_nodes,
vector *pos_list) {
return -1;
}
char BNode_vis[MAX_BNODES_PER_ROOM];
static char BNode_vis[MAX_BNODES_PER_ROOM];
#define VIS_NO_CHECK 2
#define VIS_OK 1
#define VIS_NO 2
@ -502,6 +503,7 @@ void BNode_ClearBNodeInfo(void) {
BNode_verified = false;
}
// Unused?
bool BNode_MakeSubPath(short sroom, short spnt, short eroom, short epnt, int flags, float size, short *roomlist,
short *pnts, int max_elements) {
return false;
@ -560,4 +562,4 @@ void BNode_RemapTerrainRooms(int old_hri, int new_hri) {
}
}
}
}
}

View File

@ -57,10 +57,11 @@
bsptree MineBSP;
ubyte BSP_initted = 0;
int ConvexSubspaces = 0, ConvexPolys = 0;
int Solids = 0, Empty = 0;
static int ConvexSubspaces = 0, ConvexPolys = 0;
static int Solids = 0, Empty = 0;
int BSPChecksum = -1;
// TODO: MTS: Only used here?
ubyte UseBSP = 0;
// Goes through all the valid points in the indoor engine and returns a unique
@ -1061,7 +1062,7 @@ void BuildSingleBSPTree(int roomnum) {
}
// Returns true if the point is inside the min,max
inline int BSPInMinMax(vector *pos, vector *min_xyz, vector *max_xyz) {
static inline int BSPInMinMax(vector *pos, vector *min_xyz, vector *max_xyz) {
if (pos->x < min_xyz->x || pos->y < min_xyz->y || pos->z < min_xyz->z || pos->x > max_xyz->x || pos->y > max_xyz->y ||
pos->z > max_xyz->z)
return 0;
@ -1072,7 +1073,7 @@ inline int BSPInMinMax(vector *pos, vector *min_xyz, vector *max_xyz) {
extern uint check_point_to_face(vector *colp, vector *face_normal, int nv, vector **vertex_ptr_list);
// Returns true if passed in point collides with a nodes polygon
inline int BSPPointInPolygon(vector *pos, bspnode *node) {
static inline int BSPPointInPolygon(vector *pos, bspnode *node) {
if (node->node_subnum < 0) // Room face
{
room *rp = &Rooms[node->node_roomnum];

View File

@ -89,15 +89,15 @@
#define BUDDYMENU_ITEM_W 226
#define UID_BUDDYCMD 0x100
gb_menu Guidebot_menu_data;
int Guidebot_data_download_status;
static gb_menu Guidebot_menu_data;
static int Guidebot_data_download_status;
// downloads data for the buddybot
// on return: if 1, process data
// if 0, abort
// if -1, no guidebot
int BuddyBotDownloadData(void);
void BuddyProcessCommand(int res);
static int BuddyBotDownloadData(void);
static void BuddyProcessCommand(int res);
void BuddyDisplay(void) {
newuiTiledWindow gbcommand_wnd;
@ -181,7 +181,7 @@ void BuddyDisplay(void) {
gbcommand_wnd.Destroy();
}
void MultiAskforGuidebotMenu() {
static void MultiAskforGuidebotMenu() {
int size_offset;
int count = 0;
ubyte data[MAX_GAME_DATA_SIZE];
@ -196,7 +196,7 @@ void MultiAskforGuidebotMenu() {
nw_SendReliable(NetPlayers[Player_num].reliable_socket, data, count);
}
void MultiStuffGuidebotMenuData(ubyte *data, int *count, gb_menu *menu) {
static void MultiStuffGuidebotMenuData(ubyte *data, int *count, gb_menu *menu) {
int i;
// Get the menu data and stick it here
// length of the title
@ -254,7 +254,7 @@ void MultiSendGuidebotMenuSelection(gb_com *command) {
nw_SendReliable(NetPlayers[Player_num].reliable_socket, data, count);
}
void MultiSendGuidebotMenuText(gb_menu *menu, int slot) {
static void MultiSendGuidebotMenuText(gb_menu *menu, int slot) {
int size_offset;
int count = 0;
@ -272,7 +272,7 @@ void MultiSendGuidebotMenuText(gb_menu *menu, int slot) {
nw_SendReliable(NetPlayers[slot].reliable_socket, data, count, false);
}
void MultiReadGuidebotMenuData(ubyte *data, int *count, gb_menu *menu) {
static void MultiReadGuidebotMenuData(ubyte *data, int *count, gb_menu *menu) {
int i;
// Get the menu data and stick it here

View File

@ -20,5 +20,7 @@
#define __BUDDYMENU_H_
void BuddyDisplay(void);
struct gb_com;
extern void MultiSendGuidebotMenuSelection(gb_com *);
#endif

View File

@ -42,7 +42,7 @@ static struct {
static bool Cinematic_lib_init = false;
static int Cinematic_x = 0, Cinematic_y = 0, Cinematic_w = 0, Cinematic_h = 0;
void CinematicCallback(int mve_x, int mve_y, int frame_num);
static void CinematicCallback(int mve_x, int mve_y, int frame_num);
///////////////////////////////////////////////////////////////////////////////
// functions

View File

@ -241,14 +241,13 @@ typedef struct tCockpitInfo {
matrix orient; // orientation of cockpit
} tCockpitInfo;
static tCockpitInfo Cockpit_info;
float KeyframeAnimateCockpit();
static float KeyframeAnimateCockpit();
// loads cockpit. model_name = NULL, then will not load in model name.
void LoadCockpitInfo(const char *ckt_file, tCockpitCfgInfo *info);
static void LoadCockpitInfo(const char *ckt_file, tCockpitCfgInfo *info);
//////////////////////////////////////////////////////////////////////////////
// Initializes the cockpit by loading it in and initializing all it's gauges.
// initialization of cockpit.
void InitCockpit(int ship_index) {
extern void FreeReticle();
tCockpitCfgInfo cfginfo;
int i;
mprintf((0, "Initializing cockpit.\n"));

View File

@ -425,26 +425,26 @@ tGameToggles Game_toggles = { // toggles specified in general settings.
#define MINIMUM_RENDER_DIST 80
#define MAXIMUM_RENDER_DIST 200
tDetailSettings DetailPresetLow = {DL_LOW_TERRAIN_DISTANCE, DL_LOW_PIXEL_ERROR, DL_LOW_SPECULAR_LIGHT,
DL_LOW_DYNAMIC_LIGHTING, DL_LOW_FAST_HEADLIGHT, DL_LOW_MIRRORED_SURFACES,
DL_LOW_FOG_ENABLED, DL_LOW_CORONAS_ENABLES, DL_LOW_PROCEDURALS,
DL_LOW_POWERUP_HALOS, DL_LOW_SCORCH_MARKS, DL_LOW_WEAPON_CORONAS,
DL_LOW_SPEC_MAPPING_TYPE, DL_LOW_OBJECT_COMPLEXITY};
tDetailSettings DetailPresetMed = {DL_MED_TERRAIN_DISTANCE, DL_MED_PIXEL_ERROR, DL_MED_SPECULAR_LIGHT,
DL_MED_DYNAMIC_LIGHTING, DL_MED_FAST_HEADLIGHT, DL_MED_MIRRORED_SURFACES,
DL_MED_FOG_ENABLED, DL_MED_CORONAS_ENABLES, DL_MED_PROCEDURALS,
DL_MED_POWERUP_HALOS, DL_MED_SCORCH_MARKS, DL_MED_WEAPON_CORONAS,
DL_MED_SPEC_MAPPING_TYPE, DL_MED_OBJECT_COMPLEXITY};
tDetailSettings DetailPresetHigh = {DL_HIGH_TERRAIN_DISTANCE, DL_HIGH_PIXEL_ERROR, DL_HIGH_SPECULAR_LIGHT,
DL_HIGH_DYNAMIC_LIGHTING, DL_HIGH_FAST_HEADLIGHT, DL_HIGH_MIRRORED_SURFACES,
DL_HIGH_FOG_ENABLED, DL_HIGH_CORONAS_ENABLES, DL_HIGH_PROCEDURALS,
DL_HIGH_POWERUP_HALOS, DL_HIGH_SCORCH_MARKS, DL_HIGH_WEAPON_CORONAS,
DL_HIGH_SPEC_MAPPING_TYPE, DL_HIGH_OBJECT_COMPLEXITY};
tDetailSettings DetailPresetVHi = {DL_VHI_TERRAIN_DISTANCE, DL_VHI_PIXEL_ERROR, DL_VHI_SPECULAR_LIGHT,
DL_VHI_DYNAMIC_LIGHTING, DL_VHI_FAST_HEADLIGHT, DL_VHI_MIRRORED_SURFACES,
DL_VHI_FOG_ENABLED, DL_VHI_CORONAS_ENABLES, DL_VHI_PROCEDURALS,
DL_VHI_POWERUP_HALOS, DL_VHI_SCORCH_MARKS, DL_VHI_WEAPON_CORONAS,
DL_VHI_SPEC_MAPPING_TYPE, DL_VHI_OBJECT_COMPLEXITY};
static const tDetailSettings DetailPresetLow = {
DL_LOW_TERRAIN_DISTANCE, DL_LOW_PIXEL_ERROR, DL_LOW_SPECULAR_LIGHT, DL_LOW_DYNAMIC_LIGHTING,
DL_LOW_FAST_HEADLIGHT, DL_LOW_MIRRORED_SURFACES, DL_LOW_FOG_ENABLED, DL_LOW_CORONAS_ENABLES,
DL_LOW_PROCEDURALS, DL_LOW_POWERUP_HALOS, DL_LOW_SCORCH_MARKS, DL_LOW_WEAPON_CORONAS,
DL_LOW_SPEC_MAPPING_TYPE, DL_LOW_OBJECT_COMPLEXITY};
static const tDetailSettings DetailPresetMed = {
DL_MED_TERRAIN_DISTANCE, DL_MED_PIXEL_ERROR, DL_MED_SPECULAR_LIGHT, DL_MED_DYNAMIC_LIGHTING,
DL_MED_FAST_HEADLIGHT, DL_MED_MIRRORED_SURFACES, DL_MED_FOG_ENABLED, DL_MED_CORONAS_ENABLES,
DL_MED_PROCEDURALS, DL_MED_POWERUP_HALOS, DL_MED_SCORCH_MARKS, DL_MED_WEAPON_CORONAS,
DL_MED_SPEC_MAPPING_TYPE, DL_MED_OBJECT_COMPLEXITY};
static const tDetailSettings DetailPresetHigh = {
DL_HIGH_TERRAIN_DISTANCE, DL_HIGH_PIXEL_ERROR, DL_HIGH_SPECULAR_LIGHT, DL_HIGH_DYNAMIC_LIGHTING,
DL_HIGH_FAST_HEADLIGHT, DL_HIGH_MIRRORED_SURFACES, DL_HIGH_FOG_ENABLED, DL_HIGH_CORONAS_ENABLES,
DL_HIGH_PROCEDURALS, DL_HIGH_POWERUP_HALOS, DL_HIGH_SCORCH_MARKS, DL_HIGH_WEAPON_CORONAS,
DL_HIGH_SPEC_MAPPING_TYPE, DL_HIGH_OBJECT_COMPLEXITY};
static const tDetailSettings DetailPresetVHi = {
DL_VHI_TERRAIN_DISTANCE, DL_VHI_PIXEL_ERROR, DL_VHI_SPECULAR_LIGHT, DL_VHI_DYNAMIC_LIGHTING,
DL_VHI_FAST_HEADLIGHT, DL_VHI_MIRRORED_SURFACES, DL_VHI_FOG_ENABLED, DL_VHI_CORONAS_ENABLES,
DL_VHI_PROCEDURALS, DL_VHI_POWERUP_HALOS, DL_VHI_SCORCH_MARKS, DL_VHI_WEAPON_CORONAS,
DL_VHI_SPEC_MAPPING_TYPE, DL_VHI_OBJECT_COMPLEXITY};
void ConfigSetDetailLevel(int level) {
switch (level) {
@ -483,7 +483,7 @@ void ConfigSetDetailLevel(int level) {
#define IDV_AUTOGAMMA 6
void gamma_callback(newuiTiledWindow *wnd, void *data) {
static void gamma_callback(newuiTiledWindow *wnd, void *data) {
int bm_handle = *((int *)data);
g3Point pnts[4], *pntlist[4];
@ -552,7 +552,7 @@ void gamma_callback(newuiTiledWindow *wnd, void *data) {
rend_SetZBufferState(1);
}
void config_gamma() {
static void config_gamma() {
newuiTiledWindow gamma_wnd;
newuiSheet *sheet;
tSliderSettings slider_set;
@ -1357,8 +1357,7 @@ void details_menu::set_preset_details(int setting) {
// new Options menu
//
// externed from init.cpp
extern void SaveGameSettings();
#include "init.h"
void OptionsMenu() {
newuiMenu menu;

View File

@ -123,17 +123,17 @@ typedef struct creditline {
float displaytime;
} creditline;
void Credits_Render(creditline *, float);
creditline Creditlines;
static void Credits_Render(creditline *, float);
static creditline Creditlines;
ddgr_color CreditTextColor, CreditHeadingColor;
int CreditStartX, CreditStartY, CreditEndX, CreditEndY;
float CreditDisplayTime;
chunked_bitmap Credits_bm;
static ddgr_color CreditTextColor, CreditHeadingColor;
static int CreditStartX, CreditStartY, CreditEndX, CreditEndY;
static float CreditDisplayTime;
static chunked_bitmap Credits_bm;
#define MAX_CREDIT_LEN 200
bool Credits_IsKeyPressed(void) {
static bool Credits_IsKeyPressed(void) {
if (ddio_KeyInKey())
return true;
@ -142,7 +142,7 @@ bool Credits_IsKeyPressed(void) {
// Parses a credit line
// Returns 1 if new text was read, else 0
int Credits_ParseLine(char *line, creditline *credit) {
static int Credits_ParseLine(char *line, creditline *credit) {
int line_len = strlen(line);
int new_text = 0;
@ -239,7 +239,7 @@ int Credits_ParseLine(char *line, creditline *credit) {
}
// Given a filename, attempts to load that filename as credit text
bool Credits_LoadCredits(const char *filename) {
static bool Credits_LoadCredits(const char *filename) {
CFILE *infile;
char curline[MAX_CREDIT_LEN];
@ -306,7 +306,7 @@ bool Credits_LoadCredits(const char *filename) {
return true;
}
void ShowStaticScreen(char *bitmap_filename, bool timed = false, float delay_time = 0.0f);
extern void ShowStaticScreen(char *bitmap_filename, bool timed = false, float delay_time = 0.0f);
#define CREDIT_PIXELS_PER_SECOND 22

View File

@ -403,10 +403,10 @@ t_cfg_element Cfg_joy_elements[] = {{-1, CtlText_WeaponGroup, CCITEM_WPN_X2, CCI
{ctfBANK_RIGHTBUTTON, CtlText_BankRight, 0, 0}};
#define N_JOY_CFG_FN (sizeof(Cfg_joy_elements) / sizeof(t_cfg_element))
#define N_KEY_CFG_FN (sizeof(Cfg_key_elements) / sizeof(t_cfg_element))
void ctl_cfg_set_and_verify_changes(short fnid, ct_type elem_type, ubyte controller, ubyte elem, sbyte slot);
void ctl_cfg_element_options_dialog(short fnid);
static void ctl_cfg_set_and_verify_changes(short fnid, ct_type elem_type, ubyte controller, ubyte elem, sbyte slot);
static void ctl_cfg_element_options_dialog(short fnid);
// used for adjusting settings.
int weapon_select_dialog(int wpn, bool is_secondary);
static int weapon_select_dialog(int wpn, bool is_secondary);
#define UID_KEYCFG_ID 0x1000
#define UID_JOYCFG_ID 0x1100
#define UID_PRIMARY_WPN 0x1200
@ -966,7 +966,6 @@ void ctl_cfg_set_and_verify_changes(short fnid, ct_type elem_type, ubyte ctrl, u
Controller->set_controller_function(fnid, ctype_fn, ccfgdata_fn, cfgflags_fn);
}
// used as a help/options dialog for each controller config element
extern const char *cfg_binding_text(ct_type ctype, ubyte ctrl, ubyte binding);
void ctl_cfg_element_options_dialog(short fnid) {
newuiTiledWindow wnd;
newuiSheet *sheet;

View File

@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
@ -95,7 +95,7 @@
static char name_copy[DESC_ID_LEN];
unsigned int d3_serialnum = 100000;
static unsigned int d3_serialnum = 100000;
// checks the exectuable (serialization)
int SerialCheck(void) {

View File

@ -590,6 +590,17 @@
#include <algorithm>
static void SetDeformDamageEffect(object *obj);
static void ApplyFreezeDamageEffect(object *obj);
static void DecreasePlayerShields(int slot, float damage);
static void DoEDrainEffect(int eventnum, void *data);
static void PlayPlayerDamageSound(object *playerobj, int damage_type);
static void GenerateDefaultDeath(object *obj, int *death_flags, float *delay_time);
static void PlayPlayerInvulnerabilitySound(object *playerobj);
static void SetFlyingPhysics(object *objp, bool tumbles);
static float GetDeathAnimTime(object *objp);
static void SetFallingPhysics(object *objp);
// Shake variables
static matrix Old_player_orient;
float Shake_magnitude = 0.0;
@ -1467,9 +1478,7 @@ void ShakePlayer() {
void UnshakePlayer() { ObjSetOrient(Player_object, &Old_player_orient); }
#include "terrain.h"
void ComputeCenterPointOnFace(vector *vp, room *rp, int facenum);
void FindHitpointUV(float *u, float *v, vector *point, room *rp, int facenum);
#include "collide.h"
#define SHARD_MAX_EDGE_LEN 3.0f

View File

@ -151,6 +151,8 @@ void ShakePlayer();
// Restores the player orientation matrix after shaking
void UnshakePlayer();
extern void SetShakeMagnitude(float delta);
// Break the specified (glass) face into shards
// Parameters: rp, facenum - the face to break
// hitpnt - the point on the face where the face shatters. If NULL, uses center

View File

@ -144,24 +144,28 @@ typedef int socklen_t;
bool Dedicated_server = false;
int Dedicated_start_level = 1;
int Dummy_dedicated_var;
char Dummy_dedicated_string[_MAX_PATH];
static int Dedicated_start_level = 1;
static int Dummy_dedicated_var;
static char Dummy_dedicated_string[_MAX_PATH];
// If true, allow remote connections
int Dedicated_allow_remote = 0;
ushort Dedicated_listen_port = 2092;
char dedicated_telnet_password[65];
int Dedicated_num_teams = 1;
static int Dedicated_allow_remote = 0;
static ushort Dedicated_listen_port = 2092;
static char dedicated_telnet_password[65];
static int Dedicated_num_teams = 1;
int CheckMissionForScript(char *mission, char *script, int dedicated_server_num_teams);
static int RunServerConfigs();
static int DedicatedServerLex(const char *command);
static void SetCVarNone(int index);
extern int CheckMissionForScript(char *mission, char *script, int dedicated_server_num_teams);
extern char Multi_message_of_the_day[];
extern char PXO_hosted_lobby_name[];
// These define the types of variables that can be set in the code through
// the dedicated server
cvar_entry CVars[] = {
static cvar_entry CVars[] = {
{"PPS", CVAR_TYPE_INT, &Netgame.packets_per_second, 2, 20, CVAR_GAMEINIT}, // 0
{"TimeLimit", CVAR_TYPE_INT, &Netgame.timelimit, 0, 10000, CVAR_GAMEINIT},
{"KillGoal", CVAR_TYPE_INT, &Netgame.killgoal, 0, 10000, CVAR_GAMEINIT},

View File

@ -300,23 +300,23 @@
#include "demofile.h"
extern bool is_multi_demo;
CFILE *Demo_cfp = NULL;
static CFILE *Demo_cfp = NULL;
char Demo_fname[_MAX_PATH * 2];
char Old_demo_fname[_MAX_PATH * 2];
float Demo_next_frame = 0;
float Demo_frame_time = 0;
float Demo_last_pinfo;
static char Old_demo_fname[_MAX_PATH * 2];
static float Demo_next_frame = 0;
static float Demo_frame_time = 0;
static float Demo_last_pinfo;
float Demo_frame_ofs;
int Demo_auto_idx = 0;
static int Demo_auto_idx = 0;
unsigned int Demo_flags = 0;
unsigned short Demo_obj_map[MAX_OBJECTS];
bool Demo_turretchanged[MAX_OBJECTS];
static bool Demo_turretchanged[MAX_OBJECTS];
bool Demo_looping = false;
bool Demo_paused = false;
bool Demo_do_one_frame = false;
bool Demo_restart = false;
bool Demo_auto_play = false;
bool Demo_first_frame = true;
static bool Demo_first_frame = true;
bool Demo_make_movie = false;
#define DEMO_PINFO_UPDATE .1
@ -333,9 +333,9 @@ extern bool Game_paused;
extern bool Game_gauge_do_time_test;
bool Demo_play_fast = false;
static bool Demo_play_fast = false;
void PageInAllData(void);
extern void PageInAllData(void);
// Prompts user for filename and starts recording if successfull
void DemoToggleRecording() {

View File

@ -756,7 +756,7 @@ function_mode GetFunctionMode() { return Function_mode; }
// The game's defer handler (For Win32, it happens during idle processing)
// ---------------------------------------------------------------------------
extern bool Skip_render_game_frame;
void GameFrame(void);
extern void GameFrame(void);
void D3DeferHandler(bool is_active) {
if (is_active) {
// perform any needed io system processing in the background

View File

@ -23,18 +23,18 @@
// 1. Don't mess with target leading (other than algorithm type) as it will make robots
// turn strangely (or at least never scale it up beyond 1.0)
float Diff_ai_dodge_percent[5] = {0.04f, 0.10f, 1.00f, 1.00f, 1.50f};
float Diff_ai_dodge_speed[5] = {0.20f, 0.30f, 1.00f, 1.25f, 1.50f};
float Diff_ai_speed[5] = {0.70f, 0.80f, 1.00f, 1.10f, 1.20f};
float Diff_ai_rotspeed[5] = {0.70f, 0.80f, 1.00f, 1.10f, 1.20f};
float Diff_ai_circle_dist[5] = {1.10f, 1.00f, 1.00f, 1.00f, 1.00f};
float Diff_ai_vis_dist[5] = {0.80f, 0.90f, 1.00f, 1.10f, 1.20f};
float Diff_player_damage[5] = {0.30f, 0.60f, 1.00f, 1.50f, 2.00f};
float Diff_ai_weapon_speed[5] = {0.50f, 0.75f, 1.00f, 1.20f, 1.40f};
float Diff_homing_strength[5] = {0.20f, 0.70f, 1.00f, 1.20f, 1.40f};
float Diff_robot_damage[5] = {2.75f, 1.50f, 1.00f, 0.80f, 0.60f};
float Diff_general_scalar[5] = {2.50f, 1.75f, 1.00f, 0.75f, 0.50f};
float Diff_general_inv_scalar[5] = {0.50f, 0.75f, 1.00f, 1.75f, 2.50f};
float Diff_shield_energy_scalar[5] = {2.25f, 1.5f, 1.0f, 0.75f, 0.5f};
float Diff_ai_turret_speed[5] = {0.6f, 0.7f, 1.0f, 1.0f, 1.0f};
float Diff_ai_min_fire_spread[5] = {.30f, .15f, 0.0f, 0.0f, 0.0f};
const float Diff_ai_dodge_percent[5] = {0.04f, 0.10f, 1.00f, 1.00f, 1.50f};
const float Diff_ai_dodge_speed[5] = {0.20f, 0.30f, 1.00f, 1.25f, 1.50f};
const float Diff_ai_speed[5] = {0.70f, 0.80f, 1.00f, 1.10f, 1.20f};
const float Diff_ai_rotspeed[5] = {0.70f, 0.80f, 1.00f, 1.10f, 1.20f};
const float Diff_ai_circle_dist[5] = {1.10f, 1.00f, 1.00f, 1.00f, 1.00f};
const float Diff_ai_vis_dist[5] = {0.80f, 0.90f, 1.00f, 1.10f, 1.20f};
const float Diff_player_damage[5] = {0.30f, 0.60f, 1.00f, 1.50f, 2.00f};
const float Diff_ai_weapon_speed[5] = {0.50f, 0.75f, 1.00f, 1.20f, 1.40f};
const float Diff_homing_strength[5] = {0.20f, 0.70f, 1.00f, 1.20f, 1.40f};
const float Diff_robot_damage[5] = {2.75f, 1.50f, 1.00f, 0.80f, 0.60f};
const float Diff_general_scalar[5] = {2.50f, 1.75f, 1.00f, 0.75f, 0.50f};
const float Diff_general_inv_scalar[5] = {0.50f, 0.75f, 1.00f, 1.75f, 2.50f};
const float Diff_shield_energy_scalar[5] = {2.25f, 1.5f, 1.0f, 0.75f, 0.5f};
const float Diff_ai_turret_speed[5] = {0.6f, 0.7f, 1.0f, 1.0f, 1.0f};
const float Diff_ai_min_fire_spread[5] = {.30f, .15f, 0.0f, 0.0f, 0.0f};

View File

@ -29,19 +29,19 @@ extern ubyte ingame_difficulty;
#define DIFF_LEVEL (((Game_mode & GM_MULTI)) ? Netgame.difficulty : ingame_difficulty)
// #define DIFF_LEVEL (((Game_mode & GM_MULTI))?Netgame.difficulty:dCurrentPilotDifficulty())
extern float Diff_ai_dodge_percent[5]; //
extern float Diff_ai_dodge_speed[5]; //
extern float Diff_ai_speed[5]; //
extern float Diff_ai_rotspeed[5]; //
extern float Diff_ai_circle_dist[5]; //
extern float Diff_ai_vis_dist[5]; //
extern float Diff_player_damage[5]; //
extern float Diff_ai_weapon_speed[5]; //
extern float Diff_homing_strength[5]; //
extern float Diff_robot_damage[5]; //
extern float Diff_general_scalar[5]; // Trainee = 2.50f HotShot = 1.0f
extern float Diff_general_inv_scalar[5]; // Trainee = 0.50f HotShot = 1.0f
extern float Diff_shield_energy_scalar[5];
extern float Diff_ai_turret_speed[5];
extern float Diff_ai_min_fire_spread[5];
const extern float Diff_ai_dodge_percent[5]; //
const extern float Diff_ai_dodge_speed[5]; //
const extern float Diff_ai_speed[5]; //
const extern float Diff_ai_rotspeed[5]; //
const extern float Diff_ai_circle_dist[5]; //
const extern float Diff_ai_vis_dist[5]; //
const extern float Diff_player_damage[5]; //
const extern float Diff_ai_weapon_speed[5]; //
const extern float Diff_homing_strength[5]; //
const extern float Diff_robot_damage[5]; //
const extern float Diff_general_scalar[5]; // Trainee = 2.50f HotShot = 1.0f
const extern float Diff_general_inv_scalar[5]; // Trainee = 0.50f HotShot = 1.0f
const extern float Diff_shield_energy_scalar[5];
const extern float Diff_ai_turret_speed[5];
const extern float Diff_ai_min_fire_spread[5];
#endif

View File

@ -150,9 +150,10 @@ int Global_keys;
// ---------------------------------------------------------------------------
// Prototypes
void DoorwayOpen(room *rp);
void DoorwayClose(room *rp);
void DoorwayWait(room *rp);
// TODO: MTS: none of the following were found
// void DoorwayOpen(room *rp);
// void DoorwayClose(room *rp);
// void DoorwayWait(room *rp);
object *GetDoorObject(room *rp);
// ---------------------------------------------------------------------------

View File

@ -615,6 +615,12 @@
#include <algorithm>
static object *CreateSubobjectDebris(object *parent, int subobj_num, float explosion_mag, int death_flags);
static void DrawSmolderingObject(object *obj);
static int GetRandomExplosion(float size);
static void CreateBlueBlastRing(vector *pos, int index, float lifetime, float max_size, int roomnum, int objnum,
int force_up);
// If an objects size is bigger than this, we create size/threshold extra explosions
#define EXTRA_EXPLOSION_THRESHOLD 15
fireball Fireballs[NUM_FIREBALLS] = {
@ -709,7 +715,7 @@ void InitFireballs() {
}
GameBitmaps[Fireballs[GRAY_SPARK_INDEX].bm_handle].flags |= BF_CHANGED;
}
void DrawSmolderingObject(object *obj);
// Given an object, renders the representation of this fireball
void DrawFireballObject(object *obj) {
ASSERT(obj->type == OBJ_FIREBALL);
@ -855,6 +861,7 @@ int CreateFireball(vector *pos, int fireball_num, int roomnum, int realtype) {
return objnum;
}
// TODO: MTS: used only in this file.
// Creates a fireball object with a custom texture/vclip
int CreateCustomFireballObject(vector *pos, int fireball_num, int tex_handle, int roomnum) {
int objnum;
@ -1199,7 +1206,7 @@ void DoDeathSpew(object *parent) {
}
}
}
int GetRandomExplosion(float size);
// Creates a fireball vis effect for the specified object
// The explosion size is based on the object size times the size_scale
// The fireball type will be randomly selected based on the explosion size
@ -1504,7 +1511,6 @@ void DoDyingFrame(object *objp) {
}
}
}
extern void SetShakeMagnitude(float delta);
// Pulls every object near the gravity field into its center
void DoGravityFieldEffect(object *obj) {
float max_size = obj->ctype.blast_info.max_size;
@ -2020,11 +2026,13 @@ int CreateBlastRing(vector *pos, int index, float lifetime, float max_size, int
return objnum;
}
// TODO: MTS: only used in this file.
// Creates a standard blast ring for an object
int CreateObjectBlastRing(object *objp) {
float ring_size = OBJECT_OUTSIDE(objp) ? (objp->size * 3) : objp->size;
return CreateBlastRing(&objp->pos, BLAST_RING_INDEX, DAMAGE_RING_TIME, ring_size, objp->roomnum);
}
// TODO: MTS: Not used?
// Creates a smolding smoke to be drawn
int CreateSmolderingObject(vector *pos, int index, float lifetime, float max_size, int roomnum) {
int objnum;
@ -2050,6 +2058,7 @@ void DrawColoredDisk(vector *pos, float r, float g, float b, float inner_alpha,
DrawColoredRing(pos, r, g, b, inner_alpha, outer_alpha, size, 0, saturate, lod);
rend_SetZBufferWriteMask(1);
}
// TODO: MTS: Not used?
// Draws a glowing cone of light using a bitmap
void DrawColoredGlow(vector *pos, float r, float g, float b, float size) {
rend_SetTextureType(TT_LINEAR);
@ -2140,6 +2149,7 @@ void DrawColoredRing(vector *pos, float r, float g, float b, float inner_alpha,
}
}
// TODO: MTS: not used?
// Draws a sphere with the appropriate texture. If texture=-1, then uses rgb as colors
void DrawSphere(vector *pos, float r, float g, float b, float alpha, float size, int texture, ubyte saturate) {
static vector sphere_vecs[16][16];
@ -2222,7 +2232,8 @@ void DrawSphere(vector *pos, float r, float g, float b, float alpha, float size,
rend_SetZBufferWriteMask(1);
}
#define BLAST_RING_ALPHA 1.0f
// Draws a blast ring
// TODO: MTS: only used in this file.
// Draws a blast ring
void DrawBlastRingObject(object *obj) {
vector inner_vecs[30], outer_vecs[30];
g3Point inner_points[30], outer_points[30];
@ -2342,7 +2353,8 @@ void DoBlastRingEvent(int eventnum, void *data) {
object *obj = (object *)data;
CreateObjectBlastRing(obj);
}
// Creates an explosion
// TODO: MTS: only used in this file.
// Creates an explosion
void DoExplosionEvent(int eventnum, void *data) {
float *vals = (float *)data;
vector pos;
@ -2395,6 +2407,7 @@ int GetRandomExplosion(float size) {
else
return GetRandomMediumExplosion();
}
// TODO: MTS: only found in this file.
// Returns a random medium sized explosion
int GetRandomMediumExplosion() {
int choices[] = {MED_EXPLOSION_INDEX, MED_EXPLOSION_INDEX2, MED_EXPLOSION_INDEX3};
@ -2406,6 +2419,7 @@ int GetRandomSmallExplosion() {
int pick = ps_rand() % 2;
return (choices[pick]);
}
// TODO: MTS: only found in this file.
int GetRandomBillowingExplosion() {
int choices[] = {BILLOWING_INDEX, MED_EXPLOSION_INDEX2};
int pick = ps_rand() % 2;

View File

@ -220,6 +220,9 @@ void MakeShockwave(object *explode_obj_ptr, int parent_handle);
void DoConcussiveForce(object *explode_obj_ptr, int parent_handle, float player_scalar = 1);
// Creates a gravity field that sucks objects into it
extern int CreateGravityField(vector *pos, int roomnum, float size, float time, int parent_handle);
// Control code for explosions
void DoExplosionFrame(object *obj);

View File

@ -255,6 +255,8 @@ extern float force_field_bounce_multiplier[MAX_FORCE_FIELD_BOUNCE_TEXTURES];
extern bool Level_powerups_ignore_wind;
extern bool IsCheater;
#ifdef _DEBUG
extern int Game_show_sphere;
extern int Game_show_portal_vis_pnts;

View File

@ -285,25 +285,43 @@ typedef struct {
} tCinematicDemoInfo;
void Cinematic_WriteDemoFileData(tCinematicDemoInfo *info);
bool Cinematic_StartCine(tGameCinematic *info, const char *text_string, int camera_objhandle);
static void Cinematic_WriteDemoFileData(tCinematicDemoInfo *info);
static bool Cinematic_StartCine(tGameCinematic *info, const char *text_string, int camera_objhandle);
void Cinematic_DrawText(void);
void Cinematic_DoEndTransition(void);
void Cinematic_DoStartTransition(void);
static void Cinematic_DrawText(void);
static void Cinematic_DoEndTransition(void);
static void Cinematic_DoStartTransition(void);
bool Cinematic_inuse;
tGameCinematic Cinematic_fake_info;
static tGameCinematic Cinematic_fake_info;
bool Cinematic_fake_queued = false;
int gc_fade_bmp_handle = BAD_BITMAP_HANDLE;
int gc_fadewhite_bmp_handle = BAD_BITMAP_HANDLE;
int gc_wacky_bmp_handle = BAD_BITMAP_HANDLE;
int gc_temp_bmp_handle = BAD_BITMAP_HANDLE;
static int gc_fade_bmp_handle = BAD_BITMAP_HANDLE;
static int gc_fadewhite_bmp_handle = BAD_BITMAP_HANDLE;
static int gc_wacky_bmp_handle = BAD_BITMAP_HANDLE;
static int gc_temp_bmp_handle = BAD_BITMAP_HANDLE;
#define END_TRANSITION_TIME 1.0f
float Cine_GetPathTravelSpeed(int pathnum, float time);
static float Cine_GetPathTravelSpeed(int pathnum, float time);
static void Cinematic_PerformFake(void);
static void Cinematic_SetForFakeCinematic(tGameCinematic *info);
static inline void verify_percentranage(PercentageRange *range);
static inline int Cinematics_CreateCamera(void);
static inline void Cinematic_DeleteCamera(int objhandle);
static inline bool Cinematic_IsPlayerDead(void);
static bool Cinematic_IsKeyPressed(void);
static void CannedCinematicIntroCallback(int type);
static void CannedCinematic_Intro(int PathID, char *Text, int PlayerPath, float Seconds, int camera_handle);
static void CannedCinematicEndLevelCallback(int type);
static void CannedCinematic_EndLevelPath(int PathID, char *Text, int PlayerPath, float Seconds, int camera_handle);
static void CannedCinematic_EndLevelPoint(vector *pos, int room, char *Text, int PlayerPath, float Seconds,
int camera_handle);
static void CannedCinematicMovePlayerFadeCallback(int type);
static void CannedCinematic_MovePlayerFade(object *player, int room, vector *pos, matrix *orient, int camera_handle);
static void CannedCinematicLevelEndFadeWhiteCallback(int type);
static void CannedCinematic_LevelEndFadeWhite(int camera_handle, float time, char *text_to_display);
static void Cinematic_DoFakeCannedCinematics(tCannedCinematicInfo *info);
// Returns the hud mode before cinematics
tHUDMode Cinematic_GetOldHudMode(void) { return GameCinema.old_hudmode; }
@ -385,7 +403,7 @@ void Cinematic_LevelInit(void) {
GameCinema.doing_end_transition = false;
}
inline void verify_percentranage(PercentageRange *range) {
static inline void verify_percentranage(PercentageRange *range) {
if (range->min < 0.0f)
range->min = 0.0f;
if (range->min > 1.0f)
@ -436,7 +454,7 @@ void Cinematic_SetForFakeCinematic(tGameCinematic *info) {
Cinematic_fake_queued = true;
}
inline int Cinematics_CreateCamera(void) {
static inline int Cinematics_CreateCamera(void) {
int objnum = ObjCreate(OBJ_CAMERA, 0, Player_object->roomnum, &Player_object->pos, NULL);
if (objnum == -1)
return OBJECT_HANDLE_NONE;
@ -490,7 +508,7 @@ bool Cinematic_Start(tGameCinematic *info, char *text_string) {
return Cinematic_StartCine(info, text_string, camera_handle);
}
inline void Cinematic_DeleteCamera(int objhandle) {
static inline void Cinematic_DeleteCamera(int objhandle) {
object *obj = ObjGet(objhandle);
if (obj) {
SetObjectDeadFlag(obj);
@ -872,7 +890,7 @@ bool Cinematic_StartCine(tGameCinematic *info, const char *text_string, int came
return true;
}
inline bool Cinematic_IsPlayerDead(void) {
static inline bool Cinematic_IsPlayerDead(void) {
if (!Player_object || (Player_object->type == OBJ_GHOST) ||
(Player_object->type == OBJ_PLAYER &&
Players[Player_object->id].flags & (PLAYER_FLAGS_DYING | PLAYER_FLAGS_DEAD))) {
@ -1798,7 +1816,7 @@ struct {
float cinematic_time;
bool should_thrust;
} CannedCinematicEndLevel;
bool EndLevel();
extern bool EndLevel();
void CannedCinematicEndLevelCallback(int type) {
switch (type) {
@ -2190,18 +2208,18 @@ void Cinematic_StartCanned(tCannedCinematicInfo *info, int camera_handle) {
//==================================================
// Demo file support
//==================================================
void mf_WriteInt(ubyte *buffer, int *pointer, int data);
void mf_WriteShort(ubyte *buffer, int *pointer, short data);
void mf_WriteByte(ubyte *buffer, int *pointer, ubyte data);
void mf_WriteFloat(ubyte *buffer, int *pointer, float data);
void mf_WriteBytes(ubyte *buffer, int *pointer, ubyte *data, int len);
void mf_WriteString(ubyte *buffer, int *pointer, const char *string);
int mf_ReadInt(ubyte *buffer, int *pointer);
short mf_ReadShort(ubyte *buffer, int *pointer);
ubyte mf_ReadByte(ubyte *buffer, int *pointer);
float mf_ReadFloat(ubyte *buffer, int *pointer);
void mf_ReadBytes(ubyte *buffer, int *pointer, ubyte *data, int len);
void mf_ReadString(ubyte *buffer, int *pointer, char *string);
static void mf_WriteInt(ubyte *buffer, int *pointer, int data);
static void mf_WriteShort(ubyte *buffer, int *pointer, short data);
static void mf_WriteByte(ubyte *buffer, int *pointer, ubyte data);
static void mf_WriteFloat(ubyte *buffer, int *pointer, float data);
static void mf_WriteBytes(ubyte *buffer, int *pointer, ubyte *data, int len);
static void mf_WriteString(ubyte *buffer, int *pointer, const char *string);
static int mf_ReadInt(ubyte *buffer, int *pointer);
static short mf_ReadShort(ubyte *buffer, int *pointer);
static ubyte mf_ReadByte(ubyte *buffer, int *pointer);
static float mf_ReadFloat(ubyte *buffer, int *pointer);
static void mf_ReadBytes(ubyte *buffer, int *pointer, ubyte *data, int len);
static void mf_ReadString(ubyte *buffer, int *pointer, char *string);
void Cinematic_DoDemoFileData(ubyte *buffer) {
int count = 0;

View File

@ -1906,8 +1906,6 @@ void FlushDataCache() {
///////////////////////////////////////////////////////////////////////////////
// Parameter: state - 1 = success, 0 = failure, -1 = abort
extern float Player_shields_saved_from_last_level;
extern float Player_energy_saved_from_last_level;
void EndLevel(int state) {
// tell IntelliVIBE
VIBE_DoLevelEnd();

View File

@ -148,6 +148,8 @@ typedef enum tGameState {
// variables
extern tGameState Game_state;
extern int Game_interface_mode; // current interface mode of game (menu, game?)
extern int paged_in_count;
extern int paged_in_num;
// functions
// main sequencing code for game. run this to execute a game.

View File

@ -283,12 +283,13 @@
#include "args.h"
#include "mem.h"
// TODO: MTS: this is only used in this file.
int Num_textures = 0;
texture GameTextures[MAX_TEXTURES];
extern bool Mem_superlow_memory_mode;
int Total_memory_saved = 0;
static int Total_memory_saved = 0;
void FreeAllTextures() {
for (int i = 0; i < MAX_TEXTURES; i++) {

View File

@ -255,56 +255,59 @@ static float *Render_normalized_times;
static bool Render_gauge_moving; // gauge is moving, but temporarily off.
static bool Render_gauge_reset; // set this if gauges will be moving, but are still active
// TODO: MTS: function not found
// loads all shield bitmaps into memory
void FreeShieldFrames();
static void FreeShieldFrames();
// TODO: MTS: function not found
// loads all ship bitmaps into memory
void FreeShipFrames();
static void FreeShipFrames();
// projects monitor coordinates to screen coordinates
void RotateMonitorPosition(tGauge *gauge);
static void RotateMonitorPosition(tGauge *gauge);
// TODO: MTS: function not found
// renders the current inventory item name at the x,y position
void InventoryRenderGauge(int x, int y);
static void InventoryRenderGauge(int x, int y);
// renders the primary monitor gauge
void RenderPrimaryMonitor(tGauge *gauge, bool modified);
static void RenderPrimaryMonitor(tGauge *gauge, bool modified);
// renders the secondary monitor gauge
void RenderSecondaryMonitor(tGauge *gauge, bool modified);
static void RenderSecondaryMonitor(tGauge *gauge, bool modified);
// renders the shield gauge monitor
void RenderShieldMonitor(tGauge *gauge, bool modified);
static void RenderShieldMonitor(tGauge *gauge, bool modified);
// renders the ship gauge monitor
void RenderShipMonitor(tGauge *gauge, bool modified);
static void RenderShipMonitor(tGauge *gauge, bool modified);
// renders the ship gauge monitor
void RenderEnergyMonitor(tGauge *gauge, int orient, bool modified);
static void RenderEnergyMonitor(tGauge *gauge, int orient, bool modified);
// renders the ship gauge monitor
void RenderAfterburnMonitor(tGauge *gauge, bool modified);
static void RenderAfterburnMonitor(tGauge *gauge, bool modified);
// renders a monitor style quad
void DrawGaugeMonitor(g3Point *pts, int bm, float brightness, float *alphas);
static void DrawGaugeMonitor(g3Point *pts, int bm, float brightness, float *alphas);
// renders a square texture onto the screen.
void DrawGaugeQuad(g3Point *pts, int bm, float u0, float v0, float u1, float v1, ubyte alpha, bool saturate);
static void DrawGaugeQuad(g3Point *pts, int bm, float u0, float v0, float u1, float v1, ubyte alpha, bool saturate);
// renders a square texture onto the screen.
void DrawGaugeQuad(g3Point *pts, int bm, ubyte alpha = 255, bool saturate = false);
static void DrawGaugeQuad(g3Point *pts, int bm, ubyte alpha = 255, bool saturate = false);
// renders a flat poly onto the screen with given color
void DrawGaugeQuadFlat(g3Point *pts, float r, float g, float b, ubyte alpha);
static void DrawGaugeQuadFlat(g3Point *pts, float r, float g, float b, ubyte alpha);
// renders a flat poly onto the screen with 4 colors (for each vertex)
void DrawGaugeQuadFlat(g3Point *pts, float *r, float *g, float *b, ubyte alpha);
static void DrawGaugeQuadFlat(g3Point *pts, float *r, float *g, float *b, ubyte alpha);
// correctly orders monitor vertices based off of UVs
int GetFirstVert(bsp_info *sm);
static int GetFirstVert(bsp_info *sm);
// tells what gauge index is the gauge stat item.
inline int GAUGE_INDEX(tStatMask mask) {
static inline int GAUGE_INDEX(tStatMask mask) {
int i;
for (i = 0; i < NUM_GAUGES; i++)
@ -498,7 +501,7 @@ void FlagGaugesNonfunctional(tStatMask mask) {
// can render another view though.
// renders the primary monitor gauge
inline int get_weapon_hud_image(int player, int type) {
static inline int get_weapon_hud_image(int player, int type) {
player_weapon *pw = &Players[player].weapon[type];
weapon *wpn = GetWeaponFromIndex(player, pw->index);

View File

@ -143,51 +143,51 @@
#include "stringtable.h"
#define TITLETEXT TXT_HELP
int HelpText[] = {TXI_ESC,
TXI_HLPQUIT,
static const int HelpText[] = {TXI_ESC,
TXI_HLPQUIT,
#ifndef DEMO // Do Not include in the PC Gamer Demo
TXI_HLPALTF2,
TXI_HLPSAVEGAME,
TXI_HLPALTF3,
TXI_HLPLOADGAME,
TXI_HLPALTF2,
TXI_HLPSAVEGAME,
TXI_HLPALTF3,
TXI_HLPLOADGAME,
#endif
TXI_F2,
TXI_HLPCONFIG,
TXI_F3,
TXI_HLPCOCKPIT,
TXI_HLPF4,
TXI_HLPGUIDEBOT,
TXI_F5,
TXI_TOGGLEDEMO,
TXI_F6,
TXI_MLTMENU,
TXI_F8,
TXI_HLP_MULTIMSG,
TXI_F9,
TXI_HLP_QUIKSAVE,
TXI_F12,
TXI_DROPSMARKER,
TXI_SHFTTAB,
TXI_TCMM,
TXI_HLPPAUSE,
TXI_HLPPAUSEDESC,
TXI_PLUSMINUS,
TXI_HLPSCRNSIZE,
TXI_HLPPRNTSCRN,
TXI_HLPTAKESCRNSHT,
TXI_HLP1_5,
TXI_HLPSELPRIM,
TXI_HLP6_0,
TXI_HLPSELSECN,
TXI_SF1,
TXI_HLPREARLEFT,
TXI_SF2,
TXI_HLPREARRIGHT,
TXI_SHFTF8,
TXI_DISPLAYGAMEMSGCONSOLE,
TXI_SHFTF9,
TXI_DISPLAYHUDMSGCONSOLE,
0};
TXI_F2,
TXI_HLPCONFIG,
TXI_F3,
TXI_HLPCOCKPIT,
TXI_HLPF4,
TXI_HLPGUIDEBOT,
TXI_F5,
TXI_TOGGLEDEMO,
TXI_F6,
TXI_MLTMENU,
TXI_F8,
TXI_HLP_MULTIMSG,
TXI_F9,
TXI_HLP_QUIKSAVE,
TXI_F12,
TXI_DROPSMARKER,
TXI_SHFTTAB,
TXI_TCMM,
TXI_HLPPAUSE,
TXI_HLPPAUSEDESC,
TXI_PLUSMINUS,
TXI_HLPSCRNSIZE,
TXI_HLPPRNTSCRN,
TXI_HLPTAKESCRNSHT,
TXI_HLP1_5,
TXI_HLPSELPRIM,
TXI_HLP6_0,
TXI_HLPSELSECN,
TXI_SF1,
TXI_HLPREARLEFT,
TXI_SF2,
TXI_HLPREARRIGHT,
TXI_SHFTF8,
TXI_DISPLAYGAMEMSGCONSOLE,
TXI_SHFTF9,
TXI_DISPLAYHUDMSGCONSOLE,
0};
#define HELP_X_KEY_POS 60
#define HELP_X_DESC_POS 160

View File

@ -114,7 +114,9 @@
#include "bitmap.h"
#include "manage.h"
void makecorner(int corner_bmp, int back_bmp, const char *tmap, int l, int t, int r, int b);
static void makecorner(int corner_bmp, int back_bmp, const char *tmap, int l, int t, int r, int b);
static int CreateHotSpotMap(const char *map, int width, int height, hotspotmap_t *hsmap);
static void CreateWindowMap(const char *map, int width, int height, windowmap_t *wndmap);
// just like the old bm_tga_translate_pixel function, but it stores the alpha in the alpha_value parameter
ushort menutga_translate_pixel(int pixel, char *alpha_value) {
@ -504,6 +506,7 @@ void CreateWindowMap(const char *map, int width, int height, windowmap_t *wndmap
}
}
// TODO: MTS: only used in this file
// Loads a tga or ogf file into a bitmap...returns handle to bm or -1 on error, and fills in the alphamap
int menutga_alloc_file(const char *name, char *hsmap[1], int *w, int *h) {
ubyte image_id_len, color_map_type, image_type, pixsize, descriptor;
@ -589,6 +592,7 @@ int menutga_alloc_file(const char *name, char *hsmap[1], int *w, int *h) {
return (n);
}
// TODO: MTS: only used in this file
// Given a filename and a hotspotmap structure, it saves it to disk (.HSM)
void menutga_SaveHotSpotMap(const char *filename, hotspotmap_t *hsmap, windowmap_t *wndmap) {
CFILE *file;
@ -911,6 +915,7 @@ bool menutga_ConvertTGAtoHSM(const char *fpath) {
return true;
}
// TODO: MTS: Unused?
// Given a hotspotmap structure, it draws the pretty hotspot map to the screen (blue areas are the hotspots)
void DisplayHotSpots(hotspotmap_t *hsmap, windowmap_t *wndmap) {
//@@ grSurface *cursurf;
@ -965,6 +970,7 @@ void DisplayHotSpots(hotspotmap_t *hsmap, windowmap_t *wndmap) {
//@@ Game_screen->flip();
}
// TODO: MTS: only used in this file
// Writes a hotspotmap_t struct to a text file
void ExportHotSpot(const char *filename, hotspotmap_t *hsmap) {
CFILE *file;

View File

@ -480,25 +480,22 @@ static tHUDItem HUD_array[MAX_HUD_ITEMS];
struct sHUDResources HUD_resources;
// initializes non configurable hud items.
void InitDefaultHUDItems();
static void InitDefaultHUDItems();
// initializes items based off their type (information, etc.)
void InitHUDItem(int new_item, tHUDItem *item);
static void InitHUDItem(int new_item, tHUDItem *item);
// iterate through entire hud item list to draw.
void RenderHUDItems(tStatMask stat_mask);
// frees up reticle bitmaps
void FreeReticle();
static void RenderHUDItems(tStatMask stat_mask);
// renders the reticle
void RenderReticle();
static void RenderReticle();
// renders missile reticle
void RenderMissileReticle();
static void RenderMissileReticle();
// renders zoom reticle
void RenderZoomReticle();
static void RenderZoomReticle();
// hack!
@ -1340,8 +1337,6 @@ void RenderAuxHUDFrame() {
HUD_msg_con.Draw();
}
extern const char *cfg_binding_text(ct_type ctype, ubyte ctrl, ubyte binding);
char *GetControllerBindingText(int fidcont) {
static char *cont_bind_txt;
ct_type ctype[CTLBINDS_PER_FUNC];
@ -1921,7 +1916,7 @@ void ResetReticle() {
}
// creates the reticle display bitmap mask to be used by the reticle renderer.
inline ushort reticle_mask(object *pobj, otype_wb_info *static_wb, int wb_index) {
static inline ushort reticle_mask(object *pobj, otype_wb_info *static_wb, int wb_index) {
poly_model *pm = &Poly_models[pobj->rtype.pobj_info.model_num];
dynamic_wb_info *dyn_wb = &pobj->dynamic_wb[wb_index];
unsigned mask = 0;
@ -1957,7 +1952,7 @@ inline ushort reticle_mask(object *pobj, otype_wb_info *static_wb, int wb_index)
return mask;
}
inline void draw_reticle_sub(int cx, int cy, int rw, int rh, ushort on_mask, ushort gp_mask, const int *wb_elem_array) {
static inline void draw_reticle_sub(int cx, int cy, int rw, int rh, ushort on_mask, ushort gp_mask, const int *wb_elem_array) {
int i, x, y;
int bmp_handle;
char align;

View File

@ -332,6 +332,8 @@ extern tStatMask Hud_stat_mask;
extern float Hud_aspect_x;
extern float Hud_aspect_y;
extern bool Hud_show_controls;
// normalize hud coordinates
#define HUD_X(_x) ((float)(_x) * Hud_aspect_x)
#define HUD_Y(_y) ((float)(_y) * Hud_aspect_y)
@ -392,6 +394,9 @@ void InitReticle(int primary_slots, int secondary_slots);
// resets reticle to current weapon.
void ResetReticle();
// frees up reticle bitmaps
void FreeReticle();
// Flags for persistent HUD messages
#define HPF_FADEOUT 1 // message fades out when done
#define HPF_FREESPACE_DRAW 2 // message draws with the FreeSpace briefing effect

View File

@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
@ -244,34 +244,34 @@
// Data
// renders the description for the current inventory item
void RenderHUDInventory(tHUDItem *item);
static void RenderHUDInventory(tHUDItem *item);
// renders the shield rating for the ship
void RenderHUDShieldValue(tHUDItem *item);
static void RenderHUDShieldValue(tHUDItem *item);
// renders the energy rating for the ship
void RenderHUDEnergyValue(tHUDItem *item);
static void RenderHUDEnergyValue(tHUDItem *item);
// draws the afterburner hud gauge.
void RenderHUDAfterburner(tHUDItem *item);
static void RenderHUDAfterburner(tHUDItem *item);
// draws the primary weapon current in.
void RenderHUDPrimary(tHUDItem *item);
static void RenderHUDPrimary(tHUDItem *item);
// draw secondary weapon current in.
void RenderHUDSecondary(tHUDItem *item);
static void RenderHUDSecondary(tHUDItem *item);
// renders ship status.
void RenderHUDShipStatus(tHUDItem *item);
static void RenderHUDShipStatus(tHUDItem *item);
// renders warnings like system failures or missile locks.
void RenderHUDWarnings(tHUDItem *item);
static void RenderHUDWarnings(tHUDItem *item);
// render hud countermeasures
void RenderHUDCountermeasures(tHUDItem *item);
static void RenderHUDCountermeasures(tHUDItem *item);
// returns the weapon's icon.
inline int get_weapon_icon(int player, int type) {
static inline int get_weapon_icon(int player, int type) {
player_weapon *pw = &Players[player].weapon[type];
weapon *wpn = GetWeaponFromIndex(player, pw->index);
int bmp;
@ -285,7 +285,7 @@ inline int get_weapon_icon(int player, int type) {
return HUD_resources.wpn_bmp;
}
void RenderHUDTextFlagsNoFormat(int flags, ddgr_color col, ubyte alpha, int sat_count, int x, int y, const char *str);
static void RenderHUDTextFlagsNoFormat(int flags, ddgr_color col, ubyte alpha, int sat_count, int x, int y, const char *str);
//////////////////////////////////////////////////////////////////////////////
// Hud item display routines.

View File

@ -368,14 +368,14 @@ int Doing_input_message = HUD_MESSAGE_NONE;
int HudInputMessageLen = 0;
static tDirtyRect HUD_inmsg_dirty_rect;
char HUD_messages[MAX_HUD_MESSAGES][HUD_MESSAGE_LENGTH];
int HUD_message_type[MAX_HUD_MESSAGES];
ddgr_color HUD_message_color[MAX_HUD_MESSAGES];
static char HUD_messages[MAX_HUD_MESSAGES][HUD_MESSAGE_LENGTH];
static int HUD_message_type[MAX_HUD_MESSAGES];
static ddgr_color HUD_message_color[MAX_HUD_MESSAGES];
int Num_hud_messages = 0;
int Hud_scroll_offset = 0;
static int Hud_scroll_offset = 0;
static tDirtyRect HUD_msg_dirty_rect;
float Hud_timer = 0.0f;
static float Hud_timer = 0.0f;
static ubyte Hud_persistent_msg_id = HUD_INVALID_ID;
static float Hud_persistent_msg_timer = 0.0f;
@ -405,17 +405,17 @@ static bool Hud_messages_paused = false;
#define GAME_MSGCON_Y ((Max_window_h - GAME_MSGCON_H) / 2)
// This function takes a HUD messages, ensures it isn't too long, and if it is, it correctly fixes it
void CorrectHudMessage(char *str);
static void CorrectHudMessage(char *str);
///////////////////////////////////////////////////////////////////////////////
// Functions
// prints a string onto the debug consle
void AddMessageToRollback(char *msg) { HUD_msg_list.add(msg); }
static void AddMessageToRollback(char *msg) { HUD_msg_list.add(msg); }
// Adds a single line to the hud message list
// Returns true if message added, or false if message not (because the previous message was the same)
bool AddLineToHUDMessages(char *temp_message, ddgr_color color = -1);
static bool AddLineToHUDMessages(char *temp_message, ddgr_color color = -1);
bool AddLineToHUDMessages(char *temp_message, ddgr_color color) {
if (Num_hud_messages > 0 && !strcmp(temp_message, HUD_messages[Num_hud_messages - 1]))
return 0; // this is the same message as before, don't print it twice!
@ -464,7 +464,7 @@ bool AddLineToHUDMessages(char *temp_message, ddgr_color color) {
// Adds line, splitting if too long
// Returns true if line added
bool AddMultipleLinesToHUDMessages(char *temp_message, ddgr_color color = -1);
static bool AddMultipleLinesToHUDMessages(char *temp_message, ddgr_color color = -1);
bool AddMultipleLinesToHUDMessages(char *temp_message, ddgr_color color) {
char ourstr[HUD_MESSAGE_LENGTH * 2];
char *p;

View File

@ -1017,10 +1017,16 @@ bool Running_editor = false; // didn't we have a variable like this somewhere
static bool Init_in_editor = false;
// used to update load bar.
void SetInitMessageLength(const char *c, float amount); // portion of total bar to fill (0 to 1)
void UpdateInitMessage(float amount); // amount is 0 to 1
void SetupTempDirectory(void);
void DeleteTempFiles(void);
static void SetInitMessageLength(const char *c, float amount); // portion of total bar to fill (0 to 1)
extern void UpdateInitMessage(float amount); // amount is 0 to 1
static void SetupTempDirectory(void);
static void DeleteTempFiles(void);
static void PreGameCdCheck();
static void InitIOSystems(bool editor);
static void InitStringTable();
static void InitGraphics(bool editor);
static void InitGameSystems(bool editor);
static void InitDedicatedServer();
#define TEMPBUFFERSIZE 256
@ -1045,8 +1051,8 @@ extern int Use_file_xfer;
extern bool Mem_superlow_memory_mode;
const float kDefaultMouselookSensitivity = 9.102f;
const float kAnglesPerDegree = 65536.0f / 360.0f;
static const float kDefaultMouselookSensitivity = 9.102f;
static const float kAnglesPerDegree = 65536.0f / 360.0f;
int CD_inserted = 0;
float Mouselook_sensitivity = kAnglesPerDegree * kDefaultMouselookSensitivity;
float Mouse_sensitivity = 1.0f;
@ -1352,7 +1358,6 @@ void LoadGameSettings() {
Render_preferred_state.gamma = 1.5;
PreferredRenderer = RENDERER_NONE;
Sound_system.SetLLSoundQuantity(MIN_SOUNDS_MIXED + (MAX_SOUNDS_MIXED - MIN_SOUNDS_MIXED) / 2);
D3MusicSetVolume(0.5f);
Detail_settings.Pixel_error = 8.0;
@ -1546,9 +1551,9 @@ void LoadGameSettings() {
typedef struct {
const char *wildcard;
} tTempFileInfo;
tTempFileInfo temp_file_wildcards[] = {{"d3s*.tmp"}, {"d3m*.tmp"}, {"d3o*.tmp"},
{"d3c*.tmp"}, {"d3t*.tmp"}, {"d3i*.tmp"}};
int num_temp_file_wildcards = sizeof(temp_file_wildcards) / sizeof(tTempFileInfo);
static const tTempFileInfo temp_file_wildcards[] = {{"d3s*.tmp"}, {"d3m*.tmp"}, {"d3o*.tmp"},
{"d3c*.tmp"}, {"d3t*.tmp"}, {"d3i*.tmp"}};
static const int num_temp_file_wildcards = sizeof(temp_file_wildcards) / sizeof(tTempFileInfo);
/*
I/O systems initialization
@ -1647,14 +1652,14 @@ void InitIOSystems(bool editor) {
sys_hid = cf_OpenLibrary(fullname);
#endif
#endif
// JC: Steam release uses extra1.hog instead of extra.hog, so try loading it first
// Open this file if it's present for stuff we might add later
ddio_MakePath(fullname, LocalD3Dir, "extra1.hog", NULL);
extra_hid = cf_OpenLibrary(fullname);
if (extra_hid == 0) {
ddio_MakePath(fullname, LocalD3Dir, "extra.hog", NULL);
extra_hid = cf_OpenLibrary(fullname);
ddio_MakePath(fullname, LocalD3Dir, "extra.hog", NULL);
extra_hid = cf_OpenLibrary(fullname);
}
// JC: Steam release uses extra.hog instead of merc.hog, so try loading it last (so we don't conflict with the above)
@ -1662,8 +1667,8 @@ void InitIOSystems(bool editor) {
ddio_MakePath(fullname, LocalD3Dir, "merc.hog", NULL);
merc_hid = cf_OpenLibrary(fullname);
if (merc_hid == 0) {
ddio_MakePath(fullname, LocalD3Dir, "extra.hog", NULL);
merc_hid = cf_OpenLibrary(fullname);
ddio_MakePath(fullname, LocalD3Dir, "extra.hog", NULL);
merc_hid = cf_OpenLibrary(fullname);
}
// Open this for extra 1.3 code (Black Pyro, etc)
@ -1710,9 +1715,7 @@ void InitIOSystems(bool editor) {
}
// Returns true if Mercenary is installed (inits the Black Pyro and Red GB)
bool MercInstalled() {
return merc_hid > 0;
}
bool MercInstalled() { return merc_hid > 0; }
extern int Num_languages;
void InitStringTable() {
@ -2066,7 +2069,6 @@ void InitD3Systems1(bool editor) {
// Initialize a random seed.
ps_srand(time(nullptr));
// This function has to be done before any sound stuff is called
InitSounds();
@ -2325,8 +2327,7 @@ void DeleteTempFiles(void) {
if (ddio_FindFileStart(temp_file_wildcards[i].wildcard, filename)) {
do {
ddio_DeleteFile(filename);
}
while (ddio_FindNextFile(filename));
} while (ddio_FindNextFile(filename));
}
ddio_FindFileClose();
}
@ -2349,6 +2350,7 @@ static bool Init_ui_cursor_visible;
static bool Init_was_game_paused = false;
static pilot Init_old_pilot;
// TODO: MTS: Unused in project
void ShutdownD3() {
if (!Init_systems_init)
return;
@ -2392,6 +2394,7 @@ void ShutdownD3() {
ddio_Close();
}
// TODO: MTS: unused in project
// This function restarts all game systems
void RestartD3() {
ddio_init_info io_info;

View File

@ -64,33 +64,47 @@ typedef struct {
float Specular_tables[3][MAX_SPECULAR_INCREMENTS];
ushort *Dynamic_lightmap_memory = NULL;
float Light_component_scalar[32];
static ushort *Dynamic_lightmap_memory = NULL;
static float Light_component_scalar[32];
float Ubyte_to_float[256];
static ubyte Lmi_spoken_for[MAX_LIGHTMAP_INFOS / 8];
dynamic_lightmap *Dynamic_lightmaps;
dynamic_face Dynamic_face_list[MAX_DYNAMIC_FACES];
ushort Specular_face_list[MAX_DYNAMIC_FACES];
volume_object Dynamic_volume_object_list[MAX_VOLUME_OBJECTS];
dynamic_cell Dynamic_cell_list[MAX_DYNAMIC_CELLS];
int Specular_maps[NUM_DYNAMIC_CLASSES];
static dynamic_lightmap *Dynamic_lightmaps;
static dynamic_face Dynamic_face_list[MAX_DYNAMIC_FACES];
static ushort Specular_face_list[MAX_DYNAMIC_FACES];
static volume_object Dynamic_volume_object_list[MAX_VOLUME_OBJECTS];
static dynamic_cell Dynamic_cell_list[MAX_DYNAMIC_CELLS];
static int Specular_maps[NUM_DYNAMIC_CLASSES];
ushort Edges_to_blend[MAX_DYNAMIC_LIGHTMAPS];
int Num_edges_to_blend = 0;
static ushort Edges_to_blend[MAX_DYNAMIC_LIGHTMAPS];
static int Num_edges_to_blend = 0;
int Num_specular_faces = 0;
int Num_dynamic_faces = 0;
int Num_dynamic_lightmaps = 0;
int Cur_dynamic_mem_ptr = 0;
int Num_volume_objects = 0;
int Num_dynamic_cells = 0;
int Num_destroyed_lights_this_frame = 0;
static int Num_specular_faces = 0;
static int Num_dynamic_faces = 0;
static int Num_dynamic_lightmaps = 0;
static int Cur_dynamic_mem_ptr = 0;
static int Num_volume_objects = 0;
static int Num_dynamic_cells = 0;
static int Num_destroyed_lights_this_frame = 0;
#define MAX_DESTROYED_LIGHTS_PER_FRAME 20
int Destroyed_light_rooms_this_frame[MAX_DESTROYED_LIGHTS_PER_FRAME];
int Destroyed_light_faces_this_frame[MAX_DESTROYED_LIGHTS_PER_FRAME];
static int Destroyed_light_rooms_this_frame[MAX_DESTROYED_LIGHTS_PER_FRAME];
static int Destroyed_light_faces_this_frame[MAX_DESTROYED_LIGHTS_PER_FRAME];
static void FreeLighting();
static int GetFreeDynamicLightmap(int w, int h);
static void BlendLightingEdges(lightmap_info *lmi_ptr);
static void ApplyLightingToExternalRoom(vector *pos, int roomnum, float light_dist, float red_scale, float green_scale,
float blue_scale, vector *light_direction, float dot_range);
static void StartLightingInstance(vector *pos, matrix *orient);
static void DoneLightingInstance();
static void ApplyLightingToSubmodel(object *obj, poly_model *pm, bsp_info *sm, float light_dist, float red_scale,
float green_scale, float blue_scale, float dot_range);
static void ApplyVolumeLightToObject(vector *pos, object *obj, float light_dist, float red_scale, float green_scale,
float blue_scale, vector *light_direction, float dot_range);
static void ApplyLightingToObjects(vector *pos, int roomnum, float light_dist, float red_scale, float green_scale,
float blue_scale, vector *light_direction, float dot_range);
// Frees memory used by dynamic light structures
void FreeLighting() {
@ -1589,6 +1603,7 @@ void ApplyLightingToTerrain(vector *pos, int cellnum, float light_dist, float re
}
}
// TODO: MTS: Unused?
// Sets pulse parameters for an entire room
void SetRoomPulse(room *rp, ubyte pulse_time, ubyte pulse_offset) {
ASSERT(rp->used);
@ -1597,6 +1612,7 @@ void SetRoomPulse(room *rp, ubyte pulse_time, ubyte pulse_offset) {
rp->pulse_offset = pulse_offset;
}
// TODO: MTS: Unused?
// Returns the total number of bytes needed for volume lighting in this room
int GetVolumeSizeOfRoom(room *rp, int *w, int *h, int *d) {
int width = ((rp->max_xyz.x - rp->min_xyz.x) / VOLUME_SPACING) + 1;
@ -2206,6 +2222,7 @@ void DestroyLight(int roomnum, int facenum) {
}
}
// TODO: MTS: unused?
// Adds to our list of destroyable lights that got destroyed this frame
void AddToDestroyableLightList(int roomnum, int facenum) {
if (Num_destroyed_lights_this_frame >= MAX_DESTROYED_LIGHTS_PER_FRAME) {

View File

@ -35,6 +35,8 @@ lightmap_info *LightmapInfo = NULL;
static ushort *Free_lmi_list = NULL;
static void CloseLightmapInfos();
void CloseLightmapInfos() {
bool final_lightmap = true;
@ -191,6 +193,7 @@ int lmi_h(int handle) {
return (LightmapInfo[handle].height);
}
// TODO: MTS: unused?
// Softens the edges of lightmaps so there are fewer artifaces
void ShadeLightmapInfoEdges(int type) {
int i;
@ -322,6 +325,7 @@ void ShadeLightmapInfoEdges(int type) {
}
}
// TODO: MTS: unused?
// Blurs the lightmaps so a dithering pattern is less noticeable
void BlurLightmapInfos(int type) {
int i;

View File

@ -528,8 +528,8 @@ int main(int argc, char *argv[]) {
if (FindArg("-game_checksum")) {
extern tOSIRISModuleInit Osiris_module_init;
void Osiris_CreateModuleInitStruct(tOSIRISModuleInit * st);
unsigned int Osiris_CreateGameChecksum(void);
extern void Osiris_CreateModuleInitStruct(tOSIRISModuleInit * st);
extern unsigned int Osiris_CreateGameChecksum(void);
Osiris_CreateModuleInitStruct(&Osiris_module_init);
unsigned int checksum = Osiris_CreateGameChecksum();

View File

@ -219,11 +219,12 @@
#include <algorithm>
void PageInAllData();
extern void PageInAllData();
// dynamically allocated to be efficient (only needed during save/load)
int LGSSnapshot(CFILE *fp);
static int LGSSnapshot(CFILE *fp);
static void IncreaseRestoreCount(const char *file);
int Times_game_restored = 0;
// static gs_tables *gs_Xlates = NULL;
@ -614,6 +615,7 @@ int LGSRooms(CFILE *fp) {
return retval;
}
// TODO: MTS: unused?
// loads in and sets these events
int LGSEvents(CFILE *fp) {
int retval = LGS_OK;

View File

@ -710,7 +710,6 @@ bool MenuNewGame();
extern bool Mem_quick_exit;
bool IsRestoredGame = false;
//////////////////////////////////////////////////////////////////////////////
extern bool IsCheater;
extern bool Demo_looping;
extern bool Game_gauge_do_time_test;
extern char Game_gauge_usefile[_MAX_PATH];
@ -1075,7 +1074,7 @@ bool ProcessCommandLine() {
#define UID_MSNLB 100
#define UID_MSNINFO 0x1000
#define TRAINING_MISSION_NAME "Pilot Training"
inline int count_missions(const char *pathname, const char *wildcard) {
static inline int count_missions(const char *pathname, const char *wildcard) {
int c = 0;
char fullpath[_MAX_PATH];
char filename[PSPATHNAME_LEN];
@ -1107,8 +1106,8 @@ inline int count_missions(const char *pathname, const char *wildcard) {
}
return c;
}
inline int generate_mission_listbox(newuiListBox *lb, int n_maxfiles, char **filelist, const char *pathname,
const char *wildcard) {
static inline int generate_mission_listbox(newuiListBox *lb, int n_maxfiles, char **filelist, const char *pathname,
const char *wildcard) {
int c = 0;
char fullpath[_MAX_PATH];
char filename[PSPATHNAME_LEN];

View File

@ -701,7 +701,7 @@ typedef struct {
short multi_matrix[9];
} multi_orientation;
inline void MultiMatrixMakeEndianFriendly(multi_orientation *mmat) {
static inline void MultiMatrixMakeEndianFriendly(multi_orientation *mmat) {
for (int i = 0; i < 9; i++) {
mmat->multi_matrix[i] = INTEL_SHORT(mmat->multi_matrix[i]);
}

View File

@ -719,7 +719,7 @@ object *VALIDATE_OBJECT(int handle) {
}
return objp;
}
extern bool Hud_show_controls;
// Gets a value for the calling party
void msafe_GetValue(int type, msafe_struct *mstruct) {
object *objp;

View File

@ -496,19 +496,19 @@ private:
bool m_quick_escape_enable;
};
inline UISnazzyTextItem *MonitorSmallText(const char *text) {
static inline UISnazzyTextItem *MonitorSmallText(const char *text) {
return new UISnazzyTextItem(0, MONITOR9_NEWUI_FONT, text, NEWUI_MONITORFONT_COLOR);
}
inline UISnazzyTextItem *MonitorLargeText(const char *text) {
static inline UISnazzyTextItem *MonitorLargeText(const char *text) {
return new UISnazzyTextItem(0, MONITOR15_NEWUI_FONT, text, NEWUI_MONITORFONT_COLOR);
}
inline UISnazzyTextItem *GadgetSmallText(const char *text) {
static inline UISnazzyTextItem *GadgetSmallText(const char *text) {
return new UISnazzyTextItem(0, GADGET9_NEWUI_FONT, text, NEWUI_GADGETFONT_COLOR);
}
inline UISnazzyTextItem *GadgetLargeText(const char *text) {
static inline UISnazzyTextItem *GadgetLargeText(const char *text) {
return new UISnazzyTextItem(0, GADGET15_NEWUI_FONT, text, NEWUI_GADGETFONT_COLOR);
}

View File

@ -705,8 +705,8 @@ extern short BigObjectList[MAX_BIG_OBJECTS]; // DAJ_MR utb int
*/
// Set the dead flag for an object
void SetObjectDeadFlag(object *obj, bool tell_clients_to_remove = false, bool play_sound_on_clients = false);
inline void SetObjectDeadFlag(object *obj, bool tell_clients_to_remove, bool play_sound_on_clients) {
static inline void SetObjectDeadFlag(object *obj, bool tell_clients_to_remove = false, bool play_sound_on_clients = false);
static inline void SetObjectDeadFlag(object *obj, bool tell_clients_to_remove, bool play_sound_on_clients) {
int objnum = OBJNUM(obj);
ASSERT(objnum != -1);
ASSERT(objnum != 0);

View File

@ -119,26 +119,27 @@
#include "cfile.h"
extern uint Osiris_game_checksum;
extern tOSIRISModuleInit Osiris_module_init;
// Osiris_InitModuleLoader
// Purpose:
// Initializes the OSIRIS module loader and handling system
void Osiris_InitModuleLoader(void);
extern void Osiris_InitModuleLoader(void);
// Osiris_FreeModule
// Purpose:
// Removes a currently loaded module from the OSIRIS system
void Osiris_FreeModule(int id);
extern void Osiris_FreeModule(int id);
// Osiris_ShutdownModuleLoader
// Purpose:
// Closes down the OSIRIS module loader and handling system
void Osiris_ShutdownModuleLoader(void);
extern void Osiris_ShutdownModuleLoader(void);
// Osiris_FindLoadedModule
// Purpose:
// Given the name of a module, it returns the id of a loaded OSIRIS module. -1 if it isn't loaded.
int Osiris_FindLoadedModule(char *filename);
extern int Osiris_FindLoadedModule(char *filename);
// Osiris_LoadLevelModule
// Purpose:
@ -147,14 +148,14 @@ int Osiris_FindLoadedModule(char *filename);
// before calling this function, it will return the id to where the module is, and will not reload
// the module. Returns -1 if the module does not exist. Returns -2 if the module couldn't initialize.
// Returns -3 if the module is not a level module. Returns -4 if no module slots are available.
int Osiris_LoadLevelModule(char *module_name);
extern int Osiris_LoadLevelModule(char *module_name);
// Osiris_UnloadLevelModule
// Purpose:
// Instead of saving the handle returned from Osiris_LoadLevelModule() and calling
// Osiris_UnloadModule() with that handle, you can just call this, instead of the call
// to Osiris_UnloadModule().
void Osiris_UnloadLevelModule(void);
extern void Osiris_UnloadLevelModule(void);
// Osiris_LoadGameModule
// Purpose:
@ -163,13 +164,13 @@ void Osiris_UnloadLevelModule(void);
// before calling this function, it will return the id to where the module is, and will not reload
// the module. Returns -1 if the module does not exist. Returns -2 if the module couldn't initialize.
// Returns -3 if the module is not a game module. Returns -4 if no module slots are available.
int Osiris_LoadGameModule(char *module_name);
extern int Osiris_LoadGameModule(char *module_name);
// Osiris_UnloadModule
// Purpose:
// Given a module id, it will decrement the reference count to that module by one. If the reference
// count becomes zero, the module will be unloaded from memory.
void Osiris_UnloadModule(int module_id);
extern void Osiris_UnloadModule(int module_id);
// Osiris_LoadMissionModule
// Purpose:
@ -180,14 +181,14 @@ void Osiris_UnloadModule(int module_id);
// Returns -3 if the module is not a game module. Returns -4 if no module slots are available.
// This technically doesn't load a mission module, as it should already be loaded by
// Descent 3 prior.
int Osiris_LoadMissionModule(module *module_handle, const char *filename);
extern int Osiris_LoadMissionModule(module *module_handle, const char *filename);
// Osiris_UnloadMissionModule
// Purpose:
// Instead of saving the handle returned from Osiris_LoadMissionModule() and calling
// Osiris_UnloadModule() with that handle, you can just call this, instead of the call
// to Osiris_UnloadModule().
void Osiris_UnloadMissionModule(void);
extern void Osiris_UnloadMissionModule(void);
// Osiris_BindScriptsToObject
// Purpose:
@ -196,13 +197,13 @@ void Osiris_UnloadMissionModule(void);
// to make sure that all fields have been filled in. This function does not call any events.
// This function will also load any dll's needed for it's game script.
// returns false if nothing was bound.
bool Osiris_BindScriptsToObject(object *obj);
extern bool Osiris_BindScriptsToObject(object *obj);
// Osiris_DetachScriptsFromObject
// Purpose:
// Call this function when an object is about to be destroyed. This will unbind and remove
// all scripts associated with that object. This function does not call any events.
void Osiris_DetachScriptsFromObject(object *obj);
extern void Osiris_DetachScriptsFromObject(object *obj);
// Osiris_CallEvent
// Purpose:
@ -211,107 +212,107 @@ void Osiris_DetachScriptsFromObject(object *obj);
// object (as long as they are available) in the order: custom script, level script,
// mission script, and finally it's default script. The chain breaks if one of the scripts
// returns false on the call to their CallInstanceEvent().
bool Osiris_CallEvent(object *obj, int event, tOSIRISEventInfo *data);
extern bool Osiris_CallEvent(object *obj, int event, tOSIRISEventInfo *data);
// Osiris_CallLevelEvent
// Purpose:
// Triggers an event for a level script. Returns true if the default action should continue
// to process.
bool Osiris_CallLevelEvent(int event, tOSIRISEventInfo *data);
extern bool Osiris_CallLevelEvent(int event, tOSIRISEventInfo *data);
// Osiris_CallTriggerEvent
// Purpose:
// Triggers an event for a trigger script. Returns true if the default action should continue
// to process.
bool Osiris_CallTriggerEvent(int trignum, int event, tOSIRISEventInfo *ei);
extern bool Osiris_CallTriggerEvent(int trignum, int event, tOSIRISEventInfo *ei);
// Osiris_ProcessTimers
// Purpose:
// This function checks all timers currently running, if any need to be signaled it signals them.
void Osiris_ProcessTimers(void);
extern void Osiris_ProcessTimers(void);
// Osiris_CreateTimer
// Pupose:
// Adds a timer to the list to be processed. You'll receive a EVT_TIMER when the timer is signaled.
// Returns an id to the timer, which can be used to cancel a timer. -1 on error.
int Osiris_CreateTimer(tOSIRISTIMER *ot);
extern int Osiris_CreateTimer(tOSIRISTIMER *ot);
// Osiris_ResetAllTimers
// Purpose:
// Flushes all the timers
void Osiris_ResetAllTimers(void);
extern void Osiris_ResetAllTimers(void);
// Osiris_CancelTimer
// Purpose:
// Cancels a timer thats in use, given it's ID
void Osiris_CancelTimer(int handle);
extern void Osiris_CancelTimer(int handle);
// Osiris_TimerExists
// Purpose:
// Returns true if the timer is valid
ubyte Osiris_TimerExists(int handle);
extern ubyte Osiris_TimerExists(int handle);
// Osiris_SaveSystemState
// Purpose:
// Saves the current state of the system (not the scripts!) to file
void Osiris_SaveSystemState(CFILE *file);
extern void Osiris_SaveSystemState(CFILE *file);
// Osiris_RestoreSystemState
// Purpose:
// Restore the state of the system from file (does not restore scripts!)
bool Osiris_RestoreSystemState(CFILE *file);
extern bool Osiris_RestoreSystemState(CFILE *file);
// Osiris_InitMemoryManager
// Purpose:
// Initializes the memory manager for the scripts, for buffers that the scripts want
// automatically restored/save.
void Osiris_InitMemoryManager(void);
extern void Osiris_InitMemoryManager(void);
// Osiris_CloseMemoryManager
// Purpose:
// Shuts down the Osiris memory manager, freeing any unfreed memory
void Osiris_CloseMemoryManager(void);
extern void Osiris_CloseMemoryManager(void);
// Osiris_AllocateMemory
// Purpose:
// Allocates a chunk of memory to be associated with a script. It will automatically
// save this memory to disk on game save, and will pass the pointer to this memory on EVT_RESTORE
void *Osiris_AllocateMemory(tOSIRISMEMCHUNK *mc);
extern void *Osiris_AllocateMemory(tOSIRISMEMCHUNK *mc);
// Osiris_FreeMemory
// Purpose:
// Frees a chunk of memory that was allocated by Osiris_AllocateMemory().
void Osiris_FreeMemory(void *mem_ptr);
extern void Osiris_FreeMemory(void *mem_ptr);
// Osiris_FreeMemoryForScript
// Purpose:
// Frees all memory allocated for a given script
void Osiris_FreeMemoryForScript(tOSIRISSCRIPTID *sid);
extern void Osiris_FreeMemoryForScript(tOSIRISSCRIPTID *sid);
// Osiris_RestoreMemoryChunks
// Purpose:
// Restores the 'auto manage' from file, calls the EVT_MEMRESTORE
void Osiris_RestoreMemoryChunks(CFILE *file);
extern void Osiris_RestoreMemoryChunks(CFILE *file);
// Osiris_SaveMemoryChunks
// Purpose:
// Saves out the 'auto manage' script memory to file
void Osiris_SaveMemoryChunks(CFILE *file);
extern void Osiris_SaveMemoryChunks(CFILE *file);
// Osiris_ExtractScriptsFromHog
// Given the handle of a loaded hog file, this extracts all the scripts out to a temp directory
// Pass false for the second parameter if it's a game hog (d3.hog for example)
int Osiris_ExtractScriptsFromHog(int library_handle, bool is_mission_hog = true);
extern int Osiris_ExtractScriptsFromHog(int library_handle, bool is_mission_hog = true);
// Osiris_ClearExtractedScripts
// Deletes the temp files created when the scripts where extracted from the hog
// Pass false if you want it to remove _all_ extracted hogs...else only mission related ones
void Osiris_ClearExtractedScripts(bool misson_only = true);
extern void Osiris_ClearExtractedScripts(bool misson_only = true);
// Initializes the Osiris Mission Memory System
void Osiris_InitOMMS(void);
extern void Osiris_InitOMMS(void);
// Shutsdown the Osiris Mission Memory System (frees all memory associated, call at end of mission)
void Osiris_CloseOMMS(void);
extern void Osiris_CloseOMMS(void);
extern bool Show_osiris_debug;
@ -321,22 +322,22 @@ extern bool Show_osiris_debug;
// Osiris_EnableEvents
// Purpose:
// Enables the passed in mask of event types to be called
void Osiris_EnableEvents(ubyte mask);
extern void Osiris_EnableEvents(ubyte mask);
// Osiris_DisableEvents
// Purpose:
// Disables the passed in mask of event types
void Osiris_DisableEvents(ubyte mask);
extern void Osiris_DisableEvents(ubyte mask);
// Osiris_DisableCreateEvents
// Purpose:
// Disables any events involved when an object is created. This is to be used for
// Loading games/viewing demos, as so not to re-initialize good data.
void Osiris_DisableCreateEvents(void);
extern void Osiris_DisableCreateEvents(void);
// Osiris_EnablesCreateEvents
// Purpose:
// Enables any events involved when an object is created. This is to be used for
// Loading games/viewing demos, as so not to re-initialize good data. (call when done with
// Osiris_DisableCreateEvents())
void Osiris_EnableCreateEvents(void);
extern void Osiris_EnableCreateEvents(void);
#endif

View File

@ -1529,8 +1529,6 @@ void NewPltUpdate(newuiListBox *list, char **flist, int filecount, int selected,
// updates the current pilot's information (level played, mission played, etc)
// call after every successful mission completion
extern bool IsCheater;
extern int Default_ship_permission;
void CurrentPilotUpdateMissionStatus(bool just_add_data) {
// Don't update if it's a multiplayer game
if (Game_mode & GM_MULTI)

View File

@ -149,11 +149,11 @@
#define __PILOT_H_ // don't want to include pilot.h right now
#include "difficulty.h"
#include "audiotaunts.h"
#include <algorithm>
void grtext_SetProfanityFilter(bool enabled);
void taunt_Enable(bool enable);
extern void grtext_SetProfanityFilter(bool enabled);
extern float Key_ramp_speed;

View File

@ -432,6 +432,9 @@ extern bool Player_has_camera;
extern int Player_camera_objnum;
extern uint Players_typing; // information about which players are typing messages (to display an icon)
extern float Player_shields_saved_from_last_level;
extern float Player_energy_saved_from_last_level;
// How long a player must be dead before he can respawn
#define DEATH_RESPAWN_TIME 3.0f
extern float Total_time_dead;
@ -574,7 +577,7 @@ void MakeAtuoWaypointList();
void SetAutoWaypoint(object *objp);
// Returns the team (0 to 3) of the given player
inline int PlayerGetTeam(int pnum) {
static inline int PlayerGetTeam(int pnum) {
if (Players[pnum].team == -1) {
// special "no-team" for Dedicated server
return 0; // fake a red team

View File

@ -82,7 +82,7 @@ const char *ProcNames[] = {"None", "Line Lightning", "Sphere lightning", "St
const char *WaterProcNames[] = {"None", "Height blob", "Sine Blob", "Random Raindrops", "Random Blobdrops", "END"};
static ubyte *ProcDestData;
int pholdrand = 1;
inline int prand() { return (((pholdrand = pholdrand * 214013L + 2531011L) >> 16) & 0x7fff); }
static inline int prand() { return (((pholdrand = pholdrand * 214013L + 2531011L) >> 16) & 0x7fff); }
// Given an array of r,g,b values, generates a 16bit palette table for those colors
void GeneratePaletteForProcedural(ubyte *r, ubyte *g, ubyte *b, ushort *pal) {
int i;
@ -478,7 +478,7 @@ void AddProcPoint(int x, int y, ubyte color) {
ProcDestData[index] = color;
}
// Adds one point to a bitmap
inline void PlaceProcPoint(int x, int y, ubyte color) {
static inline void PlaceProcPoint(int x, int y, ubyte color) {
x &= (PROC_SIZE - 1);
y &= (PROC_SIZE - 1);
ProcDestData[y * PROC_SIZE + x] = color;

View File

@ -216,7 +216,7 @@ int Num_mirror_rooms = 0;
// Determines if a face renders
// Parameters: rp - pointer to room that contains the face
// fp - pointer to the face in question
inline bool FaceIsRenderable(room *rp, face *fp) {
static inline bool FaceIsRenderable(room *rp, face *fp) {
// Check for a floating trigger, which doesn't get rendered
if ((fp->flags & FF_FLOATING_TRIG) && (!In_editor_mode || !Render_floating_triggers))
return 0;
@ -241,7 +241,7 @@ inline bool FaceIsRenderable(room *rp, face *fp) {
// bm_handle - the handle for the bitmap for this frame, or -1 if don't care about
// transparence Returns: bitmask describing the alpha blending for the face
// the return bits are the ATF_ flags in renderer.h
inline int GetFaceAlpha(face *fp, int bm_handle) {
static inline int GetFaceAlpha(face *fp, int bm_handle) {
int ret = AT_ALWAYS;
if (GameTextures[fp->tmap].flags & TF_SATURATE) {
ret = AT_SATURATE_TEXTURE;
@ -260,7 +260,7 @@ inline int GetFaceAlpha(face *fp, int bm_handle) {
// Parameters: rp - the room the portal is in
// pp - the portal we're checking
// Returns: true if you should render the room to which the portal connects
inline bool RenderPastPortal(room *rp, portal *pp) {
static inline bool RenderPastPortal(room *rp, portal *pp) {
// If we don't render the portal's faces, then we see through it
if (!(pp->flags & PF_RENDER_FACES))
return 1;
@ -357,7 +357,7 @@ struct clip_wnd {
float left, top, right, bot;
};
inline int clip2d(g3Point *pnt, clip_wnd *wnd) {
static inline int clip2d(g3Point *pnt, clip_wnd *wnd) {
int ret = 0;
if (pnt->p3_codes & CC_BEHIND)
return CC_BEHIND;
@ -374,7 +374,7 @@ inline int clip2d(g3Point *pnt, clip_wnd *wnd) {
}
// Returns true if a line intersects another line
inline bool LineIntersectsLine(g3Point *ls, g3Point *le, float x1, float y1, float x2, float y2) {
static inline bool LineIntersectsLine(g3Point *ls, g3Point *le, float x1, float y1, float x2, float y2) {
float num, denom;
num = ((ls->p3_sy - y1) * (x2 - x1)) - ((ls->p3_sx - x1) * (y2 - y1));
denom = ((le->p3_sx - ls->p3_sx) * (y2 - y1)) - ((le->p3_sy - ls->p3_sy) * (x2 - x1));
@ -389,7 +389,7 @@ inline bool LineIntersectsLine(g3Point *ls, g3Point *le, float x1, float y1, flo
return false;
}
// Returns true if a face intersects the passed in portal in any way
inline bool FaceIntersectsPortal(room *rp, face *fp, clip_wnd *wnd) {
static inline bool FaceIntersectsPortal(room *rp, face *fp, clip_wnd *wnd) {
g3Codes cc;
int i;
@ -3025,7 +3025,7 @@ static int obj_sort_func(const obj_sort_item *a, const obj_sort_item *b) {
else
return 0;
}
inline void IsRoomDynamicValid(room *rp, int x, int y, int z, float *r, float *g, float *b) {
static inline void IsRoomDynamicValid(room *rp, int x, int y, int z, float *r, float *g, float *b) {
int w = rp->volume_width;
int h = rp->volume_height;
int d = rp->volume_depth;

View File

@ -760,7 +760,7 @@ static void DrawNumber(int num, vector pos, float size, ddgr_color c1) {
}
}
}
inline bool object_object_AABB(object *obj1, object *obj2) {
static inline bool object_object_AABB(object *obj1, object *obj2) {
bool overlap = true;
if (obj1->max_xyz.x < obj2->min_xyz.x || obj2->max_xyz.x < obj1->min_xyz.x || obj1->max_xyz.z < obj2->min_xyz.z ||
obj2->max_xyz.z < obj1->min_xyz.z || obj1->max_xyz.y < obj2->min_xyz.y || obj2->max_xyz.y < obj1->min_xyz.y)
@ -856,7 +856,7 @@ void ComputeDebugVisFaceUpperLeft(room *rp, face *fp, vector *upper_left, float
*upper_left = rot_vert + avg_vert;
*center = avg_vert;
}
extern uint check_point_to_face(vector *colp, vector *face_normal, int nv, vector **vertex_ptr_list);
#define VIS_TABLE_RESOLUTION 6
void DrawRoomVisPnts(object *obj) {
int roomnum = obj->roomnum;

View File

@ -515,7 +515,7 @@ int CheckTransparentPoint(const vector *pnt, const room *rp, const int facenum);
// Parameters: rp - pointer to the room the face is in
// fp - the face we're interested in
// Returns: bitmask of flags (see above).
inline int GetFacePhysicsFlags(const room *rp, const face *fp) {
static inline int GetFacePhysicsFlags(const room *rp, const face *fp) {
int ret = 0;
// If face is a trigger, must record

View File

@ -142,9 +142,9 @@
#define MAX_SPEWS_PER_FRAME 5 // maximum number of spews 1 can emit per frame
inline int FORM_HANDLE(int counter, int slot) { return (((counter & 0xFF) << 16) + (slot & 0xFF)); }
static inline int FORM_HANDLE(int counter, int slot) { return (((counter & 0xFF) << 16) + (slot & 0xFF)); }
inline int GET_SLOT(int handle) { return (handle & 0xFF); }
static inline int GET_SLOT(int handle) { return (handle & 0xFF); }
spewinfo SpewEffects[MAX_SPEW_EFFECTS];
int spew_count;
@ -494,4 +494,4 @@ bool SpewObjectNeedsEveryFrameUpdate(object *obj, int gun_num) {
}
return false;
}
}

View File

@ -216,7 +216,7 @@ extern short Terrain_seg_render_objs[];
#ifdef RELEASE
#define TERRAIN_REGION(x) ((Terrain_seg[0x7FFFFFFF & x].flags & TFM_REGION_MASK) >> 5)
#else // debug(-ish) builds - check if x is valid
inline int TERRAIN_REGION(int x) {
static inline int TERRAIN_REGION(int x) {
ASSERT(x != -1 && "invalid/unset room number (-1)!");
// Note: due to the 0x7FFFFFFF mask, terrSegIdx will be >= 0
int terrSegIdx = 0x7FFFFFFF & x;

View File

@ -886,7 +886,7 @@ void SelectSecondaryWeapon(int slot);
void SetPrimaryWeapon(int index, int slot);
void SetSecondaryWeapon(int index, int slot);
inline bool is_weapon_available(unsigned player_weapon_flags, int new_weapon, ushort ammo = 0xffff) {
static inline bool is_weapon_available(unsigned player_weapon_flags, int new_weapon, ushort ammo = 0xffff) {
return ((player_weapon_flags & HAS_FLAG(new_weapon)) && ammo > 0) ? true : false;
}

View File

@ -417,7 +417,7 @@ void WeaponDoFrame(object *obj);
bool WeaponCalcGun(vector *gun_point, vector *gun_normal, object *obj, int gun_num);
// Checks for relation between weapons and other objects
bool ObjectsAreRelated(int o1, int o2);
extern bool ObjectsAreRelated(int o1, int o2);
// A quick way to see where a weapon hits. Weapons make debris.
void CreateWeaponDebris(object *obj);

View File

@ -332,12 +332,16 @@ typedef struct bm_Node_ {
struct bm_Node_ *next; /* next bm_Node */
bm_T data; /* data stored in bm_Node */
} bm_Node;
bm_Node *bm_findNode(bm_T data);
void bm_deleteNode(bm_T data);
bm_Node *bm_insertNode(bm_T data);
bm_hashTableIndex bm_hash(bm_T data);
bm_Node **bm_hashTable = NULL;
int bm_hashTableSize = (MAX_BITMAPS / 2);
static bm_Node *bm_findNode(bm_T data);
static void bm_deleteNode(bm_T data);
static bm_Node *bm_insertNode(bm_T data);
static bm_hashTableIndex bm_hash(bm_T data);
static bm_Node **bm_hashTable = NULL;
static const int bm_hashTableSize = (MAX_BITMAPS / 2);
static void bm_InitHashTable();
static void bm_DeleteHashTable();
static int bm_TestName(const char *src);
void bm_InitHashTable() {
bm_hashTable = (bm_Node **)mem_malloc(bm_hashTableSize * sizeof(bm_Node *));
for (int a = 0; a < bm_hashTableSize; a++) {

View File

@ -24,11 +24,11 @@
#include "mono.h"
#include "mem.h"
int Num_of_bumpmaps = 0;
static int Num_of_bumpmaps = 0;
static ushort Free_bumpmap_list[MAX_BUMPMAPS];
bms_bumpmap GameBumpmaps[MAX_BUMPMAPS];
int Bumpmap_mem_used = 0;
static int Bumpmap_mem_used = 0;
// Sets all the bumpmaps to unused
void bump_InitBumpmaps() {
@ -126,4 +126,4 @@ ubyte bump_w(int handle) {
ubyte bump_h(int handle) {
ASSERT(GameBumpmaps[handle].flags & BUMPF_USED);
return GameBumpmaps[handle].height;
}
}

View File

@ -130,6 +130,21 @@ short iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is val
#define IFF_SIG_DELTA 9
#define IFF_SIG_ANHD 10
static int bm_iff_get_sig(CFILE *f);
static int bm_iff_parse_bmhd(CFILE *ifile, uint len, iff_bitmap_header *bmheader);
/// the buffer pointed to by raw_data is stuffed with a pointer to decompressed pixel data
static int bm_iff_parse_body(CFILE *ifile, int len, iff_bitmap_header *bmheader);
/// the buffer pointed to by raw_data is stuffed with a pointer to bitplane pixel data
static void bm_iff_skip_chunk(CFILE *ifile, uint len);
/// modify passed bitmap
static int bm_iff_parse_delta(CFILE *ifile, int len, iff_bitmap_header *bmheader);
static int bm_iff_parse_file(CFILE *ifile, iff_bitmap_header *bmheader, iff_bitmap_header *prev_bm);
static void bm_iff_convert_8_to_16(int dest_bm, iff_bitmap_header *iffbm);
int bm_iff_get_sig(CFILE *f) {
char s[4];
int i;

View File

@ -30,10 +30,10 @@
#include <algorithm>
int Num_of_lightmaps = 0;
static int Num_of_lightmaps = 0;
static ushort Free_lightmap_list[MAX_LIGHTMAPS];
bms_lightmap GameLightmaps[MAX_LIGHTMAPS];
int Lightmap_mem_used = 0;
static int Lightmap_mem_used = 0;
// Sets all the lightmaps to unused
void lm_InitLightmaps() {
int i;
@ -144,4 +144,4 @@ ushort *lm_data(int handle) {
d = GameLightmaps[handle].data;
return (d);
}
}

View File

@ -62,9 +62,9 @@
#include <stdlib.h>
// load an 8bit pcx image
int bm_pcx_8bit_alloc_file(CFILE *infile);
static int bm_pcx_8bit_alloc_file(CFILE *infile);
// load a 24bit pcx image
int bm_pcx_24bit_alloc_file(CFILE *infile);
static int bm_pcx_24bit_alloc_file(CFILE *infile);
// Loads a pcx file and converts it to 16 bit. Returns bitmap handle or -1 on error
int bm_pcx_alloc_file(CFILE *infile) {
@ -313,4 +313,4 @@ int bm_pcx_24bit_alloc_file(CFILE *infile) {
mem_free(rawdata);
return src_bm; // success!
}
}

View File

@ -142,13 +142,20 @@
#include "byteswap.h"
#include <string.h>
#include "mem.h"
#include "gamesequence.h"
#include <stdlib.h>
char *Tga_file_data = NULL;
int Fake_pos = 0;
int Bad_tga = 0;
int Fake_file_size = 0;
static char *Tga_file_data = NULL;
static int Fake_pos = 0;
static int Bad_tga = 0;
static int Fake_file_size = 0;
static inline char tga_read_byte();
static inline int tga_read_int();
static inline short tga_read_short();
static ushort bm_tga_translate_pixel(int pixel, int format);
static int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int type);
inline char tga_read_byte() {
// Check for bad file
@ -591,8 +598,6 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) {
return (n);
}
extern int paged_in_count;
extern int paged_in_num;
// Pages in bitmap index n. Returns 1 if successful, 0 if not
int bm_page_in_file(int n) {
ubyte image_id_len, color_map_type, image_type, pixsize, descriptor;

View File

@ -92,7 +92,10 @@ void ThrowCFileError(int type, CFILE *file, const char *msg) {
throw &cfe;
}
void cf_Close();
static void cf_Close();
// searches through the open HOG files, and opens a file if it finds it in any of the libs
static CFILE *open_file_in_lib(const char *filename);
// Opens a HOG file. Future calls to cfopen(), etc. will look in this HOG.
// Parameters: libname - the path & filename of the HOG file
@ -344,7 +347,7 @@ CFILE *cf_OpenFileInLibrary(const char *filename, int libhandle) {
}
cfile = (CFILE *)mem_malloc(sizeof(*cfile));
if (!cfile)
Error("Out of memory in open_file_in_lib()");
Error("Out of memory in cf_OpenFileInLibrary()");
cfile->name = lib->entries[i].name;
cfile->file = fp;
cfile->lib_handle = lib->handle;
@ -483,6 +486,9 @@ void CFindFiles::Close() {
globfree(&ffres);
}
static FILE *open_file_in_directory_case_sensitive(const char *directory, const char *filename, const char *mode,
char *new_filename);
bool cf_FindRealFileNameCaseInsenstive(const char *directory, const char *fname, char *new_filename) {
bool use_dir = false;
char dir_to_use[_MAX_PATH];
@ -637,6 +643,9 @@ FILE *open_file_in_directory_case_sensitive(const char *directory, const char *f
}
#endif
// look for the file in the specified directory
static CFILE *open_file_in_directory(const char *filename, const char *mode, const char *directory);
// look for the file in the specified directory
CFILE *open_file_in_directory(const char *filename, const char *mode, const char *directory) {
FILE *fp;
@ -880,10 +889,11 @@ int cfexist(const char *filename) {
int ret;
cfp = cfopen(filename, "rb");
if (!cfp) { // Didn't get file. Why?
if (errno == EACCES) // File exists, but couldn't open it
if (!cfp) { // Didn't get file. Why?
if (errno == EACCES) // File exists, but couldn't open it
return CFES_ON_DISK; // so say it exists on the disk
// DAJ if (errno != ENOENT) //Check if error is "file not found"
// DAJ if (errno != ENOENT) //Check if error is "file not
// found"
// DAJ Int3(); //..warn if not
return CFES_NOT_FOUND; // Say we didn't find the file
}

View File

@ -40,8 +40,8 @@
#define MUSICAIF_NEWREGION 0x40
// names of themes. (match to music.h THEME_TYPES)
const char *Music_type_names[] = {"No song", "Intro song", "Idle song", "Combat song",
"Death song", "Idle-Combat song", "Combat-Idle song"};
const char *const Music_type_names[] = {"No song", "Intro song", "Idle song", "Combat song",
"Death song", "Idle-Combat song", "Combat-Idle song"};
// global data
#ifdef _DEBUG
@ -68,10 +68,10 @@ static struct {
} MusicAI;
// handles operations on current events.
void D3MusicSongSelector();
static void D3MusicSongSelector();
// creates music ai struction from music info passed in.
void D3MusicAI(tMusicSeqInfo *music_info);
static void D3MusicAI(tMusicSeqInfo *music_info);
///////////////////////////////////////////////////////////////////////////////

View File

@ -28,14 +28,14 @@
#define MAX_WRITE_AHEAD 0.04f // Seconds to write ahead of the play position (in seconds)
#define VOLUME_FIX_BITS 1024
inline void opti_8m_mix(unsigned char *cur_sample_8bit, const int num_write, int &samples_played, short *mixer_buffer16,
const float l_volume, const float r_volume);
inline void opti_8s_mix(unsigned char *cur_sample_8bit, const int num_write, int &samples_played, short *mixer_buffer16,
const float l_volume, const float r_volume);
inline void opti_16m_mix(short *cur_sample_16bit, const int num_write, int &samples_played, short *mixer_buffer16,
const float l_volume, const float r_volume);
inline void opti_16s_mix(short *cur_sample_16bit, const int num_write, int &samples_played, short *mixer_buffer16,
const float l_volume, const float r_volume);
static inline void opti_8m_mix(unsigned char *cur_sample_8bit, const int num_write, int &samples_played,
short *mixer_buffer16, const float l_volume, const float r_volume);
static inline void opti_8s_mix(unsigned char *cur_sample_8bit, const int num_write, int &samples_played,
short *mixer_buffer16, const float l_volume, const float r_volume);
static inline void opti_16m_mix(short *cur_sample_16bit, const int num_write, int &samples_played,
short *mixer_buffer16, const float l_volume, const float r_volume);
static inline void opti_16s_mix(short *cur_sample_16bit, const int num_write, int &samples_played,
short *mixer_buffer16, const float l_volume, const float r_volume);
software_mixer::software_mixer() {
m_init = false;

View File

@ -102,6 +102,7 @@
#include "pserror.h"
#include <string.h>
#include "byteswap.h"
#include "gamesequence.h"
sound_info Sounds[MAX_SOUNDS];
sound_file_info SoundFiles[MAX_SOUND_FILES];
@ -113,8 +114,6 @@ sound_file_info SoundFiles[MAX_SOUND_FILES];
#define SND_LOAD_ERROR_NO_FILE 0
#define SND_LOAD_ERROR_INVALID 1
extern int paged_in_count;
extern int paged_in_num;
char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_file_index, bool f_high_quality,
bool f_load_sample_data, int *e_type) {

View File

@ -50,7 +50,7 @@
bool Debug_break = false;
bool Debug_mono = false;
char *Debug_DumpInfo();
static char *Debug_DumpInfo();
// if we are running under a debugger, then pass true
bool Debug_Init(bool debugger, bool mono_debug) {

Some files were not shown because too many files have changed in this diff Show More