mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 07:28:22 -10:00
Portej05's preFAST warning fixes.
This commit is contained in:
1 parent
d599cc1d6b
commit
a4e623db23
32 files changed
+104
-100
No files matched your search
@@ -280,13 +280,13 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
// represented in fractions of F1_0
|
||||
if (optional_string("$Predict Position Delay:"))
|
||||
{
|
||||
int i;
|
||||
int iLoop;
|
||||
float temp_list[NUM_SKILL_LEVELS];
|
||||
|
||||
parse_float_list(temp_list, NUM_SKILL_LEVELS);
|
||||
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++)
|
||||
profile->predict_position_delay[i] = fl2f(temp_list[i]);
|
||||
for (iLoop = 0; iLoop < NUM_SKILL_LEVELS; iLoop++)
|
||||
profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
|
||||
}
|
||||
|
||||
if (optional_string("$Player Shield Recharge Scale:"))
|
||||
|
||||
+1
-1
@@ -6303,7 +6303,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
//made it so it only selects puncture weapons if the active goal is to disable something -Bobboau
|
||||
if ((flags & WIF_PUNCTURE) && (Ai_info[shipp->ai_index].goals[0].ai_mode & AI_GOAL_DISARM_SHIP | AI_GOAL_DISABLE_SHIP))
|
||||
if ((flags & WIF_PUNCTURE) && (Ai_info[shipp->ai_index].goals[0].ai_mode & (AI_GOAL_DISARM_SHIP | AI_GOAL_DISABLE_SHIP)))
|
||||
// if (flags & WIF_PUNCTURE)
|
||||
{
|
||||
if (swp->current_primary_bank >= 0)
|
||||
|
||||
+1
-1
@@ -1826,7 +1826,7 @@ void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int imme
|
||||
int i;
|
||||
|
||||
// be sure we are not trying to issue dock or undock goals to wings
|
||||
Assert ( (goal_type != AI_GOAL_DOCK) || (goal_type != AI_GOAL_UNDOCK) );
|
||||
Assert ( (goal_type != AI_GOAL_DOCK) && (goal_type != AI_GOAL_UNDOCK) );
|
||||
|
||||
for (i = 0; i < wingp->current_count; i++) {
|
||||
int num = wingp->ship_index[i];
|
||||
|
||||
@@ -527,7 +527,7 @@ int asteroid_obj_list_add(int objnum)
|
||||
index = cur_asteroid - Asteroids;
|
||||
|
||||
Assert(index >= 0 && index < MAX_ASTEROID_OBJS);
|
||||
Assert(!Asteroid_objs[index].flags & ASTEROID_OBJ_USED);
|
||||
Assert(!(Asteroid_objs[index].flags & ASTEROID_OBJ_USED));
|
||||
|
||||
Asteroid_objs[index].flags = 0;
|
||||
Asteroid_objs[index].objnum = objnum;
|
||||
|
||||
@@ -1058,7 +1058,7 @@ void EndAutoPilot()
|
||||
{
|
||||
for (j = 0; j < MAX_AI_GOALS; j++)
|
||||
{
|
||||
ai_goal *aigp = &Wings[i].ai_goals[j];
|
||||
ai_goal *aigp = &Wings[Ships[i].wingnum].ai_goals[j];
|
||||
|
||||
if ( ((aigp->ship_name != NULL) && !stricmp(aigp->ship_name, goal_name))
|
||||
&& (aigp->ai_mode == goal) )
|
||||
@@ -1678,7 +1678,7 @@ unsigned int DistanceTo(char *nav)
|
||||
|
||||
unsigned int DistanceTo(int nav)
|
||||
{
|
||||
if (nav > MAX_NAVPOINTS && nav < 0)
|
||||
if (nav >= MAX_NAVPOINTS && nav < 0)
|
||||
return 0xFFFFFFFF;
|
||||
|
||||
return (uint)vm_vec_dist_quick(&Player_obj->pos, Navs[nav].GetPosition());
|
||||
@@ -1695,7 +1695,7 @@ bool IsVisited(char *nav)
|
||||
|
||||
bool IsVisited(int nav)
|
||||
{
|
||||
if (nav > MAX_NAVPOINTS && nav < 0)
|
||||
if (nav >= MAX_NAVPOINTS && nav < 0)
|
||||
return 0;
|
||||
|
||||
if (Navs[nav].flags & NP_VISITED)
|
||||
|
||||
@@ -1684,7 +1684,7 @@ int cmdline_parm::get_int()
|
||||
// returns - the float representation for the parameter arguement
|
||||
float cmdline_parm::get_float()
|
||||
{
|
||||
Assert(args);
|
||||
Assert(args!=NULL);
|
||||
int offset = 0;
|
||||
|
||||
if (stacks) {
|
||||
|
||||
@@ -368,7 +368,7 @@ void cutscene_mark_viewable(char *filename)
|
||||
char cut_file[MAX_FILENAME_LEN];
|
||||
char file[MAX_FILENAME_LEN];
|
||||
|
||||
Assert(filename);
|
||||
Assert(filename!=NULL);
|
||||
|
||||
// strip off extension
|
||||
strcpy( file, filename );
|
||||
|
||||
@@ -316,7 +316,7 @@ static void dispatchDecoder16(ushort **pFrame, unsigned char codeType, unsigned
|
||||
y = far_p_table[k*2+1];
|
||||
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
*pDataRemain--;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x3:
|
||||
@@ -327,7 +327,7 @@ static void dispatchDecoder16(ushort **pFrame, unsigned char codeType, unsigned
|
||||
y = far_n_table[k*2+1];
|
||||
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
*pDataRemain--;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x4:
|
||||
@@ -338,7 +338,7 @@ static void dispatchDecoder16(ushort **pFrame, unsigned char codeType, unsigned
|
||||
y = close_table[k*2+1];
|
||||
|
||||
copyFrame(*pFrame, *pFrame + (backBuf2 - backBuf1) + x + y*g_width);
|
||||
*pDataRemain--;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x5:
|
||||
|
||||
@@ -220,21 +220,21 @@ static void dispatchDecoder8(ubyte **pFrame, ubyte codeType, ubyte **pData, int
|
||||
relFar(*(*pData)++, 1, &x, &y);
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
*pFrame += 8;
|
||||
*pDataRemain--;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x3:
|
||||
relFar(*(*pData)++, -1, &x, &y);
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
*pFrame += 8;
|
||||
*pDataRemain--;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x4:
|
||||
relClose(*(*pData)++, &x, &y);
|
||||
copyFrame(*pFrame, *pFrame + ((ubyte *)g_vBackBuf2 - (ubyte *)g_vBackBuf1) + x + y*g_width);
|
||||
*pFrame += 8;
|
||||
*pDataRemain--;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x5:
|
||||
@@ -521,7 +521,7 @@ static void dispatchDecoder8(ubyte **pFrame, ubyte codeType, ubyte **pData, int
|
||||
}
|
||||
|
||||
(*pData)++;
|
||||
*pDataRemain--;
|
||||
(*pDataRemain)--;
|
||||
*pFrame -= (8*g_width - 8);
|
||||
break;
|
||||
|
||||
|
||||
@@ -82,7 +82,8 @@ MVEFILE *mvefile_open(char *filename)
|
||||
|
||||
// NOTE: CF_TYPE *must* be ANY to get movies off of the CDs
|
||||
// assume lower case filename for *nix
|
||||
if ( (file->stream = cfopen(lower_name, "rb", CFILE_NORMAL, CF_TYPE_ANY)) ) {
|
||||
file->stream = cfopen(lower_name, "rb", CFILE_NORMAL, CF_TYPE_ANY);
|
||||
if ( file->stream ) {
|
||||
cf_opened = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -759,9 +759,9 @@ void debug_console( void (*_func)() )
|
||||
last_oldcommand++;
|
||||
strcpy( oldcommand_line[last_oldcommand], command_line);
|
||||
} else {
|
||||
int i;
|
||||
for (i=0; i<last_oldcommand; i++ ) {
|
||||
strcpy( oldcommand_line[i], oldcommand_line[i+1] );
|
||||
int iLoop;
|
||||
for (iLoop=0; iLoop<last_oldcommand; iLoop++ ) {
|
||||
strcpy( oldcommand_line[iLoop], oldcommand_line[iLoop+1] );
|
||||
}
|
||||
strcpy( oldcommand_line[last_oldcommand], command_line);
|
||||
}
|
||||
|
||||
@@ -5175,7 +5175,7 @@ void CFREDView::OnDestroy()
|
||||
snd_close();
|
||||
DBUGFILE_OUTPUT_0("About to gr_close");
|
||||
gr_close();
|
||||
os_set_window(0);
|
||||
os_set_window(NULL);
|
||||
|
||||
CView::OnDestroy();
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ void deconvert_multiline_string(char *buf, CString &str, int max_len)
|
||||
CString str2;
|
||||
|
||||
Assert(max_len > 1);
|
||||
Assert(buf);
|
||||
Assert(ptr!=NULL);
|
||||
max_len -= 2;
|
||||
while ((i = str.Find("\r\n")) >= 0) {
|
||||
for (j=0; j<i; j++)
|
||||
|
||||
+32
-32
@@ -2695,18 +2695,18 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
return 1;
|
||||
|
||||
case ID_ADD_STRING: {
|
||||
int node;
|
||||
int theNode;
|
||||
|
||||
node = add_data("string", (SEXPT_STRING | SEXPT_VALID));
|
||||
EditLabel(tree_nodes[node].handle);
|
||||
theNode = add_data("string", (SEXPT_STRING | SEXPT_VALID));
|
||||
EditLabel(tree_nodes[theNode].handle);
|
||||
return 1;
|
||||
}
|
||||
|
||||
case ID_ADD_NUMBER: {
|
||||
int node;
|
||||
int theNode;
|
||||
|
||||
node = add_data("number", (SEXPT_NUMBER | SEXPT_VALID));
|
||||
EditLabel(tree_nodes[node].handle);
|
||||
theNode = add_data("number", (SEXPT_NUMBER | SEXPT_VALID));
|
||||
EditLabel(tree_nodes[theNode].handle);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2721,45 +2721,45 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
// fall through to ID_DELETE case.
|
||||
|
||||
case ID_DELETE: {
|
||||
int parent, node;
|
||||
HTREEITEM h;
|
||||
int parent, theNode;
|
||||
HTREEITEM h_parent;
|
||||
|
||||
if ((m_mode & ST_ROOT_DELETABLE) && (item_index == -1)) {
|
||||
item_index = GetItemData(item_handle);
|
||||
if (m_mode == MODE_GOALS) {
|
||||
Assert(Goal_editor_dlg);
|
||||
node = Goal_editor_dlg->handler(ROOT_DELETED, item_index);
|
||||
theNode = Goal_editor_dlg->handler(ROOT_DELETED, item_index);
|
||||
|
||||
} else if (m_mode == MODE_EVENTS) {
|
||||
Assert(Event_editor_dlg);
|
||||
node = Event_editor_dlg->handler(ROOT_DELETED, item_index);
|
||||
theNode = Event_editor_dlg->handler(ROOT_DELETED, item_index);
|
||||
|
||||
} else {
|
||||
Assert(m_mode == MODE_CAMPAIGN);
|
||||
node = Campaign_tree_formp->handler(ROOT_DELETED, item_index);
|
||||
theNode = Campaign_tree_formp->handler(ROOT_DELETED, item_index);
|
||||
}
|
||||
|
||||
Assert(node >= 0);
|
||||
free_node2(node);
|
||||
Assert(theNode >= 0);
|
||||
free_node2(theNode);
|
||||
DeleteItem(item_handle);
|
||||
*modified = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Assert(item_index >= 0);
|
||||
h = GetParentItem(item_handle);
|
||||
h_parent = GetParentItem(item_handle);
|
||||
parent = tree_nodes[item_index].parent;
|
||||
if ((parent == -1) && (m_mode == MODE_EVENTS))
|
||||
Int3(); // no longer used, temporary to check if called still.
|
||||
|
||||
Assert(parent != -1 && tree_nodes[parent].handle == h);
|
||||
Assert(parent != -1 && tree_nodes[parent].handle == h_parent);
|
||||
free_node(item_index);
|
||||
DeleteItem(item_handle);
|
||||
|
||||
node = tree_nodes[parent].child;
|
||||
theNode = tree_nodes[parent].child;
|
||||
/* if (node != -1 && tree_nodes[node].next == -1 && tree_nodes[node].child == -1) {
|
||||
sprintf(buf, "%s %s", tree_nodes[parent].text, tree_nodes[node].text);
|
||||
SetItem(h, TVIF_TEXT, buf, 0, 0, 0, 0, 0);
|
||||
SetItem(h_parent, TVIF_TEXT, buf, 0, 0, 0, 0, 0);
|
||||
tree_nodes[parent].flags = OPERAND | EDITABLE;
|
||||
tree_nodes[node].flags = COMBINED;
|
||||
DeleteItem(tree_nodes[node].handle);
|
||||
@@ -3050,7 +3050,7 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
else if ( (Operators[op].value == OP_EXPLOSION_EFFECT) )
|
||||
{
|
||||
int temp;
|
||||
char str[TOKEN_LENGTH];
|
||||
char sexp_str_token[TOKEN_LENGTH];
|
||||
|
||||
switch (i)
|
||||
{
|
||||
@@ -3084,13 +3084,13 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
}
|
||||
|
||||
// Goober5000 - set_data_dup is required if we're passing a variable
|
||||
sprintf(str, "%d", temp);
|
||||
item->set_data_dup(str, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
sprintf(sexp_str_token, "%d", temp);
|
||||
item->set_data_dup(sexp_str_token, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else if ( (Operators[op].value == OP_WARP_EFFECT) )
|
||||
{
|
||||
int temp;
|
||||
char str[TOKEN_LENGTH];
|
||||
char sexp_str_token[TOKEN_LENGTH];
|
||||
|
||||
switch (i)
|
||||
{
|
||||
@@ -3112,13 +3112,13 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
}
|
||||
|
||||
// Goober5000 - set_data_dup is required if we're passing a variable
|
||||
sprintf(str, "%d", temp);
|
||||
item->set_data_dup(str, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
sprintf(sexp_str_token, "%d", temp);
|
||||
item->set_data_dup(sexp_str_token, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else if ((Operators[op].value == OP_ADD_BACKGROUND_BITMAP))
|
||||
{
|
||||
int temp = 0;
|
||||
char str[TOKEN_LENGTH];
|
||||
char sexp_str_token[TOKEN_LENGTH];
|
||||
|
||||
switch (i)
|
||||
{
|
||||
@@ -3133,18 +3133,18 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(str, "%d", temp);
|
||||
item->set_data_dup(str, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
sprintf(sexp_str_token, "%d", temp);
|
||||
item->set_data_dup(sexp_str_token, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else if ((Operators[op].value == OP_ADD_SUN_BITMAP))
|
||||
{
|
||||
int temp = 0;
|
||||
char str[TOKEN_LENGTH];
|
||||
char sexp_str_token[TOKEN_LENGTH];
|
||||
|
||||
if (i==4) temp = 100;
|
||||
|
||||
sprintf(str, "%d", temp);
|
||||
item->set_data_dup(str, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
sprintf(sexp_str_token, "%d", temp);
|
||||
item->set_data_dup(sexp_str_token, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else if ((Operators[op].value == OP_MODIFY_VARIABLE)) {
|
||||
if (get_modify_variable_type(index) == OPF_NUMBER) {
|
||||
@@ -4289,7 +4289,7 @@ void sexp_tree::swap_roots(HTREEITEM one, HTREEITEM two)
|
||||
|
||||
void sexp_tree::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
UINT flags;
|
||||
UINT flags = 0;
|
||||
|
||||
// ScreenToClient(&m_pt);
|
||||
ASSERT(!m_dragging);
|
||||
@@ -4321,8 +4321,8 @@ void sexp_tree::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
|
||||
void sexp_tree::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
HTREEITEM hitem;
|
||||
UINT flags;
|
||||
HTREEITEM hitem = NULL;
|
||||
UINT flags = 0;
|
||||
|
||||
if (m_dragging) {
|
||||
ASSERT(m_p_image_list != NULL);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ int event_music_enemy_arrival()
|
||||
if ( Current_pattern == SONG_DEAD_1 )
|
||||
return 0; // death is the last song to play
|
||||
|
||||
if ( (Current_pattern == SONG_VICT_1) || (Current_pattern == SONG_VICT_1) )
|
||||
if ( (Current_pattern == SONG_VICT_1) || (Current_pattern == SONG_VICT_2) )
|
||||
return 0;
|
||||
|
||||
if ( Patterns[Current_pattern].next_pattern != Patterns[Current_pattern].default_next_pattern )
|
||||
@@ -1174,7 +1174,7 @@ int event_music_friendly_arrival()
|
||||
if ( Current_pattern == SONG_DEAD_1 )
|
||||
return 0; // death is the last song to play
|
||||
|
||||
if ( (Current_pattern == SONG_VICT_1) || (Current_pattern == SONG_VICT_1) )
|
||||
if ( (Current_pattern == SONG_VICT_1) || (Current_pattern == SONG_VICT_2) )
|
||||
return 0;
|
||||
|
||||
// Goober5000 - to avoid array out-of-bounds
|
||||
|
||||
@@ -2735,7 +2735,8 @@ int opengl_init_display_device()
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( !(GL_render_context = wglCreateContext(GL_device_context)) ) {
|
||||
GL_render_context = wglCreateContext(GL_device_context);
|
||||
if ( !GL_render_context ) {
|
||||
MessageBox(wnd, "Unable to create rendering context for OpenGL W32!", "error", MB_ICONERROR | MB_OK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -839,7 +839,6 @@ void draw_bounding_brackets(int x1, int y1, int x2, int y2, int w_correction, in
|
||||
char* tinfo_class = NULL;
|
||||
char temp_name[NAME_LENGTH*2+3];
|
||||
char temp_class[NAME_LENGTH];
|
||||
char empty='\0';
|
||||
|
||||
switch(t_objp->type)
|
||||
{
|
||||
|
||||
@@ -1412,7 +1412,7 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num )
|
||||
{
|
||||
ai_info *aip;
|
||||
ship *shipp, *ordering_shipp;
|
||||
int i, send_message, special_index = -1;
|
||||
int i, send_message;
|
||||
object *objp;
|
||||
|
||||
// quick short circuit here because of actually showing comm menu even though you cannot message.
|
||||
|
||||
@@ -2086,19 +2086,19 @@ void hud_target_missile(object *source_obj, int next_flag)
|
||||
|
||||
if ( !target_found ) {
|
||||
// if no bomb is found, search for bombers
|
||||
ship_obj *start, *so;
|
||||
ship_obj *startShip, *so;
|
||||
|
||||
if ( (aip->target_objnum != -1)
|
||||
&& (Objects[aip->target_objnum].type == OBJ_SHIP)
|
||||
&& ((Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].flags & SIF_BOMBER)
|
||||
|| (Objects[aip->target_objnum].flags & OF_TARGETABLE_AS_BOMB))) {
|
||||
int index = Ships[Objects[aip->target_objnum].instance].ship_list_index;
|
||||
start = get_ship_obj_ptr_from_index(index);
|
||||
startShip = get_ship_obj_ptr_from_index(index);
|
||||
} else {
|
||||
start = GET_FIRST(&Ship_obj_list);
|
||||
startShip = GET_FIRST(&Ship_obj_list);
|
||||
}
|
||||
|
||||
for (so=advance_ship(start, next_flag); so!=start; so=advance_ship(so, next_flag)) {
|
||||
for (so=advance_ship(startShip, next_flag); so!=startShip; so=advance_ship(so, next_flag)) {
|
||||
A = &Objects[so->objnum];
|
||||
|
||||
// don't look at header
|
||||
|
||||
@@ -2915,7 +2915,7 @@ int button_function(int n)
|
||||
if ( Players[Player_num].flags & PLAYER_FLAGS_AUTO_MATCH_SPEED ) {
|
||||
snd_play(&Snds[SND_SHIELD_XFER_OK], 1.0f);
|
||||
// HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Auto match target speed activated", -1));
|
||||
if ( !Player->flags & PLAYER_FLAGS_MATCH_TARGET ) {
|
||||
if ( !(Player->flags & PLAYER_FLAGS_MATCH_TARGET) ) {
|
||||
player_match_target_speed();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1804,7 +1804,7 @@ void labviewer_make_ship_window(Button *caller)
|
||||
Lab_species_nodes[idx]->ClearAllItems();
|
||||
}
|
||||
|
||||
delete Lab_species_nodes;
|
||||
delete [] Lab_species_nodes;
|
||||
Lab_species_nodes = NULL;
|
||||
}
|
||||
|
||||
|
||||
+14
-15
@@ -972,8 +972,7 @@ ubyte light_apply( vec3d *pos, vec3d * norm, float static_light_level )
|
||||
|
||||
if (Detail.lighting==0) {
|
||||
// No static light
|
||||
ubyte l = ubyte(fl2i(static_light_level*255.0f));
|
||||
return l;
|
||||
return ubyte(fl2i(static_light_level*255.0f));
|
||||
}
|
||||
|
||||
if ( Lighting_off ) return 191;
|
||||
@@ -1033,9 +1032,9 @@ ubyte light_apply( vec3d *pos, vec3d * norm, float static_light_level )
|
||||
lval += l->intensity*dot;
|
||||
} else if ( dist < l->radb_squared ) {
|
||||
// dist from 0 to
|
||||
float n = dist - l->rada_squared;
|
||||
float d = l->radb_squared - l->rada_squared;
|
||||
float ltmp = (1.0f - n / d )*dot*l->intensity;
|
||||
float nnum = dist - l->rada_squared;
|
||||
float dden = l->radb_squared - l->rada_squared;
|
||||
float ltmp = (1.0f - nnum / dden )*dot*l->intensity;
|
||||
lval += ltmp;
|
||||
}
|
||||
if ( lval > 1.0f ) {
|
||||
@@ -1192,9 +1191,9 @@ void light_apply_specular(ubyte *param_r, ubyte *param_g, ubyte *param_b, vec3d
|
||||
} else if ( dist < l->radb_squared ) {
|
||||
float ratio;
|
||||
// dist from 0 to
|
||||
float n = dist - l->rada_squared;
|
||||
float d = l->radb_squared - l->rada_squared;
|
||||
ratio = (1.0f - n / d)*dot*l->intensity*factor;
|
||||
float nnum = dist - l->rada_squared;
|
||||
float dden = l->radb_squared - l->rada_squared;
|
||||
ratio = (1.0f - nnum / dden)*dot*l->intensity*factor;
|
||||
ratio *= 0.25f;
|
||||
rval += l->spec_r*ratio;
|
||||
gval += l->spec_g*ratio;
|
||||
@@ -1232,10 +1231,10 @@ void light_apply_rgb( ubyte *param_r, ubyte *param_g, ubyte *param_b, vec3d *pos
|
||||
|
||||
if (Detail.lighting==0) {
|
||||
// No static light
|
||||
ubyte l = ubyte(fl2i(static_light_level*255.0f));
|
||||
*param_r = l;
|
||||
*param_g = l;
|
||||
*param_b = l;
|
||||
ubyte lVal = ubyte(fl2i(static_light_level*255.0f));
|
||||
*param_r = lVal;
|
||||
*param_g = lVal;
|
||||
*param_b = lVal;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1349,9 +1348,9 @@ void light_apply_rgb( ubyte *param_r, ubyte *param_g, ubyte *param_b, vec3d *pos
|
||||
} else if ( dist < l->radb_squared ) {
|
||||
float ratio;
|
||||
// dist from 0 to
|
||||
float n = dist - l->rada_squared;
|
||||
float d = l->radb_squared - l->rada_squared;
|
||||
ratio = (1.0f - n / d)*dot*l->intensity;
|
||||
float nnum = dist - l->rada_squared;
|
||||
float dden = l->radb_squared - l->rada_squared;
|
||||
ratio = (1.0f - nnum / dden)*dot*l->intensity;
|
||||
ratio *= 0.25f;
|
||||
rval += l->r*ratio;
|
||||
gval += l->g*ratio;
|
||||
|
||||
@@ -855,7 +855,7 @@ int lcl_add_dir_to_path_with_filename(char *current_path, uint path_max)
|
||||
// copy rest of filename from temp
|
||||
SAFE_STRCAT(current_path, temp, path_max);
|
||||
|
||||
delete temp;
|
||||
delete [] temp;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -768,14 +768,14 @@ float vm_vec_mag_quick(vec3d *v)
|
||||
c = v->xyz.z;
|
||||
|
||||
if (a < b) {
|
||||
float t=a; a=b; b=t;
|
||||
float temp=a; a=b; b=temp;
|
||||
}
|
||||
|
||||
if (b < c) {
|
||||
float t=b; b=c; c=t;
|
||||
float temp=b; b=c; c=temp;
|
||||
|
||||
if (a < b) {
|
||||
float t=a; a=b; b=t;
|
||||
float temp2=a; a=b; b=temp2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1252,7 +1252,9 @@ bad_vector2:
|
||||
//quicker version of vm_vector_2_matrix() that takes normalized vectors
|
||||
matrix *vm_vector_2_matrix_norm(matrix *m,vec3d *fvec,vec3d *uvec,vec3d *rvec)
|
||||
{
|
||||
vec3d *xvec=&m->vec.rvec,*yvec=&m->vec.uvec,*zvec=&m->vec.fvec;
|
||||
vec3d *xvec=&m->vec.rvec;
|
||||
vec3d *yvec=&m->vec.uvec;
|
||||
vec3d *zvec=&m->vec.fvec;
|
||||
|
||||
|
||||
Assert(fvec != NULL);
|
||||
|
||||
@@ -4202,7 +4202,7 @@ void mission_parse_maybe_create_parse_object(p_object *pobjp)
|
||||
debris *db;
|
||||
|
||||
db = &Debris[i];
|
||||
if (!db->flags & DEBRIS_USED) // not used, move onto the next one.
|
||||
if (!(db->flags & DEBRIS_USED)) // not used, move onto the next one.
|
||||
continue;
|
||||
if (db->source_objnum != real_objnum) // not from this ship, move to next one
|
||||
continue;
|
||||
|
||||
@@ -1234,10 +1234,10 @@ void obj_delete(int objnum)
|
||||
asteroid_delete(objp);
|
||||
break;
|
||||
/* case OBJ_CMEASURE:
|
||||
cmeasure_delete( objp );*/
|
||||
break;
|
||||
cmeasure_delete( objp );
|
||||
break;*/
|
||||
case OBJ_GHOST:
|
||||
if((!Game_mode & GM_MULTIPLAYER)){
|
||||
if(!(Game_mode & GM_MULTIPLAYER)){
|
||||
mprintf(("Warning: Tried to delete a ghost!\n"));
|
||||
objp->flags &= ~OF_SHOULD_BE_DEAD;
|
||||
return;
|
||||
|
||||
@@ -458,7 +458,7 @@ uint os_get_dc()
|
||||
// Returns the handle to the main window
|
||||
void os_set_window(uint new_handle)
|
||||
{
|
||||
hwndApp = (HWND) new_handle;
|
||||
hwndApp = (HWND)new_handle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -2396,9 +2396,9 @@ ADE_VIRTVAR(Value, l_SEXPVariable, "number/string", "SEXP variable value", "stri
|
||||
sexp_modify_variable(newvalue, svh->idx, false);
|
||||
}
|
||||
|
||||
if(sv->type && SEXP_VARIABLE_NUMBER)
|
||||
if(sv->type & SEXP_VARIABLE_NUMBER)
|
||||
return ade_set_args(L, "i", atoi(sv->text));
|
||||
else if(sv->type && SEXP_VARIABLE_STRING)
|
||||
else if(sv->type & SEXP_VARIABLE_STRING)
|
||||
return ade_set_args(L, "s", sv->text);
|
||||
else
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
+1
-1
@@ -13299,7 +13299,7 @@ void set_primary_ammo (int ship_index, int requested_bank, int requested_ammo, i
|
||||
}
|
||||
|
||||
// Check that this isn't a non-ballistic bank as it's pointless to set the amount of ammo for those
|
||||
if (!Weapon_info[shipp->weapons.primary_bank_weapons[requested_bank]].wi_flags2 & WIF2_BALLISTIC)
|
||||
if (!(Weapon_info[shipp->weapons.primary_bank_weapons[requested_bank]].wi_flags2 & WIF2_BALLISTIC))
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ int popup_process_keys(popup_info *pi, int k, int flags)
|
||||
|
||||
|
||||
masked_k = k & ~KEY_CTRLED; // take out CTRL modifier only
|
||||
if ( (PF_ALLOW_DEAD_KEYS) && (Game_mode & GM_IN_MISSION) ) {
|
||||
if ( (Game_mode & GM_IN_MISSION) ) {
|
||||
process_set_of_keys(masked_k, Dead_key_set_size, Dead_key_set);
|
||||
button_info_do(&Player->bi); // call functions based on status of button_info bit vectors
|
||||
}
|
||||
@@ -677,7 +677,7 @@ int popup_init(popup_info *pi, int flags)
|
||||
}
|
||||
|
||||
// anytime in single player, and multiplayer, not in mission, go ahead and stop time
|
||||
if ( (Game_mode & GM_NORMAL) || ((Game_mode && GM_MULTIPLAYER) && !(Game_mode & GM_IN_MISSION)) ){
|
||||
if ( (Game_mode & GM_NORMAL) || ((Game_mode & GM_MULTIPLAYER) && !(Game_mode & GM_IN_MISSION)) ){
|
||||
game_stop_time();
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ void popup_close(popup_info *pi, int screen_id)
|
||||
Popup_running_state = 0;
|
||||
|
||||
// anytime in single player, and multiplayer, not in mission, go ahead and stop time
|
||||
if ( (Game_mode & GM_NORMAL) || ((Game_mode && GM_MULTIPLAYER) && !(Game_mode & GM_IN_MISSION)) )
|
||||
if ( (Game_mode & GM_NORMAL) || ((Game_mode & GM_MULTIPLAYER) && !(Game_mode & GM_IN_MISSION)) )
|
||||
game_start_time();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -10022,7 +10022,7 @@ int ship_fire_primary_debug(object *objp)
|
||||
shipp->weapons.next_primary_fire_stamp[0] = timestamp(250);
|
||||
|
||||
// Debug code! Make the single laser fire only one bolt and from the object center!
|
||||
for (i=0; i<MAX_WEAPONS; i++)
|
||||
for (i=0; i<MAX_WEAPON_TYPES; i++)
|
||||
if (!stricmp(Weapon_info[i].name, NOX("Debug Laser")))
|
||||
break;
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ void snd_spew_debug_info()
|
||||
|
||||
// count up game, interface and message sounds
|
||||
for(int idx=0; idx<Num_sounds; idx++){
|
||||
if(!Sounds[idx].flags & SND_F_USED){
|
||||
if(!(Sounds[idx].flags & SND_F_USED)){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1232,6 +1232,8 @@ int snd_play_looping( game_snd *gs, float pan, int start_loop, int stop_loop, fl
|
||||
int handle = -1;
|
||||
sound *snd;
|
||||
|
||||
Assert( gs != NULL );
|
||||
|
||||
if (!Sound_enabled)
|
||||
return -1;
|
||||
|
||||
|
||||
Reference in new issue
Block a user