// // file: $/wc5/doc/technical/formcock.txt // (c) origin systems, 1996 // author: hugh david // description: of cockpit iff FORM and its sub FORMs / CHUNKs // // notes: // - please keep this as a text (.txt) file // - work-in-progress // // to do: // - data sizes to be confirmed with rest of wc5 team // // - how is 'r' radius parameter to be treated within viewport ? // - concept of CHUNK NHUD (non-HUD prims in a full-screen viewport) // - CHUNK BITM depends on resolution. // - should BITMs be referred to as separate files, or be included inside (e.g.) a FORM LIST ? // - data size alignment ? // - another option is to hold COCKpit BITMaps at a really high RESolution // and pre-scale them like fonts ? // - writing to part of IFF file ? // can i update the MFD positions so the player can customize their display ? // // - allow for FRONT, BACK, LEFT & RIGHT views thru' the COCKPIT / HUD ! // // - hardpoint locations & weapon loadout screens: // wc4 had to be able to place all weapon icons over every hardpoint of every ship ! // (also similar properties, e.g.: rotate ship about x,y,z) // // - CHUNKs TCURS & GCURS for text and graphics cursors // then it's easier to add extra strings // and switch between viewport abs & rel modes // should there be a PrimElemList class which has // list, viewport, cursor, flags member variables ? // // // simple example cockpit FORM data, showing only REQUIRED FORMs / CHUNKs: // FORM COCK { CHUNK SCAL // for individual gauge viewports { int 1,1000 // note 1-1000 scaling for extra precision } FORM TARG // target gauge { CHUNK VIEW // for TARGet primitive list { int 480,480,520,520 } FORM LIST // TARGet primitive list { CHUNK SCAL // for TARGet primitive list { int 1,100 // note 1-100 scaling, precision not too important } CHUNK COLR { int 0,255,0 // green ... } CHUNK CIRC // ... targetting circle { int 50,50,10 } } } } // // more complex example cockpit FORM data: // FORM COCK { CHUNK SCAL // for individual gauge viewports FORM TARG // target gauge { CHUNK VIEW // screen-scaled viewport FORM LIST // primitive list { CHUNK SCAL // for primitive list CHUNK COLR // pen colour for future primitives CHUNK FONT // used for future text primitives CHUNK LINE CHUNK TEXT CHUNK CIRC CHUNK TRI_ // triangle CHUNK BITM etc. } } FORM RADR // radar gauge { CHUNK VIEW // viewport FORM LIST // primitive list { CHUNK SCAL // for primitive list CHUNK COLR // pen colour for future primitives CHUNK FONT // used for future text primitives CHUNK LINE CHUNK TEXT CHUNK CIRC CHUNK TRI_ // triangle FORM SWCH // like a c switch statement { CHUNK GLWH // (Graphics Layer Width & Height) id for comparison type CHUNK CASE // 1st case int 640,480 CHUNK BITM bitmap1 CHUNK CASE // 2nd case int 800,600 CHUNK BITM bitmap2 CHUNK DEFA // default case CHUNK BITM bitmap3 } } } // also, there could be any / all of the following gauge types: FORM ITTS // targetting / tracking gauge. // viewport x0, y0 under computer-control, // but width & height should probably be constant FORM TARG // (different name) target identity / image / mini 3d model FORM POWR // power distribution (power plant) gauge FORM DAMG // damaged systems gauge FORM WEAP // weapon systems gauge (or maybe GUNS & MISL ??) FORM CAMR // camera gauge (for picture-in-picture cameras) // e.g.: missile camera, rear view camera, wingman camera FORM SHIE // player shields gauge FORM COMM // communications FORM FUEL // how much gasoline ! FORM NAV // nav-point info. FORM MISN // mission info. } // // descriptions of individual FORMs / CHUNKs: // { CHUNK VIEW // viewport // note: this is REQUIRED in all FORMs INSIDE FORM COCK long x0,y0,x1,y1 } { FORM LIST // primitive list // CHUNKs (see below) are allowed in any order // there can be >= 0 of any of the following CHUNKs } // // primitive elements: // { // REQUIRED: one as first CHUNK inside FORM COCK // REQUIRED: one as first CHUNK inside FORM LIST // OPTIONAL: this CHUNK can appear at any time anywhere // inside FORM LIST // NOTE: any divisor of 0 is illegal CHUNK SCAL long 1,640 // x scaling long 1,480 // y scaling long 1,954 // radius scaling // now, within this viewport, all coordinates are treated as: // 'actual x' = 'listed x' * viewport width * mul / div // 'actual y' = 'listed y' * viewport height * mul / div } { // to do: // all following CHUNKS within current form can only be used // if the screen resolution matches that given here: CHUNK RES int w,h // note: // w == h == -1 => will match any screen resolution } { CHUNK COLR int r,g,b } { CHUNK LINE int x0,y0,x1,y1 } { CHUNK FONT cstring8 name // to do: int[] parameter list // e.g. proportional transparent etc. } { CHUNK TCUR { long 0,0 // x,y // sets a local cursor within the current VIEWport // at which TEXT will be written // also sets the left margin to the x value // if TEXT is drawn at funny positions, use this // CHUNK to set the Text CURsor to 0,0 for the current VIEWport } } { CHUNK TEXT // eventually: long id_of_text_so_localization_is_easy // for now: cstring[16] s // if TEXT is drawn at funny positions, use the TCUR // CHUNK to set the Text CURsor to 0,0 for the current VIEWport } { CHUNK CIRC int x,y,r } { CHUNK TRI_ { long DUMMY,DUMMY // REQUIRED dummy parameters long 100,100 // xy vertex pairs ... long 900,900 // ... must be in clockwise order long 100,900 } } { // to do ?? : CHUNK POLY int vcount int[vcount] x,y } { // to do: CHUNK BITM cstring8 name } // to do: FORM SWCH { // these CHUNK ids have to be shared between code & XMF files thru' .def files CHUNK GLWH // (Graphics Layer Width & Height) id for comparison type CHUNK CASE // 1st case int 640,480 // allow any combination of FORMs & CHUNKs here ??? CHUNK BITM bitmap1 CHUNK CASE // 2nd case int 800,600 // allow any combination of FORMs & CHUNKs here ??? CHUNK BITM bitmap2 CHUNK DEFA // default case // allow any combination of FORMs & CHUNKs here ??? CHUNK BITM bitmap3 } // // types of variable primitives: // #define VAR_RECT something #define VAR_DIAL something #define VAR_STATE something #define VAR_FIXED_DIGITS something // // variables to use for drawing variable primitve: // #define USE_PLAYER_SPEED something #define USE_PLAYER_SHIELD_VALUE something CHUNK VARI { // these VARiable RECTangles include horiz & vertical lines and bars: CHUNK VAR_RECT int xstart, ystart int xstop_min, ystop_min int xstop_max, ystop_max CHUNK USE_PLAYER_SPEED int minspeed ( speed <= minspeed implies VAR_RECT at min values) int maxspeed ( speed >= maxspeed implies VAR_RECT at max values) } // to do: CHUNK VARI { // any type of rotary dial: CHUNK VAR_DIAL int xanchor int yanchor int radius int min_angle int max_angle CHUNK USE_PLAYER_SHIELD_VALUE int minspeed ( speed <= minspeed implies VAR_RECT at min values) int maxspeed ( speed >= maxspeed implies VAR_RECT at max values) } // to do: CHUNK VARI { CHUNK USE_PLAYER_SHIELD_VALUE int minspeed ( speed <= minspeed implies VAR_RECT at min values) int maxspeed ( speed >= maxspeed implies VAR_RECT at max values) // discrete-state variables CHUNK VAR_STATE CHUNK STAT int 0,35 FORM LIST { CHUNK BITM // e.g.: shields critical CHUNK COLR CHUNK LINE etc. } CHUNK STAT int 36,76 FORM LIST { CHUNK BITM // e.g.: shields damaged CHUNK COLR CHUNK LINE etc. } CHUNK STAT int 77,100 FORM LIST { CHUNK BITM // e.g.: shields ok CHUNK COLR CHUNK LINE etc. } // default behaviour ? } CHUNK VARI { CHUNK USE_PLAYER_SPEED int minspeed ( speed <= minspeed implies VAR_? at min value) int maxspeed ( speed >= maxspeed implies VAR_? at max value) CHUNK VAR_FIXED_DIGITS // maybe needs font cstring16 "Speed = " // ... speed appended as digits }