From 824f2ba638a29a84b523dfb9ab1fa5cda8f7a763 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Fri, 16 Jul 2021 13:28:07 -0700 Subject: [PATCH] fix misleading indentation, add explicit braces, etc --- main/ai2.c | 4 +- main/collide.c | 56 +++++++++--------- main/editor/group.c | 14 ++--- main/editor/medmisc.c | 12 ++-- main/editor/seguvs.c | 40 ++++++------- main/gamecntl.c | 2 +- main/gamesave.c | 13 +++-- main/gameseg.c | 16 +++--- main/menu.c | 4 +- main/multi.c | 110 +++++++++++++++++------------------ main/network.c | 18 +++--- main/object.c | 12 ++-- main/piggy.c | 16 +++--- main/render.c | 4 +- main/weapon.c | 4 +- texmap/ntmap.c | 130 +++++++++++++++++++++--------------------- 16 files changed, 228 insertions(+), 227 deletions(-) diff --git a/main/ai2.c b/main/ai2.c index 0567ad0b..660a652b 100644 --- a/main/ai2.c +++ b/main/ai2.c @@ -231,8 +231,8 @@ void init_boss_segments(short segptr[], int *num_segs, int size_check, int one_w #endif -if (size_check) - mprintf((0, "Boss fits in segments:\n")); + if (size_check) + mprintf((0, "Boss fits in segments:\n")); // See if there is a boss. If not, quick out. for (i=0; i<=Highest_object_index; i++) if ((Objects[i].type == OBJ_ROBOT) && (Robot_info[Objects[i].id].boss_flag)) { diff --git a/main/collide.c b/main/collide.c index 97bc94c5..5b942b54 100644 --- a/main/collide.c +++ b/main/collide.c @@ -1342,52 +1342,52 @@ int apply_damage_to_robot(object *robot, fix damage, int killer_objnum) if (Robot_info[robot->id].boss_flag) if (PLAYING_BUILTIN_MISSION && Current_level_num == Last_level) if (robot->shields < 0) - { + { #ifdef NETWORK if (Game_mode & GM_MULTI) - { - if (!multi_all_players_alive()) // everyones gotta be alive + { + if (!multi_all_players_alive()) // everyones gotta be alive robot->shields=1; - else - { - multi_send_finish_game(); - do_final_boss_hacks(); - } - - } + else + { + multi_send_finish_game(); + do_final_boss_hacks(); + } + + } else #endif - { // NOTE LINK TO ABOVE!!! + { // NOTE LINK TO ABOVE!!! if ((Players[Player_num].shields < 0) || Player_is_dead) robot->shields = 1; // Sorry, we can't allow you to kill the final boss after you've died. Rough luck. else do_final_boss_hacks(); - } - } + } + } if (robot->shields < 0) { #ifdef NETWORK if (Game_mode & GM_MULTI) { - if (Robot_info[robot->id].thief) - isthief=1; - else - isthief=0; + if (Robot_info[robot->id].thief) + isthief=1; + else + isthief=0; + + if (isthief) + for (i=0;iid].thief)) { - if (isthief) - for (i=0;iid].thief); - if (isthief) - for (i=0;i -1) && (group_fileinfo.segment_howmany > 0)) diff --git a/main/editor/medmisc.c b/main/editor/medmisc.c index b89b4d64..ce4bcd73 100644 --- a/main/editor/medmisc.c +++ b/main/editor/medmisc.c @@ -271,12 +271,12 @@ int medlisp_update_screen() { int vn; -if (!render_3d_in_big_window) - for (vn=0;vnev_changed || (Update_flags & (UF_WORLD_CHANGED|UF_VIEWPOINT_MOVED|UF_ED_STATE_CHANGED))) { - draw_world(Views[vn]->ev_canv,Views[vn],Cursegp,Big_depth); - Views[vn]->ev_changed = 0; - } + if (!render_3d_in_big_window) + for (vn=0;vnev_changed || (Update_flags & (UF_WORLD_CHANGED|UF_VIEWPOINT_MOVED|UF_ED_STATE_CHANGED))) { + draw_world(Views[vn]->ev_canv,Views[vn],Cursegp,Big_depth); + Views[vn]->ev_changed = 0; + } if (Update_flags & (UF_WORLD_CHANGED|UF_GAME_VIEW_CHANGED|UF_ED_STATE_CHANGED)) { grs_canvas temp_canvas; diff --git a/main/editor/seguvs.c b/main/editor/seguvs.c index 6cd6fd5f..6c1f1747 100644 --- a/main/editor/seguvs.c +++ b/main/editor/seguvs.c @@ -237,26 +237,26 @@ void set_average_light_on_all_fast(void) if (segp->verts[relvnum] == v) break; - if (relvnum != MAX_VERTICES_PER_SEGMENT) { - int si; - - *segptr++ = s; // Note this segment in list, so we can process it below. - Assert(segptr - seglist < MAX_LIGHT_SEGS); - - for (si=0; sichildren[si])) { - side *sidep = &segp->sides[si]; - sbyte *vp = Side_to_verts[si]; - int vv; - - for (vv=0; vv<4; vv++) - if (*vp++ == relvnum) { - al += sidep->uvls[vv].l; - alc++; - } - } // if (segp->children[si == -1) { - } // for (si=0... - } // if (relvnum != ... + if (relvnum != MAX_VERTICES_PER_SEGMENT) { + int si; + + *segptr++ = s; // Note this segment in list, so we can process it below. + Assert(segptr - seglist < MAX_LIGHT_SEGS); + + for (si=0; sichildren[si])) { + side *sidep = &segp->sides[si]; + sbyte *vp = Side_to_verts[si]; + int vv; + + for (vv=0; vv<4; vv++) + if (*vp++ == relvnum) { + al += sidep->uvls[vv].l; + alc++; + } + } // if (segp->children[si == -1) { + } // for (si=0... + } // if (relvnum != ... } // for (s=0; ... *segptr = -1; diff --git a/main/gamecntl.c b/main/gamecntl.c index beab2518..0ad2c8de 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -1681,7 +1681,7 @@ void HandleTestKey(int key) mprintf((0, "Variable at %08x set to %i\n", Toggle_var, *Toggle_var)); break; case KEY_DEBUGGED + KEY_L: - if (++Lighting_on >= 2) Lighting_on = 0; break; + if (++Lighting_on >= 2) { Lighting_on = 0; } break; case KEY_DEBUGGED + KEY_SHIFTED + KEY_L: Beam_brightness=0x38000-Beam_brightness; break; case KEY_PAD5: slew_stop(); break; diff --git a/main/gamesave.c b/main/gamesave.c index d7df8964..b037d226 100644 --- a/main/gamesave.c +++ b/main/gamesave.c @@ -962,12 +962,13 @@ int load_game_data(CFILE *LoadFile) } else matcen_info_read(&RobotCenters[i], LoadFile); - // Set links in RobotCenters to Station array - for (j = 0; j <= Highest_segment_index; j++) - if (Segment2s[j].special == SEGMENT_IS_ROBOTMAKER) - if (Segment2s[j].matcen_num == i) - RobotCenters[i].fuelcen_num = Segment2s[j].value; - // mprintf((0, " %i: flags = %08x\n", i, RobotCenters[i].robot_flags)); + + // Set links in RobotCenters to Station array + for (j = 0; j <= Highest_segment_index; j++) + if (Segment2s[j].special == SEGMENT_IS_ROBOTMAKER) + if (Segment2s[j].matcen_num == i) + RobotCenters[i].fuelcen_num = Segment2s[j].value; + // mprintf((0, " %i: flags = %08x\n", i, RobotCenters[i].robot_flags)); } //================ READ DL_INDICES INFO =============== diff --git a/main/gameseg.c b/main/gameseg.c index bca9f519..02d2283f 100644 --- a/main/gameseg.c +++ b/main/gameseg.c @@ -776,14 +776,14 @@ int trace_segs(vms_vector *p0, int oldsegnum, int recursion_count) biggest_side = sidenum; } - if (biggest_side == -1) - break; - - side_dists[biggest_side] = 0; - // trace into adjacent segment: - check = trace_segs(p0, seg->children[biggest_side], recursion_count + 1); - if (check >= 0) //we've found a segment - return check; + if (biggest_side == -1) + break; + + side_dists[biggest_side] = 0; + // trace into adjacent segment: + check = trace_segs(p0, seg->children[biggest_side], recursion_count + 1); + if (check >= 0) //we've found a segment + return check; } return -1; //we haven't found a segment } diff --git a/main/menu.c b/main/menu.c index 8624cfa1..ac44df66 100644 --- a/main/menu.c +++ b/main/menu.c @@ -829,8 +829,8 @@ void do_new_game_menu() { int new_level_num; - if (!select_mission(0, "New Game\n\nSelect mission")) - return; + if (!select_mission(0, "New Game\n\nSelect mission")) + return; new_level_num = 1; diff --git a/main/multi.c b/main/multi.c index 7f4716ef..0367c49d 100644 --- a/main/multi.c +++ b/main/multi.c @@ -5262,129 +5262,129 @@ multi_process_data(char *buf, int len) switch(type) { case MULTI_POSITION: - if (!Endlevel_sequence) multi_do_position(buf); break; + if (!Endlevel_sequence) { multi_do_position(buf); } break; case MULTI_REAPPEAR: - if (!Endlevel_sequence) multi_do_reappear(buf); break; + if (!Endlevel_sequence) { multi_do_reappear(buf); } break; case MULTI_FIRE: - if (!Endlevel_sequence) multi_do_fire(buf); break; + if (!Endlevel_sequence) { multi_do_fire(buf); } break; case MULTI_KILL: multi_do_kill(buf); break; case MULTI_REMOVE_OBJECT: - if (!Endlevel_sequence) multi_do_remobj(buf); break; + if (!Endlevel_sequence) { multi_do_remobj(buf); } break; case MULTI_PLAYER_DROP: case MULTI_PLAYER_EXPLODE: - if (!Endlevel_sequence) multi_do_player_explode(buf); break; + if (!Endlevel_sequence) { multi_do_player_explode(buf); } break; case MULTI_MESSAGE: - if (!Endlevel_sequence) multi_do_message(buf); break; + if (!Endlevel_sequence) { multi_do_message(buf); } break; case MULTI_QUIT: - if (!Endlevel_sequence) multi_do_quit(buf); break; + if (!Endlevel_sequence) { multi_do_quit(buf); } break; case MULTI_BEGIN_SYNC: break; case MULTI_CONTROLCEN: - if (!Endlevel_sequence) multi_do_controlcen_destroy(buf); break; + if (!Endlevel_sequence) { multi_do_controlcen_destroy(buf); } break; case MULTI_POWERUP_UPDATE: - if (!Endlevel_sequence) multi_do_powerup_update(buf); break; + if (!Endlevel_sequence) { multi_do_powerup_update(buf); } break; case MULTI_SOUND_FUNCTION: multi_do_sound_function(buf); break; case MULTI_MARKER: - if (!Endlevel_sequence) multi_do_drop_marker (buf); break; + if (!Endlevel_sequence) { multi_do_drop_marker (buf); } break; case MULTI_DROP_WEAPON: - if (!Endlevel_sequence) multi_do_drop_weapon(buf); break; + if (!Endlevel_sequence) { multi_do_drop_weapon(buf); } break; case MULTI_DROP_FLAG: - if (!Endlevel_sequence) multi_do_drop_flag(buf); break; + if (!Endlevel_sequence) { multi_do_drop_flag(buf); } break; case MULTI_GUIDED: - if (!Endlevel_sequence) multi_do_guided (buf); break; + if (!Endlevel_sequence) { multi_do_guided (buf); } break; case MULTI_STOLEN_ITEMS: - if (!Endlevel_sequence) multi_do_stolen_items(buf); break; + if (!Endlevel_sequence) { multi_do_stolen_items(buf); } break; case MULTI_WALL_STATUS: - if (!Endlevel_sequence) multi_do_wall_status(buf); break; + if (!Endlevel_sequence) { multi_do_wall_status(buf); } break; case MULTI_HEARTBEAT: - if (!Endlevel_sequence) multi_do_heartbeat (buf); break; + if (!Endlevel_sequence) { multi_do_heartbeat (buf); } break; case MULTI_SEISMIC: - if (!Endlevel_sequence) multi_do_seismic (buf); break; + if (!Endlevel_sequence) { multi_do_seismic (buf); } break; case MULTI_LIGHT: - if (!Endlevel_sequence) multi_do_light (buf); break; + if (!Endlevel_sequence) { multi_do_light (buf); } break; case MULTI_KILLGOALS: - if (!Endlevel_sequence) multi_do_kill_goal_counts (buf); break; + if (!Endlevel_sequence) { multi_do_kill_goal_counts (buf); } break; case MULTI_ENDLEVEL_START: - if (!Endlevel_sequence) multi_do_escape(buf); break; + if (!Endlevel_sequence) { multi_do_escape(buf); } break; case MULTI_END_SYNC: break; case MULTI_CLOAK: - if (!Endlevel_sequence) multi_do_cloak(buf); break; + if (!Endlevel_sequence) { multi_do_cloak(buf); } break; case MULTI_DECLOAK: - if (!Endlevel_sequence) multi_do_decloak(buf); break; + if (!Endlevel_sequence) { multi_do_decloak(buf); } break; case MULTI_DOOR_OPEN: - if (!Endlevel_sequence) multi_do_door_open(buf); break; + if (!Endlevel_sequence) { multi_do_door_open(buf); } break; case MULTI_CREATE_EXPLOSION: - if (!Endlevel_sequence) multi_do_create_explosion(buf); break; + if (!Endlevel_sequence) { multi_do_create_explosion(buf); } break; case MULTI_CONTROLCEN_FIRE: - if (!Endlevel_sequence) multi_do_controlcen_fire(buf); break; + if (!Endlevel_sequence) { multi_do_controlcen_fire(buf); } break; case MULTI_CREATE_POWERUP: - if (!Endlevel_sequence) multi_do_create_powerup(buf); break; + if (!Endlevel_sequence) { multi_do_create_powerup(buf); } break; case MULTI_PLAY_SOUND: - if (!Endlevel_sequence) multi_do_play_sound(buf); break; + if (!Endlevel_sequence) { multi_do_play_sound(buf); } break; case MULTI_CAPTURE_BONUS: - if (!Endlevel_sequence) multi_do_capture_bonus(buf); break; + if (!Endlevel_sequence) { multi_do_capture_bonus(buf); } break; case MULTI_ORB_BONUS: - if (!Endlevel_sequence) multi_do_orb_bonus(buf); break; + if (!Endlevel_sequence) { multi_do_orb_bonus(buf); } break; case MULTI_GOT_FLAG: - if (!Endlevel_sequence) multi_do_got_flag(buf); break; + if (!Endlevel_sequence) { multi_do_got_flag(buf); } break; case MULTI_GOT_ORB: - if (!Endlevel_sequence) multi_do_got_orb(buf); break; + if (!Endlevel_sequence) { multi_do_got_orb(buf); } break; case MULTI_PLAY_BY_PLAY: - if (!Endlevel_sequence) multi_do_play_by_play(buf); break; + if (!Endlevel_sequence) { multi_do_play_by_play(buf); } break; case MULTI_RANK: - if (!Endlevel_sequence) multi_do_ranking (buf); break; + if (!Endlevel_sequence) { multi_do_ranking (buf); } break; case MULTI_MODEM_PING: - if (!Endlevel_sequence) multi_send_modem_ping_return(); break; + if (!Endlevel_sequence) { multi_send_modem_ping_return(); } break; case MULTI_MODEM_PING_RETURN: - if (!Endlevel_sequence) multi_do_modem_ping_return(); break; + if (!Endlevel_sequence) { multi_do_modem_ping_return(); } break; #ifndef SHAREWARE case MULTI_FINISH_GAME: multi_do_finish_game(buf); break; // do this one regardless of endsequence case MULTI_ROBOT_CONTROLS: - if (!Endlevel_sequence) multi_do_robot_controls(buf); break; + if (!Endlevel_sequence) { multi_do_robot_controls(buf); } break; case MULTI_ROBOT_CLAIM: - if (!Endlevel_sequence) multi_do_claim_robot(buf); break; + if (!Endlevel_sequence) { multi_do_claim_robot(buf); } break; case MULTI_ROBOT_POSITION: - if (!Endlevel_sequence) multi_do_robot_position(buf); break; + if (!Endlevel_sequence) { multi_do_robot_position(buf); } break; case MULTI_ROBOT_EXPLODE: - if (!Endlevel_sequence) multi_do_robot_explode(buf); break; + if (!Endlevel_sequence) { multi_do_robot_explode(buf); } break; case MULTI_ROBOT_RELEASE: - if (!Endlevel_sequence) multi_do_release_robot(buf); break; + if (!Endlevel_sequence) { multi_do_release_robot(buf); } break; case MULTI_ROBOT_FIRE: - if (!Endlevel_sequence) multi_do_robot_fire(buf); break; + if (!Endlevel_sequence) { multi_do_robot_fire(buf); } break; #endif case MULTI_SCORE: - if (!Endlevel_sequence) multi_do_score(buf); break; + if (!Endlevel_sequence) { multi_do_score(buf); } break; case MULTI_CREATE_ROBOT: - if (!Endlevel_sequence) multi_do_create_robot(buf); break; + if (!Endlevel_sequence) { multi_do_create_robot(buf); } break; case MULTI_TRIGGER: - if (!Endlevel_sequence) multi_do_trigger(buf); break; + if (!Endlevel_sequence) { multi_do_trigger(buf); } break; case MULTI_START_TRIGGER: - if (!Endlevel_sequence) multi_do_start_trigger(buf); break; + if (!Endlevel_sequence) { multi_do_start_trigger(buf); } break; case MULTI_FLAGS: - if (!Endlevel_sequence) multi_do_flags(buf); break; + if (!Endlevel_sequence) { multi_do_flags(buf); } break; case MULTI_DROP_BLOB: - if (!Endlevel_sequence) multi_do_drop_blob(buf); break; + if (!Endlevel_sequence) { multi_do_drop_blob(buf); } break; case MULTI_ACTIVE_DOOR: - if (!Endlevel_sequence) multi_do_active_door(buf); break; + if (!Endlevel_sequence) { multi_do_active_door(buf); } break; case MULTI_BOSS_ACTIONS: - if (!Endlevel_sequence) multi_do_boss_actions(buf); break; + if (!Endlevel_sequence) { multi_do_boss_actions(buf); } break; case MULTI_CREATE_ROBOT_POWERUPS: - if (!Endlevel_sequence) multi_do_create_robot_powerups(buf); break; + if (!Endlevel_sequence) { multi_do_create_robot_powerups(buf); } break; case MULTI_HOSTAGE_DOOR: - if (!Endlevel_sequence) multi_do_hostage_door_status(buf); break; + if (!Endlevel_sequence) { multi_do_hostage_door_status(buf); } break; case MULTI_SAVE_GAME: - if (!Endlevel_sequence) multi_do_save_game(buf); break; + if (!Endlevel_sequence) { multi_do_save_game(buf); } break; case MULTI_RESTORE_GAME: - if (!Endlevel_sequence) multi_do_restore_game(buf); break; + if (!Endlevel_sequence) { multi_do_restore_game(buf); } break; case MULTI_REQ_PLAYER: - if (!Endlevel_sequence) multi_do_req_player(buf); break; + if (!Endlevel_sequence) { multi_do_req_player(buf); } break; case MULTI_SEND_PLAYER: - if (!Endlevel_sequence) multi_do_send_player(buf); break; + if (!Endlevel_sequence) { multi_do_send_player(buf); } break; default: mprintf((1, "Invalid type in multi_process_input().\n")); diff --git a/main/network.c b/main/network.c index bd116eb4..97f9741c 100644 --- a/main/network.c +++ b/main/network.c @@ -2955,9 +2955,9 @@ int network_get_game_params( char * game_name, int *mode, int *game_flags, int * Netgame.Allow_marker_view=1; netgame_difficulty = Player_default_difficulty.intval; - ExtGameStatus=GAMESTAT_START_MULTIPLAYER_MISSION; - if (!select_mission(1, TXT_MULTI_MISSION)) - return -1; + ExtGameStatus=GAMESTAT_START_MULTIPLAYER_MISSION; + if (!select_mission(1, TXT_MULTI_MISSION)) + return -1; if (!(FindArg ("-packets") && FindArg ("-shortpackets"))) if (!network_choose_connect ()) @@ -3698,8 +3698,8 @@ network_start_game() if (i<0) return; - if (is_D2_OEM) - My_Seq.player.version_minor|=NETWORK_OEM; + if (is_D2_OEM) + My_Seq.player.version_minor|=NETWORK_OEM; N_players = 0; @@ -5314,10 +5314,10 @@ void network_read_pdata_packet(frame_info *pd ) if ((pd->numpackets-Players[TheirPlayernum].n_packets_got)>0) TotalMissedPackets += pd->numpackets-Players[TheirPlayernum].n_packets_got; - if ( missed_packets > 0 ) - mprintf(( 0, "Missed %d packets from player #%d (%d total)\n", pd->numpackets-Players[TheirPlayernum].n_packets_got, TheirPlayernum, missed_packets )); - else - mprintf( (0, "Got %d late packets from player #%d (%d total)\n", Players[TheirPlayernum].n_packets_got-pd->numpackets, TheirPlayernum, missed_packets )); + if ( missed_packets > 0 ) + mprintf(( 0, "Missed %d packets from player #%d (%d total)\n", pd->numpackets-Players[TheirPlayernum].n_packets_got, TheirPlayernum, missed_packets )); + else + mprintf( (0, "Got %d late packets from player #%d (%d total)\n", Players[TheirPlayernum].n_packets_got-pd->numpackets, TheirPlayernum, missed_packets )); #ifdef MACINTOSH #ifdef APPLETALK_DEBUG diff --git a/main/object.c b/main/object.c index b5b13ac0..ef9d9405 100644 --- a/main/object.c +++ b/main/object.c @@ -1572,12 +1572,12 @@ void dead_player_frame(void) if (time_dead > DEATH_SEQUENCE_EXPLODE_TIME) { if (!Player_exploded) { - if (Players[Player_num].hostages_on_board > 1) - HUD_init_message(TXT_SHIP_DESTROYED_2, Players[Player_num].hostages_on_board); - else if (Players[Player_num].hostages_on_board == 1) - HUD_init_message(TXT_SHIP_DESTROYED_1); - else - HUD_init_message(TXT_SHIP_DESTROYED_0); + if (Players[Player_num].hostages_on_board > 1) + HUD_init_message(TXT_SHIP_DESTROYED_2, Players[Player_num].hostages_on_board); + else if (Players[Player_num].hostages_on_board == 1) + HUD_init_message(TXT_SHIP_DESTROYED_1); + else + HUD_init_message(TXT_SHIP_DESTROYED_0); #ifdef TACTILE if (TactileStick) diff --git a/main/piggy.c b/main/piggy.c index 35a55c43..03ba1fb0 100644 --- a/main/piggy.c +++ b/main/piggy.c @@ -372,13 +372,13 @@ void piggy_init_pigfile(char *filename) if (stricmp(DEFAULT_PIGFILE, DEFAULT_PIGFILE_SHAREWARE) == 0 && !cfexist(filename)) filename = DEFAULT_PIGFILE_SHAREWARE; - Piggy_fp = cfopen( filename, "rb" ); + Piggy_fp = cfopen( filename, "rb" ); #if defined(MACINTOSH) && defined(SHAREWARE) // if we are in the shareware version, we must have the pig by now. - if (Piggy_fp == NULL) - { - Error("Cannot load required file <%s>",name); - } + if (Piggy_fp == NULL) + { + Error("Cannot load required file <%s>",name); + } #endif // end of if def shareware if (!Piggy_fp) { @@ -983,9 +983,9 @@ int piggy_init(void) if (piggy_low_memory) digi_lomem = 1; - gr_set_curfont( SMALL_FONT ); - gr_set_fontcolor(gr_find_closest_color_current( 20, 20, 20 ),-1 ); - gr_printf( 0x8000, grd_curcanv->cv_h-20, "%s...", TXT_LOADING_DATA ); + gr_set_curfont( SMALL_FONT ); + gr_set_fontcolor(gr_find_closest_color_current( 20, 20, 20 ),-1 ); + gr_printf( 0x8000, grd_curcanv->cv_h-20, "%s...", TXT_LOADING_DATA ); #if 1 //def EDITOR //need for d1 mission briefings piggy_init_pigfile(DEFAULT_PIGFILE); diff --git a/main/render.c b/main/render.c index ffae9a6b..35c156c7 100644 --- a/main/render.c +++ b/main/render.c @@ -829,8 +829,8 @@ void render_segment(int segnum, int window_num) // set_segment_local_light_value(segnum,INITIAL_LOCAL_LIGHT); - if (Viewer->type!=OBJ_ROBOT) - Automap_visited[segnum]=1; + if (Viewer->type!=OBJ_ROBOT) + Automap_visited[segnum]=1; for (sn=0; sn xright)) // the (xleft > xright) term is not redundant with (dx < 0) because dx is computed using integers return; - // setup to call assembler scanline renderer - if (dx < FIX_RECIP_TABLE_SIZE) - recip_dx = fix_recip[dx]; - else - recip_dx = F1_0/dx; - - du_dx = fixmul(uright - uleft,recip_dx); - dv_dx = fixmul(vright - vleft,recip_dx); - - fx_u = uleft; - fx_v = vleft; - fx_du_dx = du_dx; - fx_dv_dx = dv_dx; - fx_y = y; - fx_xright = f2i(xright); - fx_xleft = f2i(xleft); - pixptr = srcb->bm_data; - - switch (Lighting_enabled) { - case 0: - //added 07/11/99 adb - prevent writing before the buffer - if (fx_xleft < 0) - fx_xleft = 0; - //end addition -adb - - cur_tmap_scanline_lin_nolight(); - break; - case 1: - if (lleft < F1_0/2) - lleft = F1_0/2; - if (lright < F1_0/2) - lright = F1_0/2; - - if (lleft > MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS) - lleft = MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS; - if (lright > MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS) - lright = MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS; - - //added 07/11/99 adb - prevent writing before the buffer - if (fx_xleft < 0) - fx_xleft = 0; - //end addition -adb + // setup to call assembler scanline renderer + if (dx < FIX_RECIP_TABLE_SIZE) + recip_dx = fix_recip[dx]; + else + recip_dx = F1_0/dx; -{ - fix mul_thing; + du_dx = fixmul(uright - uleft,recip_dx); + dv_dx = fixmul(vright - vleft,recip_dx); - fx_l = lleft; - fx_dl_dx = fixmul(lright - lleft,recip_dx); + fx_u = uleft; + fx_v = vleft; + fx_du_dx = du_dx; + fx_dv_dx = dv_dx; + fx_y = y; + fx_xright = f2i(xright); + fx_xleft = f2i(xleft); + pixptr = srcb->bm_data; - // This is a pretty ugly hack to prevent lighting overflows. - mul_thing = dx * fx_dl_dx; - if (lleft + mul_thing < 0) - fx_dl_dx += 12; - else if (lleft + mul_thing > (NUM_LIGHTING_LEVELS*F1_0-F1_0/2)) - fx_dl_dx -= 12; -} + switch (Lighting_enabled) { + case 0: + //added 07/11/99 adb - prevent writing before the buffer + if (fx_xleft < 0) + fx_xleft = 0; + //end addition -adb + + cur_tmap_scanline_lin_nolight(); + break; + case 1: + if (lleft < F1_0/2) + lleft = F1_0/2; + if (lright < F1_0/2) + lright = F1_0/2; + + if (lleft > MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS) + lleft = MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS; + if (lright > MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS) + lright = MAX_LIGHTING_VALUE*NUM_LIGHTING_LEVELS; + + //added 07/11/99 adb - prevent writing before the buffer + if (fx_xleft < 0) + fx_xleft = 0; + //end addition -adb + + { + fix mul_thing; fx_l = lleft; - dl_dx = fixmul(lright - lleft,recip_dx); - fx_dl_dx = dl_dx; - cur_tmap_scanline_lin(); - break; - case 2: + fx_dl_dx = fixmul(lright - lleft,recip_dx); + + // This is a pretty ugly hack to prevent lighting overflows. + mul_thing = dx * fx_dl_dx; + if (lleft + mul_thing < 0) + fx_dl_dx += 12; + else if (lleft + mul_thing > (NUM_LIGHTING_LEVELS*F1_0-F1_0/2)) + fx_dl_dx -= 12; + } + + fx_l = lleft; + dl_dx = fixmul(lright - lleft,recip_dx); + fx_dl_dx = dl_dx; + cur_tmap_scanline_lin(); + break; + case 2: #ifdef EDITOR_TMAP - fx_xright = f2i(xright); - fx_xleft = f2i(xleft); - tmap_flat_color = 1; - cur_tmap_scanline_flat(); + fx_xright = f2i(xright); + fx_xleft = f2i(xleft); + tmap_flat_color = 1; + cur_tmap_scanline_flat(); #else - Int3(); // Illegal, called an editor only routine! + Int3(); // Illegal, called an editor only routine! #endif - break; - } + break; + } } // ------------------------------------------------------------------------------------- -- 2.39.2