Open source remastering of the Freespace 2 engine
fredrender.cpp File Reference
#include "stdafx.h"
#include "FRED.h"
#include "FREDDoc.h"
#include "FREDView.h"
#include "MainFrm.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include "Management.h"
#include "math/vecmat.h"
#include "graphics/tmapper.h"
#include "graphics/2d.h"
#include "render/3d.h"
#include "model/model.h"
#include "bmpman/bmpman.h"
#include "io/key.h"
#include "physics/physics.h"
#include "math/floating.h"
#include "object/object.h"
#include "palman/palman.h"
#include "editor.h"
#include "ship/ship.h"
#include "cfile/cfile.h"
#include "mission/missionparse.h"
#include "globalincs/linklist.h"
#include "math/fvi.h"
#include "render/3dinternal.h"
#include "weapon/weapon.h"
#include "wing.h"
#include "FredRender.h"
#include <windows.h>
#include "starfield/starfield.h"
#include "io/timer.h"
#include "lighting/lighting.h"
#include "asteroid/asteroid.h"
#include "jumpnode/jumpnode.h"
#include "graphics/font.h"
#include "cmdline/cmdline.h"
#include "iff_defs/iff_defs.h"
#include "mod_table/mod_table.h"

Go to the source code of this file.


#define MAX_FRAMETIME   (F1_0/4)
#define MIN_FRAMETIME   (F1_0/120)
#define LOLLIPOP_SIZE   2.5f
#define CONVERT_DEGREES   57.29578f
#define FRED_COLOUR_WHITE   0xffffff
#define FRED_COLOUR_YELLOW   0x9fff00


void display_distances ()
void render_model_x (vec3d *pos, grid *gridp, int col_scheme=0)
void render_model_x_htl (vec3d *pos, grid *gridp, int col_scheme=0)
void draw_orient_sphere (object *obj, int r, int g, int b)
void draw_orient_sphere2 (int col, object *obj, int r, int g, int b)
void render_compass (void)
void draw_compass_arrow (vec3d *v0)
void process_controls (vec3d *pos, matrix *orient, float frametime, int key, int mode=0)
void render_one_model (object *objp)
void inc_mission_time ()
void draw_asteroid_field ()
void hilight_bitmap ()
void fred_enable_htl ()
void fred_disable_htl ()
void fred_render_init ()
void level_object (matrix *orient)
void level_controlled ()
void align_vector_to_axis (vec3d *v)
void verticalize_object (matrix *orient)
void verticalize_controlled ()
void move_mouse (int btn, int mdx, int mdy)
void process_system_keys (int key)
void render_waypoints (void)
vec3dget_subsystem_world_pos2 (object *parent_obj, ship_subsys *subsys, vec3d *world_pos)
int get_subsys_bounding_rect (object *ship_obj, ship_subsys *subsys, int *x1, int *x2, int *y1, int *y2)
void cancel_display_active_ship_subsystem ()
void fredhtl_render_subsystem_bounding_box (subsys_to_render *s2r)
void display_active_ship_subsystem ()
void render_one_model_htl (object *objp)
void render_one_model_nohtl (object *objp)
void render_one_model_briefing_screen (object *objp)
void render_models (void)
void display_ship_info ()
void render_active_rect (void)
void process_movement_keys (int key, vec3d *mvec, angles *angs)
void fred_render_grid (grid *gridp)
void render_frame ()
void game_do_frame ()
int object_check_collision (object *objp, vec3d *p0, vec3d *p1, vec3d *hitpos)
int select_object (int cx, int cy)


