| 1 |
S E A R C H A N D R E S C U E |
| 2 |
|
| 3 |
V E R S I O N 0.8.4 |
| 4 |
|
| 5 |
HACKING GUIDE |
| 6 |
|
| 7 |
|
| 8 |
For contributors, builders, or those interested in the finer |
| 9 |
details behind the scenes; this document details the source |
| 10 |
files with their related purpose in this program along with |
| 11 |
outlines of non-intuitive areas of the code. |
| 12 |
|
| 13 |
Note: Version represented in this document may be out of date, |
| 14 |
verify version above with actual version of accompanying source. |
| 15 |
|
| 16 |
-------- |
| 17 |
CONTENTS |
| 18 |
|
| 19 |
* Submitting Changes |
| 20 |
* Source Layout |
| 21 |
|
| 22 |
------------------ |
| 23 |
SUBMITTING CHANGES |
| 24 |
|
| 25 |
If you have a patch or a change you'd like to submit, please |
| 26 |
send an e-mail to [email protected]. The e-mail shold include |
| 27 |
|
| 28 |
* Your name, so you can get credit |
| 29 |
* A brief descrption of the change |
| 30 |
* An attachment with the patch |
| 31 |
|
| 32 |
We prefer small patches with lots of documentation. We respond to |
| 33 |
all received patches, so if you didn't hear back from us within a week, |
| 34 |
the e-mail got lost in a spam filter. Please resubmit or contact us |
| 35 |
via the forum at http://searchandrescue.forumwise.com |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
------------- |
| 40 |
SOURCE LAYOUT |
| 41 |
|
| 42 |
Note, $TOPLEVEL represents this source's toplevel directory. |
| 43 |
Most (not all) .c and .cpp files will have an accompany .h file |
| 44 |
with the same name. |
| 45 |
|
| 46 |
|
| 47 |
In $TOPLEVEL/include: |
| 48 |
|
| 49 |
These file are global include files for most of the general |
| 50 |
globally shared functions. |
| 51 |
|
| 52 |
In $TOPLEVEL/sar: |
| 53 |
|
| 54 |
This is the source directory for the program. |
| 55 |
|
| 56 |
Makefile.* Makefiles for compiling and installing under |
| 57 |
UNIXes. |
| 58 |
|
| 59 |
Makefile.srclist List of header files and sources for |
| 60 |
other Makefiles. |
| 61 |
|
| 62 |
cmd.c SAR Command line front end, passes inputs to |
| 63 |
other functions in cmd*.c sources. See cmd.h |
| 64 |
for a list of command and function pointer |
| 65 |
referances. |
| 66 |
|
| 67 |
cmd*.c SAR Command line handler functions. |
| 68 |
|
| 69 |
config.h SAR Globally configurable constants. |
| 70 |
|
| 71 |
cp.c Control panel |
| 72 |
|
| 73 |
cpins*.c Control panel instruments |
| 74 |
|
| 75 |
explosion.c Explosion (and splash) object creation. |
| 76 |
|
| 77 |
fire.c Fire object creation. |
| 78 |
|
| 79 |
gctl.c Game controller (keyboard, joystick, etc) input |
| 80 |
wrapper, takes input from device specific |
| 81 |
functions and updates the game controller (gctl) |
| 82 |
values which other functions rely on for |
| 83 |
controller values. |
| 84 |
|
| 85 |
gw.h GUI wrapper header. |
| 86 |
|
| 87 |
gww.cpp MSW GUI wrapper functions. |
| 88 |
|
| 89 |
gwx.c X11 GUI wrapper functions. |
| 90 |
|
| 91 |
gwx_dialog.c X11 GUI dialog wrapper functions (since Xlib |
| 92 |
does not have a built in dialog system). |
| 93 |
|
| 94 |
horizon.c Generates a 1d horizon texture. |
| 95 |
|
| 96 |
human.c Human object preset list, manages a preset list of |
| 97 |
values for creation of standard human objects. |
| 98 |
|
| 99 |
humanio.c Human object preset list file IO. |
| 100 |
|
| 101 |
image.c IO and drawing of images, using the GUI |
| 102 |
wrapper functions to draw them. |
| 103 |
|
| 104 |
main.c Program main function and other core |
| 105 |
operations functions (including timming, |
| 106 |
signal handler, GUI wrapper callbacks, etc). |
| 107 |
See sar.h for header info. |
| 108 |
|
| 109 |
matrixmath.c Matrix translation and rotation utilities, mostly |
| 110 |
for 3 * 1 or 3 * 3 matrix operations. |
| 111 |
|
| 112 |
menu.c SAR menu object (widgets) core. |
| 113 |
|
| 114 |
menumap.c SAR map menu object (widget) handler. |
| 115 |
|
| 116 |
messages.c Handles and draws messages printed on screen in |
| 117 |
game. |
| 118 |
|
| 119 |
mission.c Mission handling core. |
| 120 |
|
| 121 |
missionio.c SAR .mis mission file IO. |
| 122 |
|
| 123 |
musiclistio.c SAR music file referance list IO. |
| 124 |
|
| 125 |
obj.h SAR object definations. |
| 126 |
|
| 127 |
objio.c SAR .3d object file IO, also has other object |
| 128 |
load from file utils and routines. |
| 129 |
|
| 130 |
objiocb.c SAR scene and object file loading progress |
| 131 |
callback. |
| 132 |
|
| 133 |
objiopremodeled.c Creates SAR premodeled objects. |
| 134 |
|
| 135 |
objsound.c SAR object sound source management. |
| 136 |
|
| 137 |
objutils.c SAR scene and object utility functions, |
| 138 |
including deleting, checking, list io, etc. |
| 139 |
|
| 140 |
optionio.c SAR options/preferances file IO. |
| 141 |
|
| 142 |
sar.h SAR core header file. |
| 143 |
|
| 144 |
sarcamp.c Functions for dealing with random Campaigns. |
| 145 |
|
| 146 |
sarcamp.h Headers and definitions for working with Campaigns. |
| 147 |
|
| 148 |
sardraw.c SAR in game drawing routines, uses OpenGL |
| 149 |
and a bit of the GUI wrapper code. |
| 150 |
|
| 151 |
sardrawhelipad.c SAR helipad drawing (also for drawing map |
| 152 |
icon of helipad). |
| 153 |
|
| 154 |
sardrawhuman.c SAR human drawing. |
| 155 |
|
| 156 |
sardrawpremodeled.c Supplmentary functions for sardraw.c |
| 157 |
to draw premodeled SAR objects. |
| 158 |
|
| 159 |
sardrawrunway.c SAR runway drawing (also for drawing map icon |
| 160 |
of runway). |
| 161 |
|
| 162 |
sarfio.c SAR file format (scenery, mission, and log files) |
| 163 |
IO. This module allocates and deallocates |
| 164 |
parameters, see sarfioopen.c for actual loading |
| 165 |
of parameters from file and sarfiosave.c for |
| 166 |
actual writing of parameters to file. |
| 167 |
|
| 168 |
sarfioopen.c SAR file format loading, loads parameters from |
| 169 |
file. |
| 170 |
|
| 171 |
sarfiosave.c SAR file format writing, writes parameters to |
| 172 |
file. |
| 173 |
|
| 174 |
sarfps.c Frames per second tallying functions. |
| 175 |
|
| 176 |
sarinstall.c Creates/coppies global program |
| 177 |
configuration and data files/dirs to |
| 178 |
local user's directory. |
| 179 |
|
| 180 |
sarkey.c In game keyboard key handling, called from |
| 181 |
functions in main.c. If key input is not |
| 182 |
handled, it will be passed to the gctl.c |
| 183 |
functions. |
| 184 |
|
| 185 |
sarmenubuild.c Creates the menu and their menu objects |
| 186 |
(widgets), then sets up the initial data and |
| 187 |
callbacks. |
| 188 |
|
| 189 |
sarmenucb.c SAR menu callback handlers. |
| 190 |
|
| 191 |
sarmenuoptions.c SAR supplmentary callbacks for the options |
| 192 |
menu, also includes options fetch and apply |
| 193 |
to menu objects (widgets) functions. See also |
| 194 |
optionio.c and sarmenucb.c. |
| 195 |
|
| 196 |
sarsimbegin.c SAR simulation begin procedure for free flight |
| 197 |
and missions. This is used to switch from menus |
| 198 |
to simulation and load a scenery or mission. |
| 199 |
|
| 200 |
sarsimend.c SAR simulation end procedure and tabulation for |
| 201 |
missions. This is used to end a simulation (with |
| 202 |
or without a mission) and switch back to the |
| 203 |
menus. |
| 204 |
|
| 205 |
sarsound.c SAR sound object management, handles things like |
| 206 |
sound object creations, background music updating, |
| 207 |
and engine sound object adjustments. See also |
| 208 |
scenesound.c and sound.c. |
| 209 |
|
| 210 |
sarsplash.c Splash screen procedure, called after graphics |
| 211 |
wrapper is just initialized by SARInit(). |
| 212 |
|
| 213 |
sartime.c SAR time utility functions. |
| 214 |
|
| 215 |
sarutils.c SAR primary utility functions that handle SAR |
| 216 |
global and core level things. |
| 217 |
|
| 218 |
sarreality.h SAR simulation, reality, and timming constants. |
| 219 |
|
| 220 |
sceneio.c SAR .scn scene file loading, subsequently calls |
| 221 |
load object routines in objio.c. The scene |
| 222 |
deallocation function is also in here. |
| 223 |
|
| 224 |
scenesound.c Updates SAR scene sound resources, should be |
| 225 |
used after all objects are loaded when sound needs |
| 226 |
to be realized or during simulation when the sound |
| 227 |
level changes. |
| 228 |
|
| 229 |
sfm*.c SAR Flight Dynamics Model (SFM) library, called |
| 230 |
by the sim*.c functions. |
| 231 |
Note that this is really an intigrated library, |
| 232 |
it may be made into a shared library (so) later |
| 233 |
on. |
| 234 |
|
| 235 |
sfm.c SFM realm init, shutdown, and management. |
| 236 |
|
| 237 |
sfmmath.c SFM math utilities, includes conversions and |
| 238 |
angle calculation functions. |
| 239 |
|
| 240 |
sfmmodel.c SFM flight dynamics model IO. |
| 241 |
|
| 242 |
sfmsimforce.c SFM flight dynamics model engine, simulates |
| 243 |
forces acted on the fdm. |
| 244 |
|
| 245 |
sim*.c SAR simulation functions, calls and manages sfm*.c |
| 246 |
functions. |
| 247 |
|
| 248 |
simcb.c SAR simulation callbacks for the SFM. |
| 249 |
|
| 250 |
simcontact.c SAR simulation object to object contact/collision |
| 251 |
checking and handling. |
| 252 |
|
| 253 |
simmanage.c SAR simulation core functions, primary |
| 254 |
calling source to the SFM functions. |
| 255 |
|
| 256 |
simop.c SAR simulation operations and procedures, mostly |
| 257 |
procedure functions called by simmanage.c. |
| 258 |
|
| 259 |
simsurface.c SAR simulation surface checking, checks position |
| 260 |
against landable/walkable ground. |
| 261 |
|
| 262 |
simutils.c SAR simulation calculation and simple |
| 263 |
modification utility functions. |
| 264 |
|
| 265 |
smoke.c SAR smoke object creation. Simple convience |
| 266 |
function to create a smoke object. See also |
| 267 |
objutils.c |
| 268 |
|
| 269 |
sound.c Y2 sound wrapper, handles playing and management |
| 270 |
of Y sound play objects. This is the lowest level |
| 271 |
of code which communicates with the sound output |
| 272 |
library and the rest of the program. See also |
| 273 |
sarsound.c and scenesound.c |
| 274 |
|
| 275 |
stategl.c Used with gw*.c* sources, manages the state of |
| 276 |
OpenGL so calling functions can enable/disable |
| 277 |
multiple times without wasting OpenGL bandwidth. |
| 278 |
|
| 279 |
text3d.c Generates gl output or a gl list of a 3d text |
| 280 |
using the x3d.c module. |
| 281 |
|
| 282 |
textinput.c In game text input prompt handling, handles |
| 283 |
drawing and key events forwarded to the text |
| 284 |
prompt. Calling functions need check if prompt |
| 285 |
is mapped before forwarding key event to it. |
| 286 |
|
| 287 |
texturelistio.c Standard textures list IO, loads a list of |
| 288 |
referances to standard textures to be loaded |
| 289 |
for each scene. |
| 290 |
|
| 291 |
v3d*.c Vertex 3D (V3D) visual models and textures IO. |
| 292 |
Note that this is really an intigrated library, |
| 293 |
it may be made into a shared library (so) later |
| 294 |
on. |
| 295 |
|
| 296 |
v3dfio.c V3D visual model file IO. |
| 297 |
|
| 298 |
v3dhf.c V3D heightfield image file IO. |
| 299 |
|
| 300 |
v3dmodel.c V3D visual model IO. |
| 301 |
|
| 302 |
v3dmh.c V3D visual model header items IO, header items |
| 303 |
used in recording the header block items in each |
| 304 |
V3D visual model. |
| 305 |
|
| 306 |
v3dmp.c V3D visual model primitives IO, primitives used |
| 307 |
on each V3D visual model. |
| 308 |
|
| 309 |
v3dtex.c V3D texture (image) file IO. |
| 310 |
|
| 311 |
weather.c Weather preset values initializing, management, |
| 312 |
shutdown, and utilities. Include utility to update |
| 313 |
a given scene structure with a selected preset |
| 314 |
weather data entry. |
| 315 |
|
| 316 |
weatherio.c Weather file IO. |
| 317 |
|
| 318 |
x3d.c X3D model file format, for loading of compile |
| 319 |
time gl models to gl output or gl list. |
| 320 |
|
| 321 |
|
| 322 |
In $TOPLEVEL/sar/fonts: |
| 323 |
|
| 324 |
Compile time bitmap fonts (used by the gw module). |
| 325 |
|
| 326 |
|
| 327 |
In $TOPLEVEL/sar/gwdata: |
| 328 |
|
| 329 |
Compile time data files for the graphics wrapper (gw module). |
| 330 |
|
| 331 |
|
| 332 |
In $TOPLEVEL/sar/gwdemos: |
| 333 |
|
| 334 |
Demo programs for the graphics wrapper (extra). |
| 335 |
|
| 336 |
|
| 337 |
In $TOPLEVEL/sar/runway: |
| 338 |
|
| 339 |
Compile time X3D models for the SAR runway. |
| 340 |
|
| 341 |
|
| 342 |
In $TOPLEVEL/sar/text3d: |
| 343 |
|
| 344 |
Compile time X3D models for the text3d module. |
| 345 |
|
| 346 |
|
| 347 |
In $TOPLEVEL/sar/utils: |
| 348 |
|
| 349 |
Utility programs used to generate the compile time fonts and |
| 350 |
such (extra). |
| 351 |
|
| 352 |
|
| 353 |
----------------- |
| 354 |
SEARCH AND RESCUE |