float flFrametime
subsys_to_render Render_subsys
const float FRED_DEFAULT_HTL_FOV = 0.485f
const float FRED_BRIEFING_HTL_FOV = 0.325f
const float FRED_DEAFULT_HTL_DRAW_DIST = 300000.0f
int Aa_gridlines = 0
int Fred_outline = 0
int inited = -1
int player_start1
int Editing_mode = 1
int Control_mode = 0
int last_x =0
int last_y =0
int Show_grid = 1
int Show_outlines = 0
int Show_stars = 1
int Show_grid_positions = 1
int Show_coordinates = 0
int Show_distances = 0
int Show_horizon = 0
int Show_asteroid_field = 1
int Lookat_mode = 0
int Single_axis_constraint = 0
int Universal_heading = 0
int Flying_controls_mode = 1
int Group_rotate = 1
int info_popup_active = 0
int rendering_order [MAX_SHIPS]
int render_count = 0
int Last_cursor_over = -1
int True_rw
int True_rh
int Fixed_briefing_size = 1
fix lasttime = 0
vec3d my_pos = {0.0f, 0.0f, -5.0f}
vec3d view_pos
vec3d eye_pos
vec3d Viewer_pos
vec3d Last_eye_pos = { 0.0f }
vec3d Last_control_pos = { 0.0f }
vec3d Grid_center
vec3d Constraint = { 1.0f, 0.0f, 1.0f }
vec3d Anticonstraint = { 0.0f, 1.0f, 0.0f }
vec3d Tp1
vec3d Tp2
matrix Grid_gmatrix
matrix my_orient = IDENTITY_MATRIX
matrix trackball_orient = IDENTITY_MATRIX
matrix view_orient = IDENTITY_MATRIX
matrix eye_orient
matrix Last_eye_orient = IDENTITY_MATRIX
matrix Last_control_orient = IDENTITY_MATRIX
physics_info view_physics
control_info view_controls
CWnd info_popup
color colour_white
color colour_green
color colour_black
color colour_yellow
int Fred_grid_colors_inited = 0
color Fred_grid_bright
color Fred_grid_dark
color Fred_grid_bright_aa
color Fred_grid_dark_aa

Macro Definition Documentation

#define CONVERT_DEGREES   57.29578f

Definition at line 68 of file fredrender.cpp.

#define FRED_COLOUR_WHITE   0xffffff

Definition at line 138 of file fredrender.cpp.

#define FRED_COLOUR_YELLOW   0x9fff00

Definition at line 139 of file fredrender.cpp.

#define LOLLIPOP_SIZE   2.5f

Definition at line 67 of file fredrender.cpp.

#define MAX_FRAMETIME   (F1_0/4)

Definition at line 65 of file fredrender.cpp.

#define MIN_FRAMETIME   (F1_0/120)

Definition at line 66 of file fredrender.cpp.

Function Documentation

void align_vector_to_axis ( vec3d v)

Definition at line 254 of file fredrender.cpp.

void cancel_display_active_ship_subsystem ( )

Definition at line 494 of file fredrender.cpp.

void display_active_ship_subsystem ( )

Definition at line 592 of file fredrender.cpp.

void display_distances ( )

Definition at line 997 of file fredrender.cpp.

void display_ship_info ( )

Definition at line 1035 of file fredrender.cpp.

void draw_asteroid_field ( )

Definition at line 1805 of file fredrender.cpp.

void draw_compass_arrow ( vec3d v0)

Definition at line 2056 of file fredrender.cpp.

void draw_orient_sphere ( object obj,
int  r,
int  g,
int  b 

Definition at line 1130 of file fredrender.cpp.

void draw_orient_sphere2 ( int  col,
object obj,
int  r,
int  g,
int  b 

Definition at line 1166 of file fredrender.cpp.

void fred_disable_htl ( )

Definition at line 147 of file fredrender.cpp.

void fred_enable_htl ( )

Definition at line 141 of file fredrender.cpp.

void fred_render_grid ( grid gridp)

Definition at line 1388 of file fredrender.cpp.

void fred_render_init ( )

Definition at line 155 of file fredrender.cpp.

void fredhtl_render_subsystem_bounding_box ( subsys_to_render s2r)

Definition at line 501 of file fredrender.cpp.

void game_do_frame ( )

Definition at line 1614 of file fredrender.cpp.

int get_subsys_bounding_rect ( object ship_obj,
ship_subsys subsys,
int x1,
int x2,
int y1,
int y2 

Definition at line 468 of file fredrender.cpp.

vec3d* get_subsystem_world_pos2 ( object parent_obj,
ship_subsys subsys,
vec3d world_pos 

Definition at line 454 of file fredrender.cpp.

void hilight_bitmap ( )

Definition at line 1777 of file fredrender.cpp.

void inc_mission_time ( )

Definition at line 2071 of file fredrender.cpp.

void level_controlled ( )

Definition at line 199 of file fredrender.cpp.

void level_object ( matrix orient)

Definition at line 180 of file fredrender.cpp.

void move_mouse ( int  btn,
int  mdx,
int  mdy 

Definition at line 353 of file fredrender.cpp.

int object_check_collision ( object objp,
vec3d p0,
vec3d p1,
vec3d hitpos 

Definition at line 1872 of file fredrender.cpp.

void process_controls ( vec3d pos,
matrix orient,
float  frametime,
int  key,
int  mode = 0 

Definition at line 1342 of file fredrender.cpp.

void process_movement_keys ( int  key,
vec3d mvec,
angles angs 

Definition at line 1305 of file fredrender.cpp.

void process_system_keys ( int  key)

Definition at line 379 of file fredrender.cpp.

void render_active_rect ( void  )

Definition at line 1293 of file fredrender.cpp.

void render_compass ( void  )

Definition at line 2015 of file fredrender.cpp.

void render_frame ( )

Definition at line 1460 of file fredrender.cpp.

void render_model_x ( vec3d pos,
grid gridp,
int  col_scheme = 0 

Definition at line 1207 of file fredrender.cpp.

void render_model_x_htl ( vec3d pos,
grid gridp,
int  col_scheme = 0 

Definition at line 1250 of file fredrender.cpp.

void render_models ( void  )

Definition at line 652 of file fredrender.cpp.

void render_one_model ( object objp)
void render_one_model_briefing_screen ( object objp)

Definition at line 685 of file fredrender.cpp.

void render_one_model_htl ( object objp)

Definition at line 837 of file fredrender.cpp.

void render_one_model_nohtl ( object objp)

Definition at line 700 of file fredrender.cpp.

void render_waypoints ( void  )

Definition at line 404 of file fredrender.cpp.

int select_object ( int  cx,
int  cy 

Definition at line 1930 of file fredrender.cpp.

void verticalize_controlled ( )

Definition at line 298 of file fredrender.cpp.

void verticalize_object ( matrix orient)

Definition at line 290 of file fredrender.cpp.

Variable Documentation

int Aa_gridlines = 0

Definition at line 74 of file fredrender.cpp.

vec3d Anticonstraint = { 0.0f, 1.0f, 0.0f }

Definition at line 107 of file fredrender.cpp.

color colour_black

Definition at line 135 of file fredrender.cpp.

color colour_green

Definition at line 134 of file fredrender.cpp.

color colour_white

Definition at line 133 of file fredrender.cpp.

color colour_yellow

Definition at line 136 of file fredrender.cpp.

vec3d Constraint = { 1.0f, 0.0f, 1.0f }

Definition at line 106 of file fredrender.cpp.

int Control_mode = 0

Definition at line 79 of file fredrender.cpp.

int Editing_mode = 1

Definition at line 78 of file fredrender.cpp.

matrix eye_orient

Definition at line 112 of file fredrender.cpp.

vec3d eye_pos

Definition at line 103 of file fredrender.cpp.

int Fixed_briefing_size = 1

Definition at line 99 of file fredrender.cpp.

float flFrametime

Definition at line 22 of file fredstubs.cpp.

int Flying_controls_mode = 1

Definition at line 92 of file fredrender.cpp.

const float FRED_BRIEFING_HTL_FOV = 0.325f

Definition at line 71 of file fredrender.cpp.

const float FRED_DEAFULT_HTL_DRAW_DIST = 300000.0f

Definition at line 72 of file fredrender.cpp.

const float FRED_DEFAULT_HTL_FOV = 0.485f

Definition at line 70 of file fredrender.cpp.

color Fred_grid_bright

Definition at line 1385 of file fredrender.cpp.

color Fred_grid_bright_aa

Definition at line 1385 of file fredrender.cpp.

int Fred_grid_colors_inited = 0

Definition at line 1384 of file fredrender.cpp.

color Fred_grid_dark

Definition at line 1385 of file fredrender.cpp.

color Fred_grid_dark_aa

Definition at line 1385 of file fredrender.cpp.

int Fred_outline = 0

Definition at line 75 of file fredrender.cpp.

vec3d Grid_center

Definition at line 105 of file fredrender.cpp.

matrix Grid_gmatrix

Definition at line 109 of file fredrender.cpp.

int Group_rotate = 1

Definition at line 93 of file fredrender.cpp.

CWnd info_popup

Definition at line 116 of file fredrender.cpp.

int info_popup_active = 0

Definition at line 94 of file fredrender.cpp.

int inited = -1

Definition at line 76 of file fredrender.cpp.

matrix Last_control_orient = IDENTITY_MATRIX

Definition at line 113 of file fredrender.cpp.

vec3d Last_control_pos = { 0.0f }

Definition at line 104 of file fredrender.cpp.

int Last_cursor_over = -1

Definition at line 97 of file fredrender.cpp.

matrix Last_eye_orient = IDENTITY_MATRIX

Definition at line 112 of file fredrender.cpp.

vec3d Last_eye_pos = { 0.0f }

Definition at line 103 of file fredrender.cpp.

int last_x =0

Definition at line 80 of file fredrender.cpp.

int last_y =0

Definition at line 80 of file fredrender.cpp.

fix lasttime = 0

Definition at line 101 of file fredrender.cpp.

int Lookat_mode = 0

Definition at line 89 of file fredrender.cpp.

matrix my_orient = IDENTITY_MATRIX

Definition at line 110 of file fredrender.cpp.

vec3d my_pos = {0.0f, 0.0f, -5.0f}

Definition at line 102 of file fredrender.cpp.

int player_start1

Definition at line 77 of file fredrender.cpp.

int render_count = 0

Definition at line 96 of file fredrender.cpp.

subsys_to_render Render_subsys

Definition at line 70 of file fredview.cpp.

int rendering_order[MAX_SHIPS]

Definition at line 95 of file fredrender.cpp.

int Show_asteroid_field = 1

Definition at line 88 of file fredrender.cpp.

int Show_coordinates = 0

Definition at line 85 of file fredrender.cpp.

int Show_distances = 0

Definition at line 86 of file fredrender.cpp.

int Show_grid = 1

Definition at line 81 of file fredrender.cpp.

int Show_grid_positions = 1

Definition at line 84 of file fredrender.cpp.

int Show_horizon = 0

Definition at line 87 of file fredrender.cpp.

int Show_outlines = 0

Definition at line 82 of file fredrender.cpp.

int Show_stars = 1

Definition at line 83 of file fredrender.cpp.

int Single_axis_constraint = 0

Definition at line 90 of file fredrender.cpp.

vec3d Tp1

Definition at line 108 of file fredrender.cpp.

vec3d Tp2

Definition at line 108 of file fredrender.cpp.

matrix trackball_orient = IDENTITY_MATRIX

Definition at line 111 of file fredrender.cpp.

int True_rh

Definition at line 98 of file fredrender.cpp.

int True_rw

Definition at line 98 of file fredrender.cpp.

int Universal_heading = 0

Definition at line 91 of file fredrender.cpp.

control_info view_controls

Definition at line 115 of file fredrender.cpp.

matrix view_orient = IDENTITY_MATRIX

Definition at line 112 of file fredrender.cpp.

physics_info view_physics

Definition at line 114 of file fredrender.cpp.

vec3d view_pos

Definition at line 103 of file fredrender.cpp.

vec3d Viewer_pos

Definition at line 103 of file fredrender.cpp.