├── CMakeFFmpegLibavMacros.cmake ├── CMakeLists.txt ├── FindLibAV.cmake ├── FindOpenGLES2.cmake ├── FindSDL2.cmake ├── LICENSE ├── README └── src ├── avp ├── ai_sight.c ├── ai_sight.h ├── avpview.c ├── avpview.h ├── bh_agun.c ├── bh_agun.h ├── bh_ais.c ├── bh_ais.h ├── bh_alien.c ├── bh_alien.h ├── bh_binsw.c ├── bh_binsw.h ├── bh_cable.c ├── bh_cable.h ├── bh_corpse.c ├── bh_corpse.h ├── bh_deathvol.c ├── bh_deathvol.h ├── bh_debri.c ├── bh_debri.h ├── bh_dummy.c ├── bh_dummy.h ├── bh_fan.c ├── bh_fan.h ├── bh_far.c ├── bh_far.h ├── bh_fhug.c ├── bh_fhug.h ├── bh_gener.c ├── bh_gener.h ├── bh_ldoor.c ├── bh_ldoor.h ├── bh_lift.c ├── bh_lift.h ├── bh_light.c ├── bh_light.h ├── bh_lnksw.c ├── bh_lnksw.h ├── bh_ltfx.c ├── bh_ltfx.h ├── bh_marin.c ├── bh_marin.h ├── bh_mission.c ├── bh_mission.h ├── bh_near.c ├── bh_near.h ├── bh_paq.c ├── bh_paq.h ├── bh_pargen.c ├── bh_pargen.h ├── bh_plachier.c ├── bh_plachier.h ├── bh_plift.c ├── bh_plift.h ├── bh_pred.c ├── bh_pred.h ├── bh_queen.c ├── bh_queen.h ├── bh_rubberduck.c ├── bh_rubberduck.h ├── bh_selfdest.c ├── bh_selfdest.h ├── bh_snds.c ├── bh_snds.h ├── bh_spcl.c ├── bh_spcl.h ├── bh_swdor.c ├── bh_swdor.h ├── bh_track.c ├── bh_track.h ├── bh_types.c ├── bh_types.h ├── bh_videoscreen.c ├── bh_videoscreen.h ├── bh_waypt.c ├── bh_waypt.h ├── bh_weap.c ├── bh_weap.h ├── bh_xeno.c ├── bh_xeno.h ├── bonusabilities.c ├── bonusabilities.h ├── cconvars.cpp ├── cdtrackselection.cpp ├── cdtrackselection.h ├── cheatmodes.c ├── cheatmodes.h ├── comp_map.c ├── comp_shp.c ├── comp_shp.h ├── consolelog.cpp ├── consolelog.hpp ├── davehook.cpp ├── davehook.h ├── deaths.c ├── decal.c ├── decal.h ├── detaillevels.c ├── detaillevels.h ├── dynamics.c ├── dynamics.h ├── dynblock.c ├── dynblock.h ├── equates.h ├── equipmnt.c ├── equipmnt.h ├── extents.c ├── extents.h ├── game.c ├── game.h ├── game_statistics.c ├── game_statistics.h ├── gamecmds.cpp ├── gamedef.h ├── gamevars.cpp ├── hmodel.c ├── hmodel.h ├── hud.c ├── hud.h ├── huddefs.h ├── inventry.c ├── inventry.h ├── langenum.h ├── language.c ├── language.h ├── lighting.c ├── lighting.h ├── load_shp.c ├── load_shp.h ├── los.c ├── los.h ├── ltfx_exp.h ├── mempool.c ├── mempool.h ├── messagehistory.c ├── messagehistory.h ├── missions.cpp ├── missions.hpp ├── movement.c ├── paintball.c ├── paintball.h ├── particle.c ├── particle.h ├── pfarlocs.c ├── pfarlocs.h ├── pheromon.c ├── pheromon.h ├── player.c ├── player.h ├── pmove.c ├── pmove.h ├── projfont.h ├── projtext.h ├── psnd.c ├── psnd.h ├── psndproj.c ├── psndproj.h ├── pvisible.c ├── pvisible.h ├── savegame.c ├── savegame.h ├── scream.cpp ├── scream.h ├── secstats.c ├── sequnces.h ├── sfx.c ├── sfx.h ├── shapes │ └── cube.c ├── stratdef.c ├── stratdef.h ├── support │ ├── command.hpp │ ├── consbind.cpp │ ├── consbind.hpp │ ├── consbtch.cpp │ ├── consbtch.hpp │ ├── coordstr.cpp │ ├── coordstr.hpp │ ├── daemon.cpp │ ├── daemon.h │ ├── dcontext.hpp │ ├── indexfnt.cpp │ ├── indexfnt.hpp │ ├── ourbool.h │ ├── r2base.cpp │ ├── r2base.h │ ├── r2pos666.cpp │ ├── r2pos666.hpp │ ├── reflist.cpp │ ├── reflist.hpp │ ├── refobj.cpp │ ├── refobj.hpp │ ├── rentrntq.cpp │ ├── rentrntq.h │ ├── scstring.cpp │ ├── scstring.hpp │ ├── strtab.cpp │ ├── strtab.hpp │ ├── strutil.c │ ├── strutil.h │ ├── tallfont.cpp │ ├── tallfont.hpp │ ├── trig666.cpp │ ├── trig666.hpp │ ├── wrapstr.cpp │ └── wrapstr.hpp ├── targeting.c ├── targeting.h ├── track.c ├── track.h ├── triggers.c ├── triggers.h ├── weapons.c ├── weapons.h └── win95 │ ├── avpchunk.cpp │ ├── avpchunk.hpp │ ├── avpreg.cpp │ ├── avpreg.hpp │ ├── bmp2.h │ ├── cheat.c │ ├── cheat.h │ ├── chtcodes.cpp │ ├── d3d_hud.cpp │ ├── d3d_hud.h │ ├── d3d_render.cpp │ ├── d3d_render.h │ ├── datatype.h │ ├── ddplat.cpp │ ├── directplay.c │ ├── dp_func.c │ ├── dp_func.h │ ├── dplayext.c │ ├── dplayext.h │ ├── endianio.c │ ├── endianio.h │ ├── ffread.cpp │ ├── ffread.hpp │ ├── ffstdio.cpp │ ├── ffstdio.h │ ├── font.h │ ├── frontend │ ├── avp_envinfo.c │ ├── avp_envinfo.h │ ├── avp_intro.cpp │ ├── avp_intro.h │ ├── avp_menudata.c │ ├── avp_menudata.h │ ├── avp_menugfx.cpp │ ├── avp_menugfx.hpp │ ├── avp_menus.c │ ├── avp_menus.h │ ├── avp_mp_config.cpp │ ├── avp_mp_config.h │ ├── avp_userprofile.cpp │ └── avp_userprofile.h │ ├── gadgets │ ├── ahudgadg.cpp │ ├── ahudgadg.hpp │ ├── conscmnd.cpp │ ├── conscmnd.hpp │ ├── conssym.cpp │ ├── conssym.hpp │ ├── consvar.cpp │ ├── consvar.hpp │ ├── gadget.cpp │ ├── gadget.h │ ├── hudgadg.cpp │ ├── hudgadg.hpp │ ├── rootgadg.cpp │ ├── rootgadg.hpp │ ├── t_ingadg.cpp │ ├── t_ingadg.hpp │ ├── teletype.cpp │ ├── teletype.hpp │ ├── textexp.cpp │ ├── textexp.hpp │ ├── textin.cpp │ ├── textin.hpp │ ├── trepgadg.cpp │ └── trepgadg.hpp │ ├── gameplat.h │ ├── gammacontrol.cpp │ ├── gammacontrol.h │ ├── heap_tem.hpp │ ├── hierplace.cpp │ ├── hierplace.hpp │ ├── hud_data.h │ ├── hud_layout.h │ ├── hudgfx.h │ ├── iofocus.cpp │ ├── iofocus.h │ ├── jsndsup.cpp │ ├── jsndsup.h │ ├── kzsort.c │ ├── kzsort.h │ ├── langplat.c │ ├── modcmds.cpp │ ├── modcmds.hpp │ ├── multmenu.h │ ├── npcsetup.cpp │ ├── npcsetup.h │ ├── objsetup.cpp │ ├── objsetup.hpp │ ├── pathchnk.cpp │ ├── pathchnk.hpp │ ├── pcmenus.cpp │ ├── pcmenus.h │ ├── platsup.c │ ├── pldghost.c │ ├── pldghost.h │ ├── pldnet.c │ ├── pldnet.h │ ├── progress_bar.cpp │ ├── progress_bar.h │ ├── projload.cpp │ ├── projload.hpp │ ├── psndplat.c │ ├── psndplat.h │ ├── scrshot.cpp │ ├── scrshot.hpp │ ├── strachnk.cpp │ ├── strachnk.hpp │ ├── system.c │ ├── system.h │ ├── usr_io.c │ ├── usr_io.h │ ├── vision.c │ ├── vision.h │ ├── vmanpset.h │ └── winmain.c ├── bink.c ├── bink.h ├── cdplayer.c ├── cdplayer.h ├── files.c ├── files.h ├── fixer.h ├── fmv.c ├── fmv.h ├── frustum.c ├── frustum.h ├── include ├── 3dc.h ├── mem3dc.h ├── module.h ├── prototyp.h └── shape.h ├── kshape.c ├── kshape.h ├── main.c ├── main2.c ├── map.c ├── mathline.c ├── mathline.h ├── maths.c ├── maths.h ├── md5.c ├── md5.h ├── mem3dc.c ├── mem3dcpp.cpp ├── menus.c ├── module.c ├── morph.c ├── net.c ├── net.h ├── object.c ├── oglfunc.c ├── oglfunc.h ├── openal.c ├── opengl.c ├── opengl.h ├── sdl12 ├── SDLMain.h └── SDLMain.m ├── shpanim.c ├── sphere.c ├── sphere.h ├── stubs.c ├── tables.c ├── unaligned.h ├── vdb.c ├── version.c ├── version.h ├── win95 ├── alt_tab.cpp ├── alt_tab.h ├── animchnk.cpp ├── animchnk.hpp ├── animobs.cpp ├── animobs.hpp ├── aw.h ├── awbmpld.cpp ├── awiffld.cpp ├── awpnmld.cpp ├── awtexld.cpp ├── awtexld.h ├── awtexld.hpp ├── bmpnames.cpp ├── bmpnames.hpp ├── cd_player.c ├── cd_player.h ├── chnkload.cpp ├── chnkload.h ├── chnkload.hpp ├── chnktexi.cpp ├── chnktexi.h ├── chnktype.cpp ├── chnktype.hpp ├── chunk.cpp ├── chunk.hpp ├── chunkpal.cpp ├── chunkpal.hpp ├── d3_func.cpp ├── d3_func.h ├── db.c ├── db.h ├── dd_func.cpp ├── debuglog.cpp ├── debuglog.h ├── debuglog.hpp ├── di_func.cpp ├── dummyobjectchunk.cpp ├── dummyobjectchunk.hpp ├── dxlog.c ├── dxlog.h ├── enumchnk.cpp ├── enumchnk.hpp ├── enumsch.cpp ├── enumsch.hpp ├── envchunk.cpp ├── envchunk.hpp ├── fail.c ├── fail.h ├── fragchnk.cpp ├── fragchnk.hpp ├── gsprchnk.cpp ├── gsprchnk.hpp ├── hash_tem.hpp ├── hierchnk.cpp ├── hierchnk.hpp ├── huffman.cpp ├── huffman.hpp ├── iff.cpp ├── iff.hpp ├── iff_ilbm.cpp ├── iff_ilbm.hpp ├── ilbm_ext.cpp ├── ilbm_ext.hpp ├── inline.h ├── io.c ├── list_tem.cpp ├── list_tem.hpp ├── ltchunk.cpp ├── ltchunk.hpp ├── media.cpp ├── media.hpp ├── mishchnk.cpp ├── mishchnk.hpp ├── mmx_math.asm ├── mmx_math.h ├── obchunk.cpp ├── obchunk.hpp ├── oechunk.cpp ├── oechunk.h ├── our_mem.c ├── ourasert.h ├── plat_shp.c ├── plat_shp.h ├── platform.h ├── plspecfn.c ├── showcmds.h ├── shpanim.h ├── shpchunk.cpp ├── shpchunk.hpp ├── sndchunk.cpp ├── sndchunk.hpp ├── sprchunk.cpp ├── sprchunk.hpp ├── string.cpp ├── string.hpp ├── texio.c ├── toolchnk.cpp ├── toolchnk.hpp ├── txioctrl.cpp ├── txioctrl.h ├── videomodes.cpp ├── videomodes.h ├── win_func.cpp ├── wpchunk.cpp ├── wpchunk.hpp ├── zsp.cpp └── zsp.hpp ├── winapi.c └── winfiles.c /LICENSE: -------------------------------------------------------------------------------- 1 | The copyright statement for the original version of the source code: 2 | The source code to Aliens Vs Predator is copyright (c) 1999-2000 Rebellion and 3 | is provided as is with no warranty for its suitability for use. You may not 4 | use this source code in full or in part for commercial purposes. Any use must 5 | include a clearly visible credit to Rebellion as the creators and owners, and 6 | reiteration of this license. 7 | 8 | Any changes made after the fact are not copyright Rebellion and are provided 9 | as is with no warranty for its suitability for use. You still may not use 10 | this source code in full or in part for commercial purposes. 11 | -------------------------------------------------------------------------------- /src/avp/ai_sight.h: -------------------------------------------------------------------------------- 1 | #ifndef AI_SIGHT_H 2 | #define AI_SIGHT_H 3 | 4 | #define NPC_MAX_VIEWRANGE (50000) 5 | 6 | extern int NPCCanSeeTarget(STRATEGYBLOCK *sbptr, STRATEGYBLOCK *target, int viewRange); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/avp/avpview.h: -------------------------------------------------------------------------------- 1 | #ifndef AVPVIEW_H 2 | #define AVPVIEW_H 3 | 4 | /* KJL 10:49:41 04/21/97 - avpview.h */ 5 | void AvpShowViews(void); 6 | void InitCameraValues(void); 7 | void LightSourcesInRangeOfObject(DISPLAYBLOCK *dptr); 8 | void ReflectObject(DISPLAYBLOCK *dPtr); 9 | 10 | 11 | extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/avp/bh_agun.h: -------------------------------------------------------------------------------- 1 | // RWH - the autogun code 2 | 3 | /* CDF 25/7/98 - Heaven help us. */ 4 | 5 | extern void AutoGunBehaveFun(STRATEGYBLOCK* ag_sbptr); 6 | extern void AutoGunBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 7 | //extern void CreatePlayerAutogun(void); 8 | 9 | void MakeSentrygunNear(STRATEGYBLOCK *sbPtr); 10 | void MakeSentrygunFar(STRATEGYBLOCK *sbPtr); 11 | int AGunSight_FrustrumReject(VECTORCH *localOffset); 12 | void AGunIsDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple, int wounds,VECTORCH *incoming); 13 | 14 | typedef enum { 15 | I_disabled, 16 | I_tracking, 17 | I_inactive, 18 | }AG_STATE; 19 | 20 | typedef struct autogun_behaviour_block 21 | { 22 | AG_STATE behaviourState; 23 | int stateTimer; 24 | 25 | HMODELCONTROLLER HModelController; 26 | DELTA_CONTROLLER *gun_pan; 27 | DELTA_CONTROLLER *gun_tilt; 28 | 29 | STRATEGYBLOCK *Target; 30 | char Target_SBname[SB_NAME_LENGTH]; 31 | /* A level of indirection for better control. */ 32 | VECTORCH targetTrackPos; 33 | 34 | int Gun_Pan; 35 | int Gun_Tilt; 36 | DISPLAYBLOCK *GunFlash; 37 | 38 | int incidentFlag; 39 | int incidentTimer; 40 | 41 | int ammo; 42 | int roundsFired; 43 | int volleyFired; 44 | 45 | int soundHandle; 46 | int soundHandle2; 47 | int Firing; 48 | int WhirrSoundOn; 49 | int Drama; 50 | 51 | unsigned int createdByPlayer:1; 52 | unsigned int gunpandir :1; 53 | unsigned int guntiltdir :1; 54 | unsigned int IAmFar :1; 55 | 56 | unsigned int OnTarget :1; 57 | unsigned int OnTarget_LastFrame :1; 58 | 59 | char death_target_ID[SB_NAME_LENGTH]; 60 | STRATEGYBLOCK* death_target_sbptr; 61 | int death_target_request; 62 | 63 | }AUTOGUN_STATUS_BLOCK; 64 | 65 | 66 | typedef struct autogun_tools_template 67 | { 68 | VECTORCH position; 69 | EULER orientation; 70 | 71 | int ammo; 72 | int shapenum; 73 | int startInactive; 74 | 75 | char nameID[SB_NAME_LENGTH]; 76 | 77 | char death_target_ID[SB_NAME_LENGTH]; 78 | int death_target_request; 79 | 80 | }AUTOGUN_TOOLS_TEMPLATE; 81 | 82 | #define SGUN_PITCH_GIMBALL (1024) 83 | #define SGUN_PAN_GIMBALL (1024) 84 | #define AGUN_NEAR_VIEW_WIDTH 500 /* mm */ 85 | 86 | #define AGUN_ROF (30) 87 | #define AGUN_VOLLEYSIZE (15) 88 | -------------------------------------------------------------------------------- /src/avp/bh_cable.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_cable_h 2 | #define _bh_cable_h 1 3 | 4 | #ifdef __cplusplus 5 | 6 | extern "C" { 7 | 8 | #endif 9 | 10 | extern void* PowerCableBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 11 | extern void PowerCableBehaveFun(STRATEGYBLOCK* sbptr); 12 | 13 | 14 | #define CABLE_HEALTH_DISTANCE 2000 15 | 16 | typedef struct power_cable_behav_block 17 | { 18 | AVP_BEHAVIOUR_TYPE bhvr_type; 19 | 20 | char nameID[SB_NAME_LENGTH]; 21 | 22 | VECTORCH position; 23 | 24 | int max_charge; //health value in fixed point 25 | int current_charge; //ditto 26 | int recharge_rate; //recharge rate per second 27 | }POWER_CABLE_BEHAV_BLOCK; 28 | 29 | typedef struct power_cable_tools_template 30 | { 31 | char nameID[SB_NAME_LENGTH]; 32 | VECTORCH position; 33 | int max_charge; 34 | int current_charge; 35 | int recharge_rate; 36 | }POWER_CABLE_TOOLS_TEMPLATE; 37 | 38 | 39 | 40 | 41 | 42 | #ifdef __cplusplus 43 | 44 | }; 45 | 46 | #endif 47 | 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/avp/bh_corpse.h: -------------------------------------------------------------------------------- 1 | #ifndef bh_corpse_h_included 2 | #define bh_corpse_h_included 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #define CORPSE_SIGHTINGS 1 8 | 9 | typedef struct netcorpsedatablock { 10 | int timer; 11 | int validityTimer; 12 | int SoundHandle; /* Just in case. */ 13 | int SoundHandle2; 14 | int SoundHandle3; 15 | int SoundHandle4; 16 | HMODELCONTROLLER HModelController; 17 | 18 | AVP_BEHAVIOUR_TYPE Type; 19 | HITLOCATIONTABLE *hltable; 20 | int GibbFactor; 21 | DEATH_DATA *This_Death; 22 | /* If you're a predator... */ 23 | PRED_CLOAKSTATE CloakStatus; 24 | int CloakTimer; 25 | int destructTimer; 26 | /* If you're a marine... */ 27 | void (*WeaponMisfireFunction)(SECTION_DATA *, int *); 28 | SECTION_DATA *My_Gunflash_Section; 29 | SECTION *TemplateRoot; 30 | struct marine_weapon_data *My_Weapon; 31 | int weapon_variable; 32 | int Android; 33 | int ARealMarine; 34 | /* If you're an alien... */ 35 | int subtype; 36 | 37 | int Wounds; 38 | 39 | int DeathFiring :1; 40 | 41 | 42 | }NETCORPSEDATABLOCK; 43 | 44 | extern void Convert_Alien_To_Corpse(STRATEGYBLOCK *sbPtr,DEATH_DATA *this_death,DAMAGE_PROFILE* damage); 45 | extern void Convert_Predator_To_Corpse(STRATEGYBLOCK *sbPtr,DEATH_DATA *this_death); 46 | extern void Convert_Marine_To_Corpse(STRATEGYBLOCK *sbPtr,DEATH_DATA *this_death); 47 | extern void Convert_Xenoborg_To_Corpse(STRATEGYBLOCK *sbPtr,DEATH_DATA *this_death); 48 | extern void CorpseBehaveFun(STRATEGYBLOCK *sbPtr); 49 | extern void MakeCorpseNear(STRATEGYBLOCK *sbPtr); 50 | extern void MakeCorpseFar(STRATEGYBLOCK *sbPtr); 51 | extern void CorpseIsDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple, int wounds,SECTION_DATA *Section,VECTORCH *incoming); 52 | 53 | #define CORPSE_EXPIRY_TIME (ONE_FIXED*10) 54 | #define CORPSE_VALIDITY_TIME (ONE_FIXED>>2) 55 | #define ALIEN_DYINGTIME (ONE_FIXED*8) 56 | #define PRED_DIETIME (ONE_FIXED*16) 57 | #define MARINE_DYINGTIME (ONE_FIXED*16) 58 | #define XENO_DYINGTIME (ONE_FIXED*8) 59 | #define AGUN_DYINGTIME (ONE_FIXED*8) 60 | #define HDEBRIS_LIFETIME (ONE_FIXED*8) 61 | /* Was (ONE_FIXED*3)... */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/avp/bh_deathvol.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_deathvol_h 2 | #define _bh_deathvol_h 1 3 | 4 | #ifdef __cplusplus 5 | 6 | extern "C" { 7 | 8 | #endif 9 | 10 | extern void* DeathVolumeBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 11 | extern void DeathVolumeBehaveFun(STRATEGYBLOCK* sbptr); 12 | 13 | 14 | typedef struct death_volume_behav_block 15 | { 16 | AVP_BEHAVIOUR_TYPE bhvr_type; 17 | VECTORCH volume_min; 18 | VECTORCH volume_max; 19 | unsigned int damage_per_second; //0 means infinite damage (a proper death volume - bwa ha ha.) 20 | unsigned int active :1; 21 | unsigned int collision_required :1; 22 | }DEATH_VOLUME_BEHAV_BLOCK; 23 | 24 | typedef struct death_volume_tools_template 25 | { 26 | char nameID[SB_NAME_LENGTH]; 27 | VECTORCH volume_min; 28 | VECTORCH volume_max; 29 | unsigned int damage_per_second; 30 | unsigned int active :1; 31 | unsigned int collision_required :1; 32 | }DEATH_VOLUME_TOOLS_TEMPLATE; 33 | 34 | 35 | 36 | 37 | 38 | #ifdef __cplusplus 39 | 40 | }; 41 | 42 | #endif 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/avp/bh_debri.h: -------------------------------------------------------------------------------- 1 | #ifndef BH_DEBRI_H 2 | #define BH_DEBRI_H 3 | 4 | typedef struct OneShotAnimBehaviourType 5 | { 6 | int counter; 7 | TXACTRLBLK *tac_os; 8 | } ONESHOT_ANIM_BEHAV_BLOCK; 9 | 10 | typedef struct SmokeGenBehaviourType 11 | { 12 | int counter; 13 | int smokes; 14 | } SMOKEGEN_BEHAV_BLOCK; 15 | 16 | typedef struct HierarchicalDebrisBehaviourType { 17 | int counter; 18 | int smokes; 19 | int GibbFactor; 20 | int Android; 21 | HMODELCONTROLLER HModelController; 22 | 23 | /* behaviour type of parent object, e.g. I_BehaviourAlien */ 24 | AVP_BEHAVIOUR_TYPE Type; 25 | int SubType; 26 | 27 | /* Silly stuff for bouncing sounds. */ 28 | int bouncelastframe; 29 | enum soundindex Bounce_Sound; 30 | 31 | } HDEBRIS_BEHAV_BLOCK; 32 | 33 | // extern functions 34 | 35 | extern DISPLAYBLOCK *MakeDebris(AVP_BEHAVIOUR_TYPE bhvr, VECTORCH *positionPtr); 36 | extern DISPLAYBLOCK *MakeHierarchicalDebris(STRATEGYBLOCK *parent_sbPtr,SECTION_DATA *root, VECTORCH *positionPtr, MATRIXCH *orientation, int *wounds, int speed); 37 | extern void Pop_Section(STRATEGYBLOCK *sbPtr,SECTION_DATA *section_data, VECTORCH *blastcentre, int *wounds); 38 | extern void CreateShapeInstance(MODULEMAPBLOCK *mmbptr, char *shapeNamePtr); 39 | extern void OneShotBehaveFun(STRATEGYBLOCK* sptr); 40 | extern void OneShot_Anim_BehaveFun(STRATEGYBLOCK* sptr); 41 | extern void MakeFragments (STRATEGYBLOCK *sbptr); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/avp/bh_dummy.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _bhdummy_h_ 3 | #define _bhdummy_h_ 1 4 | 5 | 6 | #ifdef __cplusplus 7 | 8 | extern "C" { 9 | 10 | #endif 11 | 12 | #include "bh_ais.h" 13 | 14 | typedef struct dummyStatusBlock { 15 | I_PLAYER_TYPE PlayerType; 16 | int incidentFlag; 17 | int incidentTimer; 18 | HMODELCONTROLLER HModelController; 19 | } DUMMY_STATUS_BLOCK; 20 | 21 | 22 | extern void MakeDummyNear(STRATEGYBLOCK *sbPtr); 23 | extern void MakeDummyFar(STRATEGYBLOCK *sbPtr); 24 | extern void DummyBehaviour(STRATEGYBLOCK *sbPtr); 25 | 26 | 27 | #ifdef __cplusplus 28 | 29 | } 30 | 31 | #endif 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/avp/bh_fan.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_fan_h_ 2 | #define _bh_fan_h_ 1 3 | 4 | 5 | #ifdef __cplusplus 6 | 7 | extern "C" { 8 | 9 | #endif 10 | 11 | void* FanBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 12 | void FanBehaveFun(STRATEGYBLOCK* sbptr); 13 | 14 | 15 | 16 | typedef enum fan_states 17 | { 18 | fan_state_go, 19 | fan_state_stop, 20 | }FAN_STATE; 21 | 22 | 23 | typedef struct fan_behav_block 24 | { 25 | AVP_BEHAVIOUR_TYPE bhvr_type; 26 | 27 | FAN_STATE state; 28 | 29 | TRACK_CONTROLLER* track; 30 | 31 | int speed_up_mult; //one over time take to get to full speed 32 | int slow_down_mult; //one over time take to stop 33 | int speed_mult; //0 to one_fixed : current speed relative to full speed 34 | 35 | VECTORCH fan_wind_direction; //normalised vector 36 | int fan_wind_strength; //fixed point multiplier for fan at full speed 37 | 38 | int wind_speed;//fixed point multiplier , taking the fan's current speed into account 39 | 40 | }FAN_BEHAV_BLOCK; 41 | 42 | 43 | typedef struct fan_tools_template 44 | { 45 | char nameID[SB_NAME_LENGTH]; 46 | int shape_num; 47 | 48 | VECTORCH position; 49 | EULER orientation; 50 | 51 | int speed_up_mult; //one over time take to get to full speed 52 | int slow_down_mult; //one over time take to stop 53 | 54 | TRACK_CONTROLLER* track; 55 | 56 | VECTORCH fan_wind_direction; //normalised vector 57 | int fan_wind_strength; //fixed point multiplier 58 | }FAN_TOOLS_TEMPLATE; 59 | 60 | 61 | #ifdef __cplusplus 62 | 63 | }; 64 | 65 | #endif 66 | 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/avp/bh_far.h: -------------------------------------------------------------------------------- 1 | 2 | /*------------------------Patrick 26/11/96----------------------------- 3 | Header file for FAR AI alien behaviour 4 | --------------------------------------------------------------------*/ 5 | 6 | #ifndef _bhfar_h_ 7 | #define _bhfar_h_ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | /* enum for far alien target module status */ 15 | typedef enum fnpc_targetmodulestatus 16 | { 17 | NPCTM_NoEntryPoint, 18 | NPCTM_NormalRoom, 19 | NPCTM_AirDuct, 20 | NPCTM_LiftTeleport, 21 | NPCTM_ProxDoorOpen, 22 | NPCTM_ProxDoorNotOpen, 23 | NPCTM_LiftDoorOpen, 24 | NPCTM_LiftDoorNotOpen, 25 | NPCTM_SecurityDoorOpen, 26 | NPCTM_SecurityDoorNotOpen, 27 | 28 | 29 | } NPC_TARGETMODULESTATUS; 30 | 31 | /* prototypes */ 32 | extern void FarAlienBehaviour(STRATEGYBLOCK *sbPtr); 33 | extern void BuildFarModuleLocs(void); 34 | extern void KillFarModuleLocs(void); 35 | 36 | extern void LocateFarNPCInModule(STRATEGYBLOCK *sbPtr, MODULE *targetModule); 37 | extern void LocateFarNPCInAIModule(STRATEGYBLOCK *sbPtr, AIMODULE *targetModule); 38 | extern NPC_TARGETMODULESTATUS GetTargetAIModuleStatus(STRATEGYBLOCK *sbPtr, AIMODULE *targetModule, int alien); 39 | 40 | extern AIMODULE *FarNPC_GetTargetAIModuleForHunt(STRATEGYBLOCK *sbPtr,int alien); 41 | extern AIMODULE *FarNPC_GetTargetAIModuleForGlobalHunt(STRATEGYBLOCK *sbPtr); 42 | extern AIMODULE *FarNPC_GetTargetAIModuleForWander(STRATEGYBLOCK *sbPtr, AIMODULE *exception, int alien); 43 | extern AIMODULE *FarNPC_GetTargetAIModuleForRetreat(STRATEGYBLOCK *sbPtr); 44 | extern AIMODULE *FarNPC_GetTargetAIModuleForMarineRespond(STRATEGYBLOCK *sbPtr); 45 | extern void FarNpc_FlipAround(STRATEGYBLOCK *sbPtr); 46 | 47 | /* this define to help stop aliens coagulating in the environment */ 48 | #define MAX_GENERATORNPCSPERMODULE 5 49 | #define MAX_VISIBLEGENERATORNPCS 8 //12 50 | 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/avp/bh_ldoor.h: -------------------------------------------------------------------------------- 1 | /******************** LIFT DOORS ********************/ 2 | 3 | /* 4 | lift doors do not have to look at the environment for 5 | triggers. they wait for the controlling lift block to 6 | say open or closed. EXCEPT when the door is open it 7 | will not close if some other object is in its module 8 | */ 9 | 10 | 11 | typedef struct lift_door_behaviour_type 12 | { 13 | AVP_BEHAVIOUR_TYPE bhvr_type; 14 | DOOR_STATES door_state; 15 | MORPHCTRL *PDmctrl; 16 | 17 | DOOR_STATES request_state; 18 | 19 | int SoundHandle; 20 | 21 | /*---- Patrick 1/1/97 ----- 22 | added for far ai stratgies 23 | --------------------------*/ 24 | int door_opening_speed; 25 | int door_closing_speed; 26 | } LIFT_DOOR_BEHAV_BLOCK; 27 | 28 | 29 | typedef struct lift_door_tools_template 30 | { 31 | BOOL state; 32 | MREF my_module; 33 | int shape_open; 34 | int shape_closed; 35 | char nameID[SB_NAME_LENGTH]; 36 | 37 | int door_opening_speed; 38 | int door_closing_speed; 39 | } LIFT_DOOR_TOOLS_TEMPLATE; 40 | 41 | 42 | extern void* LiftDoorBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 43 | extern void LiftDoorBehaveFun(STRATEGYBLOCK* sbptr); 44 | -------------------------------------------------------------------------------- /src/avp/bh_ltfx.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_ltfx_h 2 | #define _bh_ltfx_h 1 3 | 4 | #include "ltfx_exp.h" 5 | 6 | 7 | typedef struct light_fx_behav_block 8 | { 9 | AVP_BEHAVIOUR_TYPE bhvr_type; 10 | 11 | LIGHT_FX_TYPE type; 12 | LIGHT_FX_STATE current_state; 13 | 14 | unsigned long fade_up_speed; 15 | unsigned long fade_down_speed; 16 | 17 | unsigned long post_fade_up_delay; 18 | unsigned long post_fade_down_delay; 19 | 20 | unsigned long fade_up_speed_multiplier; 21 | unsigned long fade_down_speed_multiplier; 22 | 23 | unsigned long post_fade_up_delay_multiplier; 24 | unsigned long post_fade_down_delay_multiplier; 25 | 26 | signed long multiplier; 27 | unsigned long timer; 28 | unsigned long timer2; 29 | 30 | signed long time_to_next_flicker_state; 31 | 32 | TXACTRLBLK *anim_control; 33 | } LIGHT_FX_BEHAV_BLOCK; 34 | 35 | typedef struct light_fx_tools_template 36 | { 37 | 38 | LightFXData light_data; 39 | 40 | char nameID[SB_NAME_LENGTH]; 41 | MREF my_module; 42 | 43 | } LIGHT_FX_TOOLS_TEMPLATE; 44 | 45 | void * LightFXBehaveInit (void * bhdata, STRATEGYBLOCK* sbptr); 46 | void LightFXBehaveFun (STRATEGYBLOCK* sbptr); 47 | 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/avp/bh_mission.h: -------------------------------------------------------------------------------- 1 | #ifndef bh_mission_h_ 2 | #define bh_mission_h 1 3 | 4 | 5 | void * MissionCompleteBehaveInit(void* bhdata,STRATEGYBLOCK* sbptr); 6 | void * MessageBehaveInit(void* bhdata,STRATEGYBLOCK* sbptr); 7 | extern void ResetMission(void* mission_objective); 8 | extern void PrintStringTableEntryInConsole(enum TEXTSTRING_ID string_id); 9 | extern void SendRequestToMessageStrategy(STRATEGYBLOCK* sbptr,BOOL state,int extended_data); 10 | extern void SendRequestToMissionStrategy(STRATEGYBLOCK* sbptr,BOOL state,int extended_data); 11 | 12 | 13 | //when this strategy receives a request state of 1 it notifies its attached mission that 14 | //it has been achieved 15 | 16 | typedef struct mission_complete_tools_template 17 | { 18 | void* mission_objective_ptr; 19 | char nameID [SB_NAME_LENGTH]; 20 | }MISSION_COMPLETE_TOOLS_TEMPLATE; 21 | 22 | typedef struct mission_complete_target 23 | { 24 | AVP_BEHAVIOUR_TYPE bhvr_type; 25 | void* mission_objective_ptr; 26 | 27 | }MISSION_COMPLETE_BEHAV_BLOCK; 28 | 29 | 30 | 31 | //this strategy displays its message upon receiving a request state of 1 32 | 33 | typedef struct message_tools_template 34 | { 35 | enum TEXTSTRING_ID string_no; 36 | char nameID [SB_NAME_LENGTH]; 37 | BOOL active; 38 | }MESSAGE_TOOLS_TEMPLATE; 39 | 40 | 41 | typedef struct message_behav_block 42 | { 43 | AVP_BEHAVIOUR_TYPE bhvr_type; 44 | enum TEXTSTRING_ID string_no; 45 | BOOL active; 46 | 47 | }MESSAGE_BEHAV_BLOCK; 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/avp/bh_near.h: -------------------------------------------------------------------------------- 1 | 2 | extern void NearAlienBehaviour(STRATEGYBLOCK *sbPtr); 3 | -------------------------------------------------------------------------------- /src/avp/bh_pargen.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_pargen_h 2 | #define _bh_pargen_h 1 3 | 4 | #ifdef __cplusplus 5 | 6 | extern "C" { 7 | 8 | #endif 9 | #include "track.h" 10 | 11 | extern void* ParticleGeneratorBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 12 | extern void ParticleGeneratorBehaveFun(STRATEGYBLOCK* sbptr); 13 | extern void SendRequestToParticleGenerator(STRATEGYBLOCK* sbptr,BOOL state,int extended_data); 14 | 15 | typedef enum particle_generator_type 16 | { 17 | PARGEN_TYPE_SPARK, 18 | PARGEN_TYPE_STEAM, 19 | PARGEN_TYPE_BLACKSMOKE, 20 | PARGEN_TYPE_FLAME, 21 | PARGEN_TYPE_LAST 22 | 23 | }PARTICLE_GENERATOR_TYPE; 24 | 25 | 26 | typedef struct particle_generator_behav_block 27 | { 28 | AVP_BEHAVIOUR_TYPE bhvr_type; 29 | 30 | VECTORCH position; 31 | MATRIXCH orientation; 32 | 33 | VECTORCH relative_position; //relative to parent object (if it exists) 34 | MATRIXCH relative_orientation; //relative to parent object (if it exists) 35 | 36 | PARTICLE_GENERATOR_TYPE type;//particle generator type 37 | 38 | TRACK_SOUND* sound; //not actually a track , but it will do 39 | 40 | STRATEGYBLOCK* parent_sbptr; 41 | 42 | int timer; //time left to next particle burst 43 | 44 | int frequency; //time between bursts 45 | int probability; //probability of particles (0 - 65536) 46 | int speed; //mm/second 47 | 48 | unsigned int active :1; //is generator currently active 49 | 50 | }PARTICLE_GENERATOR_BEHAV_BLOCK; 51 | 52 | typedef struct particle_generator_tools_template 53 | { 54 | char nameID[SB_NAME_LENGTH]; 55 | char parentID[SB_NAME_LENGTH]; 56 | VECTORCH position; 57 | MATRIXCH orientation; 58 | 59 | PARTICLE_GENERATOR_TYPE type;//particle generator type 60 | 61 | TRACK_SOUND* sound; //not actually a track , but it will do 62 | 63 | int frequency; //time between bursts 64 | int probability; //probability of particles (0 - 65536) 65 | int speed; //mm/second 66 | 67 | unsigned int active :1; 68 | }PARTICLE_GENERATOR_TOOLS_TEMPLATE; 69 | 70 | 71 | 72 | 73 | 74 | #ifdef __cplusplus 75 | 76 | }; 77 | 78 | #endif 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/avp/bh_plachier.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_plachier_h_ 2 | #define _bh_plachier_h_ 1 3 | 4 | #include "bh_track.h" //for the special_track_point structure 5 | 6 | #ifdef __cplusplus 7 | 8 | extern "C" { 9 | 10 | #endif 11 | 12 | 13 | typedef struct placed_hierarchy_sound 14 | { 15 | unsigned long inner_range; 16 | unsigned long outer_range; 17 | int max_volume; 18 | int pitch; 19 | 20 | struct loaded_sound const * sound_loaded; 21 | int activ_no; 22 | 23 | unsigned int loop:1; 24 | unsigned int playing:1; //sound should be playing (if in range) 25 | }PLACED_HIERARCHY_SOUND; 26 | 27 | typedef struct placed_hierarchy_sound_times 28 | { 29 | int start_time; 30 | int end_time; 31 | PLACED_HIERARCHY_SOUND* sound; 32 | }PLACED_HIERARCHY_SOUND_TIMES; 33 | 34 | typedef struct placed_hierarchy_sequence 35 | { 36 | int sequence_no; 37 | int sub_sequence_no; 38 | int time; 39 | unsigned int loop:1; 40 | 41 | int num_sound_times; 42 | PLACED_HIERARCHY_SOUND_TIMES* sound_times; 43 | }PLACED_HIERARCHY_SEQUENCE; 44 | 45 | 46 | typedef struct placed_hierarchy_behav_block 47 | { 48 | AVP_BEHAVIOUR_TYPE bhvr_type; 49 | 50 | HMODELCONTROLLER HModelController; 51 | 52 | PLACED_HIERARCHY_SEQUENCE* current_seq; 53 | int num_sequences; 54 | PLACED_HIERARCHY_SEQUENCE* sequences; 55 | 56 | VECTORCH* sound_location; 57 | 58 | int num_sounds; 59 | PLACED_HIERARCHY_SOUND* sounds; 60 | 61 | 62 | int num_special_track_points; 63 | SPECIAL_TRACK_POINT* special_track_points; 64 | 65 | }PLACED_HIERARCHY_BEHAV_BLOCK; 66 | 67 | 68 | typedef struct placed_hierarchy_tools_template 69 | { 70 | char nameID[SB_NAME_LENGTH]; 71 | 72 | VECTORCH position; 73 | EULER orientation; 74 | 75 | int num_sequences; 76 | PLACED_HIERARCHY_SEQUENCE* sequences; 77 | PLACED_HIERARCHY_SEQUENCE* first_sequence; 78 | BOOL playing; 79 | 80 | int num_sounds; 81 | PLACED_HIERARCHY_SOUND* sounds; 82 | 83 | int num_special_track_points; 84 | SPECIAL_TRACK_POINT* special_track_points; 85 | 86 | const char* file_name; 87 | const char* hier_name; 88 | }PLACED_HIERARCHY_TOOLS_TEMPLATE; 89 | 90 | extern void* PlacedHierarchyBehaveInit(void* bhdata,STRATEGYBLOCK* sbptr); 91 | void PlacedHierarchyBehaveFun(STRATEGYBLOCK* sbptr); 92 | void MakePlacedHierarchyNear(STRATEGYBLOCK* sbptr); 93 | void DeletePlacedHierarchy(PLACED_HIERARCHY_BEHAV_BLOCK*); 94 | void SendRequestToPlacedHierarchy(STRATEGYBLOCK* sbptr,BOOL state,int extended_data); 95 | 96 | 97 | #ifdef __cplusplus 98 | 99 | }; 100 | 101 | #endif 102 | 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /src/avp/bh_plift.h: -------------------------------------------------------------------------------- 1 | #include "track.h" 2 | /*------------------------------Patrick 14/3/97----------------------------------- 3 | Header for platform lift stuff 4 | --------------------------------------------------------------------------------*/ 5 | 6 | typedef enum platformlift_states 7 | { 8 | PLBS_AtRest, 9 | PLBS_Activating, 10 | PLBS_GoingUp, 11 | PLBS_GoingDown, 12 | } PLATFORMLIFT_STATES; 13 | 14 | typedef struct platformlift_behaviour_type 15 | { 16 | VECTORCH homePosition; 17 | int upHeight; 18 | int downHeight; 19 | int activationDelayTimer; 20 | PLATFORMLIFT_STATES state; 21 | 22 | TRACK_SOUND* sound; 23 | TRACK_SOUND* start_sound; 24 | TRACK_SOUND* end_sound; 25 | 26 | // A switch will set these flags on AssignSBNames 27 | 28 | BOOL Enabled; 29 | BOOL OneUse; //if set ,lift becomes disabled after changing position once 30 | 31 | int netMsgCount; 32 | 33 | } PLATFORMLIFT_BEHAVIOUR_BLOCK; 34 | 35 | typedef struct platformlift_tools_template 36 | { 37 | struct vectorch position; 38 | struct euler orientation; 39 | int shapeIndex; 40 | int travel; /* vertical distance from start position to end position (down = +ve) */ 41 | BOOL Enabled; 42 | BOOL OneUse; 43 | char nameID[SB_NAME_LENGTH]; 44 | 45 | TRACK_SOUND* sound; 46 | TRACK_SOUND* start_sound; 47 | TRACK_SOUND* end_sound; 48 | 49 | } PLATFORMLIFT_TOOLS_TEMPLATE; 50 | 51 | #define PLATFORMLIFT_SPEED 5000 /* mm/s */ 52 | #define PLATFORMLIFT_ACTIVATIONTIME ((ONE_FIXED*3)>>1) /* fixed point seconds */ 53 | #define PLATFORMLIFT_NUMNETMESSAGES 5 54 | 55 | void InitialisePlatformLift(void* bhdata, STRATEGYBLOCK *sbPtr); 56 | void PlatformLiftBehaviour(STRATEGYBLOCK *sbPtr); 57 | 58 | void ActivatePlatformLift(STRATEGYBLOCK *sbPtr); 59 | void SendPlatformLiftUp(STRATEGYBLOCK *sbPtr); 60 | void SendPlatformLiftDown(STRATEGYBLOCK *sbPtr); 61 | void StopPlatformLift(STRATEGYBLOCK *sbPtr); 62 | -------------------------------------------------------------------------------- /src/avp/bh_rubberduck.h: -------------------------------------------------------------------------------- 1 | extern void CreateRubberDuckBot(void); 2 | extern void CreateRubberDuck(VECTORCH *positionPtr); 3 | extern void CreateRubberDucks(void); 4 | extern void RubberDuckBehaviour(STRATEGYBLOCK *sbPtr); 5 | 6 | extern void CreateFlamingDebris(VECTORCH *positionPtr, VECTORCH *dirPtr); 7 | -------------------------------------------------------------------------------- /src/avp/bh_selfdest.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_selfdest_h 2 | #define _bh_selfdest_h 1 3 | 4 | #ifdef __cplusplus 5 | 6 | extern "C" { 7 | 8 | #endif 9 | 10 | extern void* SelfDestructBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 11 | extern void SelfDestructBehaveFun(STRATEGYBLOCK* sbptr); 12 | 13 | 14 | typedef struct self_destruct_behav_block 15 | { 16 | AVP_BEHAVIOUR_TYPE bhvr_type; 17 | int timer; //in fixed point seconds 18 | BOOL active; 19 | }SELF_DESTRUCT_BEHAV_BLOCK; 20 | 21 | typedef struct self_destruct_tools_template 22 | { 23 | char nameID[SB_NAME_LENGTH]; 24 | int timer; 25 | }SELF_DESTRUCT_TOOLS_TEMPLATE; 26 | 27 | 28 | 29 | 30 | 31 | #ifdef __cplusplus 32 | 33 | }; 34 | 35 | #endif 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/avp/bh_snds.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_snds_h 2 | #define _bh_snds_h 3 | 4 | #include "3dc.h" 5 | #include "inline.h" 6 | #include "module.h" 7 | 8 | #include "jsndsup.h" 9 | 10 | #ifdef __cplusplus 11 | 12 | extern "C" { 13 | 14 | #endif 15 | 16 | typedef struct sound_tools_template 17 | { 18 | VECTORCH position; 19 | 20 | unsigned long inner_range; 21 | unsigned long outer_range; 22 | 23 | unsigned long max_volume; 24 | unsigned long pitch; 25 | 26 | unsigned int playing :1; 27 | unsigned int loop :1; 28 | 29 | char * sound_name; 30 | LOADED_SOUND const * sound_loaded; 31 | 32 | } SOUND_TOOLS_TEMPLATE; 33 | 34 | 35 | typedef struct sound_behav_block 36 | { 37 | VECTORCH position; 38 | 39 | unsigned long inner_range; 40 | unsigned long outer_range; 41 | int max_volume; 42 | int pitch; 43 | 44 | int activ_no; 45 | 46 | char * wav_name; 47 | 48 | // sound management stuff 49 | 50 | LOADED_SOUND const * sound_loaded; 51 | 52 | BOOL sound_not_started; 53 | 54 | unsigned int playing :1; 55 | unsigned int loop :1; 56 | 57 | } SOUND_BEHAV_BLOCK; 58 | 59 | void * SoundBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 60 | void SoundBehaveFun (STRATEGYBLOCK * ); 61 | void SoundBehaveDestroy (STRATEGYBLOCK * sbptr); 62 | 63 | void StartPlacedSoundPlaying(STRATEGYBLOCK* sbptr); 64 | void StopPlacedSoundPlaying(STRATEGYBLOCK* sbptr); 65 | 66 | 67 | #ifdef __cplusplus 68 | 69 | }; // end of extern "c" 70 | 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/avp/bh_spcl.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_spcl_h 2 | #define _bh_spcl_h 1 3 | 4 | #include "3dc.h" 5 | #include "inline.h" 6 | #include "module.h" 7 | 8 | #include "stratdef.h" 9 | #include "gamedef.h" 10 | #include "bh_types.h" 11 | 12 | 13 | void * InitXenoMorphRoom (void * bhdata, STRATEGYBLOCK * sbptr); 14 | void XenoMorphRoomBehaviour (STRATEGYBLOCK * sbptr); 15 | 16 | 17 | typedef struct xeno_morph_room_tools_template 18 | { 19 | int MainShape; 20 | 21 | int ShutShape; 22 | int WallsOutShape; 23 | int ProbesInShape; 24 | 25 | MREF my_module; 26 | char nameID[SB_NAME_LENGTH]; 27 | 28 | char doorID[SB_NAME_LENGTH]; 29 | 30 | } XENO_MORPH_ROOM_TOOLS_TEMPLATE; 31 | 32 | typedef enum xeno_morph_room_state 33 | { 34 | XMRS_Idle, 35 | XMRS_SafetyChecks, 36 | XMRS_EnclosingPlayer, 37 | XMRS_WallsOut, 38 | XMRS_ProbesIn, 39 | XMRS_FadeToBlack, 40 | XMRS_Process, 41 | XMRS_Return, 42 | XMRS_ReleasePlayer, 43 | XMRS_Finished, 44 | 45 | } XENO_MORPH_ROOM_STATE; 46 | 47 | 48 | typedef struct xeno_morph_room_data 49 | { 50 | AVP_BEHAVIOUR_TYPE bhvr_type; 51 | TXACTRLBLK *tacb; 52 | 53 | MORPHCTRL *XMR_Mctrl; 54 | 55 | XENO_MORPH_ROOM_STATE XMR_State; 56 | 57 | int MainShape; 58 | int ShutShape; 59 | int WallsOutShape; 60 | int ProbesInShape; 61 | 62 | int timer; 63 | 64 | int ** pis_items_str; 65 | int ** pis_sht_str; 66 | 67 | char doorID[SB_NAME_LENGTH]; 68 | STRATEGYBLOCK* DoorToRoom; 69 | 70 | } XENO_MORPH_ROOM_DATA; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/avp/bh_swdor.h: -------------------------------------------------------------------------------- 1 | /*------------------------------Patrick 12/3/97----------------------------------- 2 | Header for Switch Operated Doors 3 | --------------------------------------------------------------------------------*/ 4 | 5 | typedef struct switch_door_behaviour_type 6 | { 7 | AVP_BEHAVIOUR_TYPE myBehaviourType; /* just for testing system integrity */ 8 | DOOR_STATES doorState; 9 | MORPHCTRL *morfControl; 10 | char linkedDoorName[SB_NAME_LENGTH]; 11 | STRATEGYBLOCK* linkedDoorPtr; 12 | int openTimer; 13 | unsigned int requestOpen :1; 14 | unsigned int requestClose :1; 15 | int SoundHandle; 16 | int doorType; // Used to determine door sound type 17 | 18 | } SWITCH_DOOR_BEHAV_BLOCK; 19 | 20 | typedef struct switch_door_tools_template 21 | { 22 | BOOL state; 23 | MREF myModule; 24 | int shapeOpen; 25 | int shapeClosed; 26 | char linkedDoorName[SB_NAME_LENGTH]; 27 | char nameID[SB_NAME_LENGTH]; 28 | } SWITCH_DOOR_TOOLS_TEMPLATE; 29 | 30 | #define DOOR_OPENSLOWSPEED (1<<16) 31 | #define DOOR_OPENFASTSPEED (1<<20) 32 | #define DOOR_CLOSESLOWSPEED (1<<17) 33 | #define DOOR_CLOSEFASTSPEED (1<<20) 34 | #define DOOR_FAROPENTIME (ONE_FIXED<<2) /* 4 seconds: DO NOT CHANGE THIS OR AI MAY NOT WORK*/ 35 | #define DOOR_OPENDISTANCE (5000) /* mm */ 36 | 37 | extern void InitialiseSwitchDoor(void* bhdata, STRATEGYBLOCK* sbptr); 38 | extern void SwitchDoorBehaviour(STRATEGYBLOCK* sbptr); 39 | extern void OpenDoor(MORPHCTRL *mctrl, int speed); 40 | extern void CloseDoor(MORPHCTRL *mctrl, int speed); 41 | -------------------------------------------------------------------------------- /src/avp/bh_track.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_track_h_ 2 | #define _bh_track_h_ 1 3 | 4 | #include "track.h" 5 | 6 | #ifdef __cplusplus 7 | 8 | extern "C" { 9 | 10 | #endif 11 | 12 | extern void* TrackObjectBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr); 13 | extern void TrackObjectBehaveFun(STRATEGYBLOCK* sbptr); 14 | extern void TrackObjectIsDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple); 15 | 16 | extern int TrackObjectGetSynchData(STRATEGYBLOCK* sbptr); 17 | extern void TrackObjectSetSynchData(STRATEGYBLOCK* sbptr,int status); 18 | 19 | typedef enum track_object_req_states 20 | { 21 | track_no_request, 22 | track_request_start, 23 | track_request_stop, 24 | track_request_startforward, 25 | track_request_startbackward, 26 | }TRACK_OBJECT_REQUEST_STATE; 27 | 28 | 29 | 30 | #ifndef TrackRequestFlag_ActiveForward 31 | #define TrackRequestFlag_ActiveForward 0x00000001 32 | #define TrackRequestFlag_ActiveBackward 0x00000002 33 | #define TrackRequestFlag_OppositeBackward 0x00000004 34 | #endif 35 | typedef struct track_point_target 36 | { 37 | 38 | char target_name [SB_NAME_LENGTH]; 39 | STRATEGYBLOCK * target_sbptr; 40 | int request; 41 | int flags; 42 | 43 | }TRACK_POINT_TARGET; 44 | 45 | typedef struct special_track_point 46 | { 47 | int track_point_no; 48 | int num_targets; 49 | 50 | TRACK_POINT_TARGET* targets; 51 | 52 | }SPECIAL_TRACK_POINT; 53 | 54 | typedef struct track_object_behav_block 55 | { 56 | AVP_BEHAVIOUR_TYPE bhvr_type; 57 | BOOL Indestructable; 58 | 59 | TRACK_CONTROLLER* to_track; 60 | 61 | TRACK_OBJECT_REQUEST_STATE request; 62 | 63 | TXACTRLBLK *to_tac;//for objects with anims on them 64 | 65 | int num_special_track_points; 66 | SPECIAL_TRACK_POINT* special_track_points; 67 | 68 | int destruct_target_request; 69 | char destruct_target_ID[SB_NAME_LENGTH]; 70 | STRATEGYBLOCK* destruct_target_sbptr; 71 | 72 | int TimeUntilNetSynchAllowed; 73 | }TRACK_OBJECT_BEHAV_BLOCK; 74 | 75 | 76 | typedef struct track_object_tools_template 77 | { 78 | char nameID[SB_NAME_LENGTH]; 79 | int shape_num; 80 | 81 | TRACK_CONTROLLER* track; 82 | 83 | VECTORCH position; 84 | EULER orientation; 85 | 86 | int num_special_track_points; 87 | SPECIAL_TRACK_POINT* special_track_points; 88 | 89 | 90 | int integrity; // 0-20 (>20 = indestructable) 91 | int destruct_target_request; 92 | char destruct_target_ID[SB_NAME_LENGTH]; 93 | 94 | }TRACK_OBJECT_TOOLS_TEMPLATE; 95 | 96 | 97 | #ifdef __cplusplus 98 | 99 | }; 100 | 101 | #endif 102 | 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /src/avp/bh_videoscreen.h: -------------------------------------------------------------------------------- 1 | #ifndef _bh_videoscreen_h 2 | #define _bh_videoscreen_h 3 | 4 | typedef struct video_screen_behav_block 5 | { 6 | AVP_BEHAVIOUR_TYPE bhvr_type; 7 | BOOL Indestructable; 8 | 9 | TXACTRLBLK *inan_tac;//for video screens with anims on them 10 | 11 | int destruct_target_request; 12 | char destruct_target_ID[SB_NAME_LENGTH]; 13 | STRATEGYBLOCK* destruct_target_sbptr; 14 | 15 | }VIDEO_SCREEN_BEHAV_BLOCK; 16 | 17 | 18 | typedef struct toolsdata_video_screen 19 | { 20 | struct vectorch position; 21 | struct euler orientation; 22 | int shapeIndex; 23 | char nameID[SB_NAME_LENGTH]; 24 | int integrity; // 0-20 (>20 = indestructable) 25 | 26 | int destruct_target_request; 27 | char destruct_target_ID[SB_NAME_LENGTH]; 28 | 29 | 30 | }TOOLS_DATA_VIDEO_SCREEN; 31 | 32 | void* InitVideoScreen(void* bhdata,STRATEGYBLOCK *sbPtr); 33 | void VideoScreenBehaviour(STRATEGYBLOCK *sbPtr); 34 | void VideoScreenIsDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/avp/bh_waypt.h: -------------------------------------------------------------------------------- 1 | /***** bh_waypt.h *****/ 2 | 3 | /***** Waypoint system code... *****/ 4 | 5 | /***** CDF 27/10/97 *****/ 6 | 7 | struct strategyblock; 8 | 9 | typedef struct waypoint_link { 10 | 11 | int link_target_index; 12 | int link_flags; 13 | 14 | } WAYPOINT_LINK; 15 | 16 | #define linkflag_oneway 0x00000001 /* link is... get this... one way! */ 17 | #define linkflag_reversed_oneway 0x00000002 /* link is one way, only NOT this way. */ 18 | #define linkflag_alienonly 0x00000004 19 | #define linkflag_largetarget 0x00000008 20 | 21 | typedef struct waypoint_volume { 22 | 23 | VECTORCH centre; /* in MODULE space! */ 24 | VECTORCH max_extents; 25 | VECTORCH min_extents; 26 | int flags; 27 | int workspace:14; 28 | unsigned int contains_npc:1; 29 | unsigned int contains_target:1; 30 | int num_links; 31 | WAYPOINT_LINK *first_link; 32 | unsigned char weighting; 33 | 34 | } WAYPOINT_VOLUME; 35 | 36 | #define wayflag_cancrawl 0x00000001 37 | 38 | typedef struct waypoint_header { 39 | 40 | int num_waypoints; 41 | WAYPOINT_VOLUME *first_waypoint; 42 | 43 | } WAYPOINT_HEADER; 44 | 45 | typedef struct waypoint_route { 46 | 47 | int num_waypoints; 48 | WAYPOINT_VOLUME *start; 49 | WAYPOINT_VOLUME *second; 50 | WAYPOINT_VOLUME *last; 51 | WAYPOINT_LINK *first_link; 52 | 53 | } WAYPOINT_ROUTE; 54 | 55 | typedef struct waypoint_manager { 56 | 57 | WAYPOINT_VOLUME *current_container; 58 | WAYPOINT_VOLUME *current_target; 59 | WAYPOINT_LINK *current_link; 60 | VECTORCH current_target_point; 61 | 62 | } WAYPOINT_MANAGER; 63 | 64 | extern void InitWaypointSystem(int npctype); 65 | extern int NPCGetWaypointDirection(WAYPOINT_HEADER *waypoints, struct strategyblock *sbPtr, VECTORCH *velocityDirection, VECTORCH *targetPosition, WAYPOINT_MANAGER *manager); 66 | extern int AlienIsAllowedToAttack(struct strategyblock *sbPtr); 67 | extern int AlienIsEncouragedToCrawl(void); 68 | extern WAYPOINT_VOLUME *GetPositionValidity(struct module *conmod, VECTORCH *position, VECTORCH *suggestion); 69 | extern void InitWaypointManager(WAYPOINT_MANAGER *manager); 70 | -------------------------------------------------------------------------------- /src/avp/bonusabilities.h: -------------------------------------------------------------------------------- 1 | /* KJL 12:09:35 10/09/98 - BonusAbilities.h */ 2 | 3 | /* KJL 12:09:43 10/09/98 - Grappling Hook */ 4 | extern void InitialiseGrapplingHook(void); 5 | extern void ActivateGrapplingHook(void); 6 | extern void HandleGrapplingHookForces(void); 7 | extern void RenderGrapplingHook(void); 8 | extern void DisengageGrapplingHook(void); 9 | void GrapplingHookBehaviour(STRATEGYBLOCK *sbPtr); 10 | -------------------------------------------------------------------------------- /src/avp/cdtrackselection.h: -------------------------------------------------------------------------------- 1 | extern void LoadCDTrackList(); 2 | extern void CheckCDAndChooseTrackIfNeeded(); 3 | extern void ResetCDPlayForLevel(); 4 | -------------------------------------------------------------------------------- /src/avp/cheatmodes.h: -------------------------------------------------------------------------------- 1 | #ifndef CHEATMODES_H 2 | #define CHEATMODES_H 3 | 4 | int AnyCheatModesAllowed(void); 5 | void CheatMode_GetNextAllowedSpecies(int *speciesPtr, int searchForward); 6 | void CheatMode_GetNextAllowedEnvironment(int *environmentPtr, int searchForward); 7 | void CheatMode_GetNextAllowedMode(int *cheatModePtr, int searchForward); 8 | void CheatMode_CheckOptionsAreValid(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/avp/comp_shp.h: -------------------------------------------------------------------------------- 1 | #ifndef __AVP_COMP_SHP_H__ 2 | #define __AVP_COMP_SHP_H__ 3 | 4 | extern SHAPEHEADER** mainshapelist; 5 | 6 | extern int start_of_loaded_shapes; 7 | 8 | extern SHAPEHEADER CUBE_header; 9 | 10 | typedef enum marineshapesenum 11 | { 12 | I_ShapeCube, 13 | I_ShapePrism, 14 | I_ShapeMarinePlayer, 15 | I_ShapePredatorPlayer, 16 | I_ShapeAlienPlayer, 17 | I_ShapeAlien, 18 | I_ShapeBloodSplash, 19 | I_ShapeBulletRicochet, 20 | I_ShapeExplosion, 21 | I_ShapeMarinePlayerCrouch, 22 | I_ShapeMarinePlayerLieDown, 23 | I_ShapeFlame1, 24 | I_ShapeFlame2, 25 | I_ShapeLGrenade, 26 | I_ShapePulseRifle, 27 | I_ShapeAAShotgun, 28 | I_ShapeCanisterGun, 29 | I_ShapeFThrower, 30 | I_ShapeSmartGun, 31 | I_ShapePig, 32 | I_ShapeLATW, 33 | I_ShapeParticle, 34 | I_ShapeRocket, 35 | I_ShapeGenerator, 36 | 37 | } MARINE_SHAPES_ENUM; 38 | 39 | extern int load_precompiled_shapes(void); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/avp/consolelog.cpp: -------------------------------------------------------------------------------- 1 | /* KJL 10:19:41 30/03/98 - ConsoleLog.cpp 2 | 3 | This file handles the mirroring of the console text 4 | to a log file. 5 | 6 | */ 7 | #include 8 | #include 9 | #include "3dc.h" 10 | #include "module.h" 11 | #include "inline.h" 12 | 13 | #include "stratdef.h" 14 | #include "gamedef.h" 15 | #include "gameplat.h" 16 | 17 | #include "debuglog.hpp" 18 | #include "consolelog.hpp" 19 | 20 | #include "bh_types.h" 21 | #include "inventry.h" 22 | #include "bh_alien.h" 23 | #include "bh_pred.h" 24 | #include "bh_xeno.h" 25 | #include "bh_paq.h" 26 | #include "bh_queen.h" 27 | #include "bh_fhug.h" 28 | #include "bh_marin.h" 29 | #include "bh_debri.h" 30 | #include "bh_weap.h" 31 | #include "bh_agun.h" 32 | #include "weapons.h" 33 | 34 | #if 0 35 | static LogFile ConsoleLogFile("ConsoleLog.txt"); 36 | #endif 37 | 38 | extern "C" 39 | { 40 | int LogConsoleTextToFile; 41 | extern void OutputBugReportToConsoleLogfile(char *messagePtr) 42 | { 43 | #if 0 44 | extern MODULE *playerPherModule; 45 | extern struct Target PlayersTarget; 46 | 47 | ConsoleLogFile.lprintf("\n*** AvP Automated Bug Report ****\n\n"); 48 | ConsoleLogFile.lprintf("Comment: %s\n\n", (char const*)messagePtr); 49 | 50 | ConsoleLogFile.lprintf("Environment: %s\n", (char const*)Env_List[AvP.CurrentEnv]->main ); 51 | ConsoleLogFile.lprintf("Game type: "); 52 | 53 | if (AvP.Network != I_No_Network) 54 | { 55 | ConsoleLogFile.lprintf("Multiplayer\n"); 56 | } 57 | else 58 | { 59 | ConsoleLogFile.lprintf("Single player\n"); 60 | } 61 | 62 | 63 | ConsoleLogFile.lprintf("Player's Species: "); 64 | switch(AvP.PlayerType) 65 | { 66 | case I_Marine: 67 | ConsoleLogFile.lprintf("Marine\n"); 68 | break; 69 | 70 | case I_Alien: 71 | ConsoleLogFile.lprintf("Alien\n"); 72 | break; 73 | 74 | case I_Predator: 75 | ConsoleLogFile.lprintf("Predator\n"); 76 | break; 77 | } 78 | 79 | ConsoleLogFile.lprintf("\nPlayer's Coords: %d,%d,%d\n",Player->ObWorld.vx,Player->ObWorld.vy,Player->ObWorld.vz); 80 | ConsoleLogFile.lprintf("Player's Module: %d '%s'\n", playerPherModule->m_index,playerPherModule->name); 81 | ConsoleLogFile.lprintf("Player's Module Coords: %d %d %d\n",playerPherModule->m_world.vx,playerPherModule->m_world.vy,playerPherModule->m_world.vz); 82 | ConsoleLogFile.lprintf("Player's Target: %d %d %d\n",PlayersTarget.Position.vx,PlayersTarget.Position.vy,PlayersTarget.Position.vz); 83 | ConsoleLogFile.lprintf("\n"); 84 | #endif 85 | } 86 | 87 | extern void OutputToConsoleLogfile(char *messagePtr) 88 | { 89 | #if 0 90 | if(LogConsoleTextToFile) 91 | { 92 | ConsoleLogFile.lprintf("%s\n", (char const*)messagePtr); 93 | } 94 | #endif 95 | } 96 | 97 | }; 98 | -------------------------------------------------------------------------------- /src/avp/consolelog.hpp: -------------------------------------------------------------------------------- 1 | /* KJL 10:19:41 30/03/98 - ConsoleLog.hpp 2 | 3 | This file handles the mirroring of the console text 4 | to a log file. 5 | 6 | */ 7 | #ifndef ConsoleLog_h_included 8 | #define ConsoleLog_h_included 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | extern void OutputToConsoleLogfile(char *messagePtr); 15 | extern void OutputBugReportToConsoleLogfile(char *messagePtr); 16 | #ifdef __cplusplus 17 | }; 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/avp/davehook.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | davehook.h 4 | 5 | 6 | Created 18/11/97 by DHM: 7 | Contains all the hooks for my code 8 | */ 9 | 10 | #ifndef _davehook 11 | #define _davehook 1 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /* Version settings *****************************************************/ 18 | 19 | /* Constants ***********************************************************/ 20 | 21 | /* Macros ***************************************************************/ 22 | 23 | /* Type definitions *****************************************************/ 24 | 25 | /* Exported globals *****************************************************/ 26 | 27 | /* Function prototypes **************************************************/ 28 | extern void DAVEHOOK_Init(void); 29 | extern void DAVEHOOK_UnInit(void); 30 | extern void DAVEHOOK_Maintain(void); 31 | 32 | extern void DAVEHOOK_ScreenModeChange_Setup(void); 33 | extern void DAVEHOOK_ScreenModeChange_Cleanup(void); 34 | 35 | 36 | 37 | 38 | /* End of the header ****************************************************/ 39 | 40 | 41 | #ifdef __cplusplus 42 | }; 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/avp/decal.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_decal_h_ /* Is this your first time? */ 2 | #define _included_decal_h_ 1 3 | 4 | #include "d3_func.h" 5 | #include "vision.h" 6 | 7 | enum DECAL_ID 8 | { 9 | DECAL_FMV=0, 10 | DECAL_SCORCHED, 11 | DECAL_BULLETHOLE, 12 | DECAL_PREDATOR_BLOOD, 13 | DECAL_ALIEN_BLOOD, 14 | DECAL_HUMAN_BLOOD, 15 | DECAL_ANDROID_BLOOD, 16 | 17 | DECAL_LASERTARGET, 18 | DECAL_SHAFTOFLIGHT, 19 | DECAL_SHAFTOFLIGHT_OUTER, 20 | 21 | MAX_NO_OF_DECAL_IDS 22 | }; 23 | 24 | typedef struct 25 | { 26 | enum DECAL_ID DecalID; 27 | VECTORCH Vertices[4]; 28 | VECTORCH Direction[4]; 29 | VECTORCH Centre; 30 | int ModuleIndex; 31 | 32 | int CurrentSize; 33 | int TargetSize; 34 | int UOffset; 35 | 36 | } DECAL; 37 | 38 | typedef struct 39 | { 40 | enum DECAL_ID DecalID; 41 | VECTORCH Vertices[4]; 42 | int ModuleIndex; 43 | int UOffset; 44 | 45 | } FIXED_DECAL; 46 | 47 | 48 | typedef struct 49 | { 50 | enum DECAL_ID DecalID; 51 | VECTORCH Vertices[4]; 52 | VECTORCH Centre; 53 | } OBJECT_DECAL; 54 | 55 | typedef struct 56 | { 57 | int StartU; 58 | int StartV; 59 | int EndU; 60 | int EndV; 61 | 62 | int MinSize; 63 | int MaxSize; 64 | int GrowthRate; 65 | 66 | int MaxSubclassNumber; 67 | int UOffsetForSubclass; 68 | 69 | enum TRANSLUCENCY_TYPE TranslucencyType; 70 | 71 | unsigned char Alpha; 72 | unsigned char RedScale[NUMBER_OF_VISION_MODES]; 73 | unsigned char GreenScale[NUMBER_OF_VISION_MODES]; 74 | unsigned char BlueScale[NUMBER_OF_VISION_MODES]; 75 | 76 | unsigned char IsLit:1; 77 | unsigned char CanCombine:1; 78 | 79 | } DECAL_DESC; 80 | 81 | 82 | typedef struct 83 | { 84 | VECTORCH Position[3]; 85 | VECTORCH Normal[3]; 86 | VECTORCH LightSource; 87 | char DotIsOnPlayer; 88 | // DPID TargetID; 89 | int TargetID; 90 | 91 | int ShouldBeDrawn; 92 | 93 | } THREE_LASER_DOT_DESC; 94 | 95 | extern void InitialiseDecalSystem(void); 96 | extern void MakeDecal(enum DECAL_ID decalID, VECTORCH *normalPtr, VECTORCH *positionPtr, int moduleIndex); 97 | extern void AddDecal(enum DECAL_ID decalID, VECTORCH *normalPtr, VECTORCH *positionPtr, int moduleIndex); 98 | extern void HandleDecalSystem(void); 99 | 100 | struct section_data; // hmodel.h 101 | extern void AddDecalToHModel(VECTORCH *normalPtr, VECTORCH *positionPtr, struct section_data *sectionPtr); 102 | void ScanHModelForDecals(DISPLAYBLOCK *objectPtr, struct section_data *sectionDataPtr); 103 | 104 | extern FIXED_DECAL* AllocateFixedDecal(void); 105 | extern void RemoveFixedDecal(void); 106 | extern void RemoveAllFixedDecals(void); 107 | 108 | 109 | extern DECAL_DESC DecalDescription[]; 110 | extern THREE_LASER_DOT_DESC PredatorLaserTarget; 111 | 112 | 113 | extern FIXED_DECAL FixedDecalStorage[]; 114 | extern int NumFixedDecals; 115 | extern int CurrentFixedDecalIndex; 116 | 117 | #define MAX_NO_OF_DECALS_PER_HIERARCHICAL_SECTION 16 118 | #endif 119 | -------------------------------------------------------------------------------- /src/avp/detaillevels.h: -------------------------------------------------------------------------------- 1 | #ifndef _detaillevels_h_ 2 | #define _detaillevels_h_ 1 3 | typedef struct 4 | { 5 | unsigned int MaximumAllowedNumberOfDecals; 6 | unsigned int AlienEnergyViewThreshold; 7 | unsigned int NumberOfSmokeParticlesFromLargeExplosion; 8 | unsigned int NumberOfSmokeParticlesFromSmallExplosion; 9 | 10 | unsigned int BloodCollidesWithEnvironment :1; 11 | unsigned int DrawLightCoronas :1; 12 | unsigned int DrawHierarchicalDecals :1; 13 | unsigned int ExplosionsDeformToEnvironment :1; 14 | unsigned int GhostFlameThrowerCollisions :1; 15 | 16 | } DETAIL_LEVELS; 17 | 18 | extern DETAIL_LEVELS LocalDetailLevels; 19 | typedef struct 20 | { 21 | int DecalNumber; 22 | int LightCoronas; 23 | int DecalsOnCharacters; 24 | int DeformableExplosions; 25 | int CharacterComplexity; 26 | int ParticleComplexity; 27 | 28 | } MENU_DETAIL_LEVEL_OPTIONS; 29 | 30 | extern MENU_DETAIL_LEVEL_OPTIONS MenuDetailLevelOptions; 31 | 32 | 33 | extern void SetToDefaultDetailLevels(void); 34 | extern void SetToMinimalDetailLevels(void); 35 | 36 | extern void SetDetailLevelsFromMenu(void); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/avp/dynamics.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neuromancer/avp/2d5774781dd2ed959a83b2a98ab6f3f26e1dcc51/src/avp/dynamics.c -------------------------------------------------------------------------------- /src/avp/dynamics.h: -------------------------------------------------------------------------------- 1 | #ifndef _dynamics_h_ /* KJL 17:23:01 11/05/96 - is this your first time? */ 2 | #define _dynamics_h_ 1 3 | #include "particle.h" 4 | 5 | /*KJL************************************************************************ 6 | * DYNAMICS.H * 7 | * - this file contains prototypes for the functions in dynamics.c * 8 | * which can be called externally. * 9 | ************************************************************************KJL*/ 10 | 11 | 12 | /*KJL**************************************************************************************** 13 | * S T R U C T U R E S * 14 | ****************************************************************************************KJL*/ 15 | struct ColPolyTag 16 | { 17 | int NumberOfVertices; 18 | VECTORCH PolyPoint[4]; 19 | VECTORCH PolyNormal; 20 | DISPLAYBLOCK *ParentObject; 21 | }; 22 | 23 | 24 | /*KJL**************************************************************************************** 25 | * P H Y S I C A L C O N S T A N T S * 26 | ****************************************************************************************KJL*/ 27 | 28 | #define GRAVITY_STRENGTH 25000 29 | #define TIME_BEFORE_GRAVITY_KICKS_IN 16384 30 | 31 | #define MAXIMUM_STEP_HEIGHT 450 32 | #define MAX_ANG_VELOCITY 8192 33 | #define MAX_MOVES 4 34 | 35 | //16384 36 | 37 | /*KJL**************************************************************************************** 38 | * P R O T O T Y P E S * 39 | ****************************************************************************************KJL*/ 40 | extern void ObjectDynamics(void); 41 | extern void DynamicallyRotateObject(DYNAMICSBLOCK *dynPtr); 42 | 43 | 44 | /* externs to shape access fns (platform specific) */ 45 | extern int SetupPolygonAccess(DISPLAYBLOCK *objectPtr); 46 | extern void AccessNextPolygon(void); 47 | extern void GetPolygonVertices(struct ColPolyTag *polyPtr); 48 | extern void GetPolygonNormal(struct ColPolyTag *polyPtr); 49 | 50 | 51 | 52 | /* extra camera movement */ 53 | extern EULER HeadOrientation; 54 | 55 | extern int ParticleDynamics(PARTICLE *particlePtr, VECTORCH *obstacleNormalPtr, int *moduleIndexPtr); 56 | void AddEffectsOfForceGenerators(VECTORCH *positionPtr, VECTORCH *impulsePtr, int mass); 57 | 58 | #endif /* end of preprocessor condition for file wrapping */ 59 | -------------------------------------------------------------------------------- /src/avp/equates.h: -------------------------------------------------------------------------------- 1 | #ifndef EQUATES_INCLUDED 2 | #define EQUATES_INCLUDED 3 | 4 | /* 5 | 6 | Equates & Enums for AVP 7 | 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #define MaxObjectLights 50 /* Sources attached to the object */ 15 | 16 | #define maxlightblocks 100 /* This ought to be MORE than enough */ 17 | 18 | #define MaxLightsPerObject 100 /* Sources lighting the object */ 19 | 20 | 21 | /* 22 | 23 | 3d Texture Scan Subdivision limits 24 | 25 | */ 26 | 27 | #if 0 /* only used by krender.c */ 28 | #define lin_s_max 5 29 | 30 | #if 0 31 | 32 | #define lin_s_zthr 320 /* 1.25 */ 33 | 34 | #else 35 | 36 | #if 1 37 | 38 | #define lin_s_zthr 281 /* 1.1 */ 39 | 40 | #else 41 | 42 | #define lin_s_zthr 260 /* 1.01 */ 43 | 44 | #endif 45 | 46 | #endif 47 | #endif 48 | 49 | 50 | #define GlobalScale 1 51 | 52 | /* 53 | Scenes and View Types 54 | */ 55 | 56 | /* not really used */ 57 | typedef enum { 58 | AVP_Scene0 59 | } SCENE; 60 | 61 | 62 | /* 63 | 64 | View Handler Function Array Indices 65 | 66 | */ 67 | 68 | /* VIEWSTATES isn't really used either */ 69 | typedef enum { 70 | 71 | VState_Inside, 72 | VState_RelativeRemote, 73 | VState_RelativeYRemote, 74 | VState_FixedRemote, 75 | VState_FlyBy, 76 | VState_LagRelRemote, 77 | VState_TrackingRemote, 78 | VState_LagRelYRemote, 79 | 80 | VState_Last 81 | 82 | } VIEWSTATES; 83 | 84 | 85 | /* 86 | 87 | View Interior Types 88 | 89 | */ 90 | 91 | /* ITYPES isn't really used either */ 92 | typedef enum { 93 | 94 | IType_Default, 95 | IType_Body, 96 | IType_Car, 97 | IType_Aircraft, 98 | 99 | IType_Last 100 | 101 | } ITYPES; 102 | 103 | 104 | /* Map Types */ 105 | 106 | typedef enum { 107 | 108 | MapType_Default, 109 | MapType_Player, 110 | MapType_PlayerShipCamera, 111 | MapType_Sprite, 112 | MapType_Term 113 | 114 | } AVP_MAP_TYPES; 115 | 116 | 117 | /* Strategies */ 118 | 119 | typedef enum { 120 | 121 | StrategyI_Null, 122 | StrategyI_Camera, 123 | StrategyI_Player, 124 | StrategyI_Test, 125 | StrategyI_NewtonTest, 126 | StrategyI_HomingTest, 127 | StrategyI_MissileTest, 128 | StrategyI_GravityOnly, 129 | StrategyI_Database, 130 | StrategyI_DoorPROX, 131 | StrategyI_Terminal, 132 | StrategyI_Last /* Always the last */ 133 | 134 | } AVP_STRATEGIES; 135 | 136 | /***********end for C++************/ 137 | 138 | #ifdef __cplusplus 139 | }; 140 | #endif 141 | 142 | #endif 143 | -------------------------------------------------------------------------------- /src/avp/extents.c: -------------------------------------------------------------------------------- 1 | /* KJL 12:15:10 8/23/97 - extents.c 2 | * 3 | * This file contains the collision extents 4 | * data for the game characters. 5 | * 6 | */ 7 | #include "extents.h" 8 | 9 | COLLISION_EXTENTS CollisionExtents[MAX_NO_OF_COLLISION_EXTENTS] = 10 | { 11 | /* CE_MARINE */ 12 | {450,0, -1950, -1200}, 13 | 14 | /* CE_PREDATOR */ 15 | {450,0, -789-1309, -1309}, 16 | 17 | /* CE_ALIEN */ 18 | {450,0, -900-1133, -900}, 19 | 20 | /* CE_XENOBORG */ 21 | {450,0, -900-1133, -900}, 22 | 23 | /* CE_PREDATORALIEN */ 24 | {400,0, -851-1338, -851}, 25 | 26 | /* CE_FACEHUGGER */ 27 | {300,0, 27-329, 27}, 28 | 29 | /* CE_QUEEN */ 30 | {1300,0, -2867-1133, -867}, 31 | 32 | /* CE_CORPSE */ 33 | {700,0, -200, -200}, 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /src/avp/extents.h: -------------------------------------------------------------------------------- 1 | /* KJL 12:15:10 8/23/97 - extents.h 2 | * 3 | * This file contains the collision extents 4 | * structures for the game characters. 5 | * 6 | */ 7 | 8 | enum COLLISION_EXTENTS_ID 9 | { 10 | CE_MARINE, 11 | 12 | CE_PREDATOR, 13 | 14 | CE_ALIEN, 15 | 16 | CE_XENOBORG, 17 | 18 | CE_PREDATORALIEN, 19 | 20 | CE_FACEHUGGER, 21 | 22 | CE_QUEEN, 23 | 24 | CE_CORPSE, 25 | 26 | MAX_NO_OF_COLLISION_EXTENTS 27 | }; 28 | 29 | 30 | typedef struct 31 | { 32 | /* radius of shape in XZ plane */ 33 | int CollisionRadius; 34 | 35 | /* height extents */ 36 | int Bottom; /* ie. max Y of the shape */ 37 | 38 | int StandingTop; 39 | int CrouchingTop; 40 | 41 | } COLLISION_EXTENTS; 42 | 43 | 44 | extern COLLISION_EXTENTS CollisionExtents[]; 45 | -------------------------------------------------------------------------------- /src/avp/game.h: -------------------------------------------------------------------------------- 1 | #ifndef GAME_H 2 | #define GAME_H 3 | 4 | void TimeStampedMessage(char *stringPtr); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/avp/hud.h: -------------------------------------------------------------------------------- 1 | #ifndef HUD_H 2 | #define HUD_H 3 | 4 | #include "stratdef.h" /* for STRATEGYBLOCK */ 5 | 6 | void InitHUD(void); 7 | void KillHUD(void); 8 | void ReInitHUD(void); 9 | void MaintainHUD(void); 10 | void DoCompletedLevelStatisticsScreen(void); 11 | int ObjectShouldAppearOnMotionTracker(STRATEGYBLOCK *sbPtr); 12 | void RotateVertex(VECTOR2D *vertexPtr, int theta); 13 | void MaintainZoomingLevel(void); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/avp/inventry.h: -------------------------------------------------------------------------------- 1 | #ifndef INVENTRY_H 2 | #define INVENTRY_H 3 | 4 | /*KJL***************************************************** 5 | * INVENTRY.H - contains externs to the fns in INVENTRY.C * 6 | *****************************************************KJL*/ 7 | 8 | /*KJL**************************************************************************************** 9 | * P R O T O T Y P E S * 10 | ****************************************************************************************KJL*/ 11 | extern void InitialisePlayersInventory(PLAYER_STATUS *playerStatusPtr); 12 | extern void MaintainPlayersInventory(void); 13 | 14 | /*-------------------------------Patrick 11/3/97-------------------------------- 15 | Protoypes for a couple of little functions: see inventry.c for details... 16 | ------------------------------------------------------------------------------*/ 17 | extern void SetPlayerSecurityClearance(STRATEGYBLOCK *sbPtr, unsigned int securityLevel); 18 | extern int ReturnPlayerSecurityClearance(STRATEGYBLOCK *sbPtr, unsigned int securityLevel); 19 | int SlotForThisWeapon(enum WEAPON_ID weaponID); 20 | 21 | 22 | 23 | //structure for starting equipment information loaded from rif files 24 | typedef struct player_starting_equipment 25 | { 26 | unsigned int marine_jetpack :1; 27 | 28 | unsigned int predator_pistol :1; 29 | unsigned int predator_plasmacaster :1; 30 | unsigned int predator_disc :1; 31 | unsigned int predator_medicomp :1; 32 | unsigned int predator_grappling_hook :1; 33 | int predator_num_spears; 34 | 35 | 36 | }PLAYER_STARTING_EQUIPMENT; 37 | 38 | extern PLAYER_STARTING_EQUIPMENT StartingEquipment; 39 | 40 | #define PISTOL_INFINITE_AMMO (netGameData.pistolInfiniteAmmo) 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/avp/language.h: -------------------------------------------------------------------------------- 1 | #ifndef _language_h_ 2 | #define _language_h_ 1 3 | /* KJL 11:54:21 05/02/97 - language.h */ 4 | #include "langenum.h" 5 | 6 | #define ENGLISH_TEXT_FILENAME "ENGLISH.TXT" 7 | extern unsigned char *LanguageFilename[]; 8 | 9 | extern void InitTextStrings(void); 10 | /*KJL*************************************************************** 11 | * Initialization to be called ONCE right at the start of the game. * 12 | ***************************************************************KJL*/ 13 | 14 | extern void KillTextStrings(void); 15 | /*KJL******************************************************** 16 | * Free memory etc, to be called ONCE on exit from the game. * 17 | ********************************************************KJL*/ 18 | 19 | extern char *GetTextString(enum TEXTSTRING_ID stringID); 20 | /*KJL********************************************************** 21 | * This function returns a pointer to a null terminated string * 22 | * which is described by its enumeration value, as defined in * 23 | * the header file langenum.h. * 24 | **********************************************************KJL*/ 25 | 26 | 27 | 28 | extern char *LoadTextFile(char *filename); 29 | /*KJL***************************************************** 30 | * Platform specific function, which loads the named file * 31 | * and returns a pointer to the start of the file's data. * 32 | *****************************************************KJL*/ 33 | 34 | extern void UnloadTextFile(char *filename, char *bufferPtr); 35 | /*KJL********************************************************** 36 | * Platform specific function, which unloads the named file * 37 | * and frees the memory pointed to by the bufferPtr. You may * 38 | * not need the filename, but I'm passing it for completeness. * 39 | **********************************************************KJL*/ 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/avp/lighting.h: -------------------------------------------------------------------------------- 1 | enum LIGHTING_EFFECTS_ID 2 | { 3 | LFX_EXPLOSION, 4 | LFX_MUZZLEFLASH, 5 | LFX_PARTICLECANNON, 6 | LFX_ROCKETJET, 7 | LFX_FLARE, 8 | LFX_BIGEXPLOSION, 9 | LFX_XENO_FIRING, 10 | LFX_PLASMA_BOLT, 11 | LFX_OBJECTONFIRE, 12 | LFX_SPEARGUNBOLT 13 | }; 14 | 15 | /* explosions light an area which has a max 15m radius */ 16 | #define EXPLOSION_LIGHT_RANGE 15000 17 | //#define EXPLOSION_LIGHT_RANGE 30000 18 | 19 | extern void AddLightingEffectToObject(DISPLAYBLOCK *objectPtr, enum LIGHTING_EFFECTS_ID lfxID); 20 | extern void LightBlockDeallocation(void); 21 | 22 | 23 | 24 | enum LIGHTELEMENT_BEHAVIOUR_ID 25 | { 26 | LIGHTELEMENT_MOLTENMETAL, 27 | LIGHTELEMENT_PLASMACASTERHIT, 28 | LIGHTELEMENT_FROMFMV, 29 | LIGHTELEMENT_ROTATING, 30 | LIGHTELEMENT_EXPLOSION, 31 | LIGHTELEMENT_ELECTRICAL_EXPLOSION, 32 | LIGHTELEMENT_ELECTRICAL_SPARKS, 33 | LIGHTELEMENT_ALIEN_TEETH, 34 | LIGHTELEMENT_ALIEN_TEETH2, 35 | LIGHTELEMENT_PARGEN_FLAME, 36 | }; 37 | 38 | typedef struct 39 | { 40 | enum LIGHTELEMENT_BEHAVIOUR_ID BehaviourID; 41 | 42 | LIGHTBLOCK LightBlock; 43 | int LifeTime; 44 | 45 | } LIGHTELEMENT; 46 | 47 | 48 | void InitialiseLightElementSystem(void); 49 | void MakeLightElement(VECTORCH *positionPtr, enum LIGHTELEMENT_BEHAVIOUR_ID behaviourID); 50 | void HandleLightElementSystem(void); 51 | 52 | -------------------------------------------------------------------------------- /src/avp/load_shp.c: -------------------------------------------------------------------------------- 1 | 2 | #include "3dc.h" 3 | #include "inline.h" 4 | #include "module.h" 5 | #include "stratdef.h" 6 | #include "gamedef.h" 7 | 8 | #include "load_shp.h" 9 | 10 | #define UseLocalAssert No 11 | 12 | #include "ourasert.h" 13 | 14 | char *Marine_Loaded_Shape_Names[I_Num_Character_Shapes] = 15 | { 16 | "ALIEN_STANDING", 17 | "ALIEN_CROUCHING", 18 | "XENOBORG", 19 | "PREDATOR", 20 | "PREDATOR_ALIEN", 21 | "FACE_HUGGER", 22 | "QUEEN", 23 | 24 | "GRENADE", 25 | "MISSILE", 26 | "DISC", 27 | "PRED_PALSMA", 28 | "AUTOGUN", 29 | 30 | "EXPLOSION", 31 | "EXPLOSION", 32 | "PLASMA_EXP", 33 | "RICOCHET", 34 | 35 | "ALIEN_BLOOD_SPLASH", 36 | "ALIEN_BLOOD_SPLASH", 37 | "PREDATOR_BLOOD_SPLASH", 38 | "ALIEN_BLOOD_SPLASH", 39 | "FACEHUGGER_BLOOD_SPLASH", 40 | }; 41 | 42 | 43 | char *Alien_Loaded_Shape_Names[I_Num_Character_Shapes] = 44 | { 45 | "MARINE", 46 | "NONE", 47 | "XENOBORG", 48 | "PREDATOR", 49 | "PREDATOR_ALIEN", 50 | "NONE", 51 | "QUEEN", 52 | 53 | "GRENADE", 54 | "MISSILE", 55 | "DISC", 56 | "PRED_PALSMA", 57 | "NONE", 58 | 59 | "EXPLOSION", 60 | "EXPLOSION", 61 | "PLASMA_EXP", 62 | "RICOCHET", 63 | 64 | "MARINE_BLOOD_SPLASH", 65 | "NONE", 66 | "PREDATOR_BLOOD_SPLASH", 67 | "NONE", 68 | "NONE", 69 | }; 70 | 71 | 72 | char *Predator_Loaded_Shape_Names[I_Num_Character_Shapes] = 73 | { 74 | "MARINE", 75 | "NONE", 76 | "XENOBORG", 77 | "SPECIAL_MARINE", 78 | "PREDATOR_ALIEN", 79 | "FACE_HUGGER", 80 | "QUEEN", 81 | 82 | "GRENADE", 83 | "MISSILE", 84 | "DISC", 85 | "PRED_PALSMA", 86 | "NONE", 87 | 88 | "EXPLOSION", 89 | "EXPLOSION", 90 | "PLASMA_EXP", 91 | "RICOCHET", 92 | 93 | "ALIEN_BLOOD_SPLASH", 94 | "ALIEN_BLOOD_SPLASH", 95 | "MARINE_BLOOD_SPLASH", 96 | "ALIEN_BLOOD_SPLASH", 97 | "FACEHUGGER_BLOOD_SPLASH", 98 | }; 99 | 100 | static int LoadedShapesInMSL[I_Num_Character_Shapes]; 101 | 102 | void InitCharacterMSLReferences() 103 | { 104 | int shape_num = I_Num_Character_Shapes; 105 | 106 | while(--shape_num >= 0) 107 | { 108 | switch(AvP.PlayerType) 109 | { 110 | case I_Marine: 111 | { 112 | // LoadedShapesInMSL[shape_num] = 113 | // GetLoadedShapeMSL(Marine_Loaded_Shape_Names[shape_num]); 114 | break; 115 | } 116 | case I_Predator: 117 | { 118 | // LoadedShapesInMSL[shape_num] = 119 | // GetLoadedShapeMSL(Predator_Loaded_Shape_Names[shape_num]); 120 | break; 121 | } 122 | case I_Alien: 123 | { 124 | // LoadedShapesInMSL[shape_num] = 125 | // GetLoadedShapeMSL(Alien_Loaded_Shape_Names[shape_num]); 126 | break; 127 | } 128 | 129 | default: 130 | GLOBALASSERT(2<1); 131 | } 132 | } 133 | } 134 | 135 | 136 | 137 | int GetMSLPosFromEnum(CHARACTER_SHAPES shape_enum) 138 | { 139 | return(LoadedShapesInMSL[shape_enum]); 140 | } 141 | -------------------------------------------------------------------------------- /src/avp/load_shp.h: -------------------------------------------------------------------------------- 1 | 2 | typedef enum 3 | { 4 | I_Shape_BadGuy1 = 0, 5 | I_Shape_BadGuy2, 6 | I_Shape_BadGuy3, 7 | I_Shape_BadGuy4, 8 | I_Shape_BadGuy5, 9 | I_Shape_BadGuy6, 10 | I_Shape_BadGuy7, 11 | 12 | I_Shape_Grenade, 13 | I_Shape_Missile, 14 | I_Shape_Disc, 15 | I_Shape_Plasma, 16 | I_Shape_AutoGun, 17 | 18 | I_Shape_Explosion1, 19 | I_Shape_Explosion2, 20 | I_Shape_PlasmaGunExp, 21 | I_Shape_Ricochet, 22 | 23 | I_Shape_BloodSplash1, 24 | I_Shape_BloodSplash2, 25 | I_Shape_BloodSplash3, 26 | I_Shape_BloodSplash4, 27 | I_Shape_BloodSplash5, 28 | 29 | I_Num_Character_Shapes, 30 | 31 | }CHARACTER_SHAPES; 32 | 33 | 34 | extern void InitCharacterMSLReferences(); 35 | extern int GetMSLPosFromEnum(CHARACTER_SHAPES shape_enum); 36 | extern int GetLoadedShapeMSL(const char *); 37 | -------------------------------------------------------------------------------- /src/avp/ltfx_exp.h: -------------------------------------------------------------------------------- 1 | #ifndef _ltfx_exp_h 2 | #define _ltfx_exp_h 1 3 | 4 | #ifdef __cplusplus 5 | 6 | extern "C" 7 | { 8 | 9 | #endif 10 | 11 | typedef enum 12 | { 13 | 14 | LFX_RandomFlicker, 15 | LFX_Strobe, 16 | LFX_Switch, 17 | LFX_FlickySwitch, 18 | 19 | } LIGHT_FX_TYPE; 20 | 21 | typedef enum 22 | { 23 | 24 | LFXS_LightOn, 25 | LFXS_LightOff, 26 | LFXS_LightFadingUp, 27 | LFXS_LightFadingDown, 28 | LFXS_Flicking, 29 | LFXS_NotFlicking, 30 | 31 | } LIGHT_FX_STATE; 32 | 33 | typedef struct 34 | { 35 | 36 | unsigned long type; 37 | unsigned long init_state; 38 | 39 | unsigned long fade_up_speed; 40 | unsigned long fade_down_speed; 41 | 42 | unsigned long post_fade_up_delay; 43 | unsigned long post_fade_down_delay; 44 | 45 | } LightFXData; 46 | 47 | #ifdef __cplusplus 48 | 49 | }; 50 | 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/avp/mempool.c: -------------------------------------------------------------------------------- 1 | #include "ourasert.h" 2 | #include "mem3dc.h" 3 | #include "mempool.h" 4 | 5 | 6 | #if USE_LEVEL_MEMORY_POOL 7 | 8 | #define MAX_NUM_MEMORY_BLOCK 64 9 | #define MEMORY_BLOCK_SIZE (8192*1024) 10 | 11 | static char* MemoryBlocks[MAX_NUM_MEMORY_BLOCK]; 12 | static int CurrentMemoryBlock =-1; 13 | 14 | static char* MemoryPoolPtr=0; 15 | static unsigned int MemoryLeft=0; 16 | 17 | static size_t AllocationCount=0; 18 | static size_t LargestRequest=0; 19 | static size_t MemoryRequested=0; 20 | static size_t MemoryWasted=0; 21 | 22 | void* PoolAllocateMem(unsigned int amount) 23 | { 24 | char* retval; 25 | 26 | GLOBALASSERT(amount<=MEMORY_BLOCK_SIZE) 27 | if (amount > MEMORY_BLOCK_SIZE) 28 | { 29 | // fatal error 30 | return NULL; 31 | } 32 | 33 | // align up 34 | amount = (amount + 7) & ~7; 35 | 36 | if(amount>MemoryLeft) 37 | { 38 | MemoryWasted += MemoryLeft; 39 | 40 | CurrentMemoryBlock++; 41 | GLOBALASSERT(CurrentMemoryBlock= MAX_NUM_MEMORY_BLOCK) 43 | { 44 | // fatal error 45 | return NULL; 46 | } 47 | MemoryBlocks[CurrentMemoryBlock]=AllocateMem(MEMORY_BLOCK_SIZE); 48 | GLOBALASSERT(MemoryBlocks[CurrentMemoryBlock]!=NULL); 49 | if (MemoryBlocks[CurrentMemoryBlock] == NULL) 50 | { 51 | // fatal error 52 | return NULL; 53 | } 54 | 55 | MemoryLeft=MEMORY_BLOCK_SIZE; 56 | MemoryPoolPtr=MemoryBlocks[CurrentMemoryBlock]; 57 | } 58 | 59 | if (amount > LargestRequest) { 60 | LargestRequest = amount; 61 | } 62 | 63 | MemoryRequested+=amount; 64 | AllocationCount++; 65 | 66 | retval=MemoryPoolPtr; 67 | MemoryLeft-=amount; 68 | MemoryPoolPtr+=amount; 69 | return (void*)retval; 70 | 71 | } 72 | 73 | 74 | void ClearMemoryPool() 75 | { 76 | int i; 77 | 78 | #if !defined(NDEBUG) 79 | printf("%d blocks in use, %u bytes left in current block\n", CurrentMemoryBlock + 1, MemoryLeft); 80 | printf("%zu requests, %zu bytes requested, %zu bytes wasted, %zu largest request\n", AllocationCount, MemoryRequested, MemoryWasted, LargestRequest); 81 | #endif 82 | 83 | for(i=0;i<=CurrentMemoryBlock;i++) 84 | { 85 | DeallocateMem(MemoryBlocks[i]); 86 | MemoryBlocks[i]=0; 87 | } 88 | CurrentMemoryBlock=-1; 89 | MemoryPoolPtr=0; 90 | MemoryLeft=0; 91 | 92 | MemoryRequested = 0; 93 | MemoryWasted = 0; 94 | LargestRequest = 0; 95 | AllocationCount = 0; 96 | } 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /src/avp/mempool.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _mempool_h_ 3 | #define _mempool_h_ 1 4 | 5 | 6 | #ifdef __cplusplus 7 | 8 | extern "C" { 9 | 10 | #endif 11 | 12 | #define NEW_DEALLOCATION_ORDER 1 13 | 14 | #define USE_LEVEL_MEMORY_POOL 1 15 | 16 | #if USE_LEVEL_MEMORY_POOL 17 | void* PoolAllocateMem(unsigned int amount); 18 | void ClearMemoryPool(); 19 | #else 20 | #define PoolAllocateMem AllocateMem 21 | #define ClearMemoryPool() ((void)0) 22 | #endif 23 | 24 | 25 | #ifdef __cplusplus 26 | 27 | }; 28 | 29 | #endif 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/avp/messagehistory.h: -------------------------------------------------------------------------------- 1 | #ifndef MESSAGEHISTORY_H 2 | #define MESSAGEHISTORY_H 3 | 4 | void MessageHistory_DisplayPrevious(void); 5 | void MessageHistory_Initialise(void); 6 | void MessageHistory_Maintain(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/avp/movement.c: -------------------------------------------------------------------------------- 1 | /* CDF 20/10/98 - Single file for the movement stat lists. */ 2 | 3 | #include "3dc.h" 4 | #include "inline.h" 5 | #include "module.h" 6 | #include "stratdef.h" 7 | #include "gamedef.h" 8 | #include "comp_shp.h" 9 | #include "dynblock.h" 10 | #include "dynamics.h" 11 | #include "pfarlocs.h" 12 | #include "pheromon.h" 13 | #include "bh_types.h" 14 | #include "pvisible.h" 15 | #include "bh_far.h" 16 | #include "bh_debri.h" 17 | #include "bh_pred.h" 18 | #include "bh_paq.h" 19 | #include "bh_queen.h" 20 | #include "bh_marin.h" 21 | #include "bh_alien.h" 22 | #include "lighting.h" 23 | #include "bh_weap.h" 24 | #include "weapons.h" 25 | #include "psnd.h" 26 | #include "equipmnt.h" 27 | #include "los.h" 28 | #include "ai_sight.h" 29 | #include "targeting.h" 30 | #include "dxlog.h" 31 | #include "showcmds.h" 32 | 33 | #define UseLocalAssert Yes 34 | #include "ourasert.h" 35 | 36 | /* First number is max speed, in mm/s. */ 37 | /* Second number is acceleration, in mm/s^2. */ 38 | /* Individual marines vary this by +/- 12.5%. */ 39 | /* Predators and xenoborgs don't at the moment. */ 40 | 41 | static const MOVEMENT_DATA Movement_Stats[] = { 42 | { 43 | MDI_Marine_Mooch_Bored, 44 | 1500, 45 | 1500, 46 | }, 47 | { 48 | MDI_Marine_Mooch_Alert, 49 | 1500, 50 | 1500, 51 | }, 52 | { 53 | MDI_Marine_Combat, 54 | 4000, 55 | 4000, 56 | }, 57 | { 58 | MDI_Marine_Sprint, 59 | 10000, 60 | 10000, 61 | }, 62 | { 63 | MDI_Civilian_Mooch_Bored, 64 | 1500, 65 | 1500, 66 | }, 67 | { 68 | MDI_Civilian_Mooch_Alert, 69 | 1500, 70 | 1500, 71 | }, 72 | { 73 | MDI_Civilian_Combat, 74 | 4000, 75 | 4000, 76 | }, 77 | { 78 | MDI_Civilian_Sprint, 79 | 10000, 80 | 10000, 81 | }, 82 | { 83 | MDI_Predator, 84 | 8000, 85 | 10000, 86 | }, 87 | { 88 | MDI_Casual_Predator, 89 | 3000, 90 | 3000, 91 | }, 92 | { 93 | MDI_Xenoborg, 94 | 1000, 95 | 1000, 96 | }, 97 | { 98 | MDI_End, 99 | 0, 100 | 0, 101 | }, 102 | }; 103 | 104 | const MOVEMENT_DATA *GetThisMovementData(MOVEMENT_DATA_INDEX index) { 105 | 106 | int a; 107 | 108 | if (index<0) { 109 | return(NULL); 110 | } 111 | 112 | a=0; 113 | while (Movement_Stats[a].index!=MDI_End) { 114 | if (Movement_Stats[a].index==index) { 115 | return(&Movement_Stats[a]); 116 | } 117 | a++; 118 | GLOBALASSERT(a<1000); 119 | } 120 | return(NULL); 121 | } 122 | -------------------------------------------------------------------------------- /src/avp/paintball.h: -------------------------------------------------------------------------------- 1 | /* KJL 16:20:56 30/09/98 - Paintball.h */ 2 | #ifndef _included_paintball_h_ /* Is this your first time? */ 3 | #define _included_paintball_h_ 1 4 | 5 | #include "decal.h" 6 | 7 | typedef struct 8 | { 9 | DISPLAYBLOCK *TargetDispPtr; 10 | VECTORCH TargetPosition; 11 | VECTORCH TargetNormal; 12 | 13 | enum DECAL_ID CurrentDecalID; 14 | int CurrentDecalSubclass; 15 | int CurrentDecalSize; 16 | int CurrentDecalRotation; 17 | 18 | unsigned int IsOn :1; 19 | unsigned int DecalIsInverted :1; 20 | 21 | } PAINTBALLMODE; 22 | 23 | extern PAINTBALLMODE PaintBallMode; 24 | 25 | #define FIRST_PAINTBALL_DECAL (DECAL_SCORCHED) 26 | #define LAST_PAINTBALL_DECAL (DECAL_HUMAN_BLOOD) 27 | 28 | extern void TogglePaintBallMode(void); 29 | extern void PaintBallMode_DrawCurrentDecalAtTarget(void); 30 | extern void PaintBallMode_ChangeSelectedDecalID(int delta); 31 | extern void PaintBallMode_ChangeSize(int delta); 32 | extern void PaintBallMode_AddDecal(void); 33 | extern void PaintBallMode_ChangeSubclass(int delta); 34 | extern void PaintBallMode_Randomise(void); 35 | extern void PaintBallMode_RemoveDecal(void); 36 | extern void PaintBallMode_Rotate(void); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/avp/pfarlocs.h: -------------------------------------------------------------------------------- 1 | 2 | /*------------------------Patrick 13/12/96----------------------------- 3 | Header file for FAR AI alien module locations 4 | --------------------------------------------------------------------*/ 5 | 6 | #ifndef _pfarlocs_h_ 7 | #define _pfarlocs_h_ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | /* various structure definitions used for module's auxilary location and 15 | entry point data and headers...*/ 16 | typedef struct farlocationsheader 17 | { 18 | int numLocations; 19 | struct vectorch *locationsList; 20 | 21 | } FARLOCATIONSHEADER; 22 | 23 | typedef struct farvalidatedlocation 24 | { 25 | int valid; 26 | struct vectorch position; 27 | 28 | } FARVALIDATEDLOCATION; 29 | 30 | typedef struct farentrypoint 31 | { 32 | struct vectorch position; 33 | int donorIndex; 34 | unsigned int alien_only:1; //this entry point can only be used by aliens 35 | 36 | } FARENTRYPOINT; 37 | 38 | typedef struct farentrypointsheader 39 | { 40 | int numEntryPoints; 41 | struct farentrypoint *entryPointsList; 42 | 43 | } FARENTRYPOINTSHEADER; 44 | 45 | 46 | /* enum of the different door types, as seen by NPC's */ 47 | typedef enum moduledoortype 48 | { 49 | MDT_NotADoor, 50 | MDT_ProxDoor, 51 | MDT_LiftDoor, 52 | MDT_SecurityDoor, 53 | 54 | } MODULEDOORTYPE; 55 | 56 | 57 | /* globals */ 58 | extern FARLOCATIONSHEADER *FALLP_AuxLocs; 59 | extern FARENTRYPOINTSHEADER *FALLP_EntryPoints; 60 | 61 | /* defines for auxilary locations */ 62 | #define FAR_BB_HEIGHT 2000 /* should be height of a crouched alien */ 63 | #define FAR_BB_WIDTH 1000 /* should be the 'width' of an alien */ 64 | #define FAR_POS_HEIGHT 680 /* how high of the floor to put the alien (1/2 alien height + a bit) */ 65 | #define FAR_GRID_SIZE 6 66 | #define FAR_MAX_LOCS 5 67 | #define FAR_MIN_INCLINE 50 68 | 69 | /* defines for entry points */ 70 | #define EPBB_XTRA 100 71 | #define EP_POSNDISP 100 72 | #define EP_MAXPOINTS 200 73 | #define EP_MAXEDGES 200 74 | 75 | /* defines for module door types insofar as they relate to alien behaviour 76 | FADT stands for Far Alien Door Type*/ 77 | 78 | 79 | /* prototypes */ 80 | void BuildFarModuleLocs(void); 81 | void KillFarModuleLocs(void); 82 | MODULEDOORTYPE ModuleIsADoor(MODULE* target); 83 | MODULEDOORTYPE AIModuleIsADoor(AIMODULE* target); 84 | int ModuleIsPhysical(MODULE* target); 85 | int AIModuleIsPhysical(AIMODULE* target); 86 | int ModuleInModule(MODULE* target1, MODULE* target2); 87 | int NumAdjacentModules(AIMODULE* target); 88 | FARENTRYPOINT *GetModuleEP(MODULE* thisModule, MODULE*fromModule); 89 | FARENTRYPOINT *GetAIModuleEP(AIMODULE* thisModule, AIMODULE*fromModule); 90 | int PointIsInModule(MODULE* thisModule, VECTORCH* thisPoint); 91 | 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /src/avp/pheromon.h: -------------------------------------------------------------------------------- 1 | /*-----------------------Patrick 14/11/96-------------------------- 2 | Header for AVP Pheromone system 3 | -----------------------------------------------------------------*/ 4 | 5 | #define SUPER_PHEROMONE_SYSTEM 1 6 | 7 | /* Global Data access to pheromone system */ 8 | 9 | extern unsigned int *PherPl_ReadBuf; 10 | extern unsigned int *PherPl_WriteBuf; 11 | #if SUPER_PHEROMONE_SYSTEM 12 | extern unsigned int *PherAls_ReadBuf; 13 | extern unsigned int *PherAls_WriteBuf; 14 | 15 | extern unsigned int *PherMars_ReadBuf; 16 | extern unsigned int *PherMars_WriteBuf; 17 | #endif 18 | extern unsigned char *PherAi_Buf; 19 | extern MODULE *playerPherModule; 20 | 21 | /* function prototypes */ 22 | void InitPheromoneSystem(void); 23 | void PlayerPheromoneSystem(void); 24 | void AiPheromoneSystem(void); 25 | void CleanUpPheromoneSystem(void); 26 | int AIModuleAdmitsPheromones(AIMODULE *targetModule); 27 | 28 | #if SUPER_PHEROMONE_SYSTEM 29 | void AddMarinePheromones(AIMODULE *targetModule); 30 | void MaintainMarineTargetZone(AIMODULE *targetModule); 31 | #endif 32 | -------------------------------------------------------------------------------- /src/avp/player.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAYER_H 2 | #define PLAYER_H 3 | 4 | void DeInitialisePlayer(void); 5 | void ChangeToMarine(); 6 | void ChangeToAlien(); 7 | void ChangeToPredator(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/avp/pmove.h: -------------------------------------------------------------------------------- 1 | /*--------------Patrick 15/10/96 --------------------- 2 | Header File for Player Movement Stuff 3 | ---------------------------------------------------*/ 4 | 5 | 6 | #ifndef _pmove_h_ 7 | #define _pmove_h_ 1 8 | 9 | 10 | 11 | #ifdef __cplusplus 12 | 13 | extern "C" { 14 | 15 | #endif 16 | 17 | 18 | 19 | 20 | /*--------------Patrick 15/10/96 --------------------- 21 | Enumeration of player movement states 22 | Free movement indicates normal movement. 23 | Special Movement indicates that the player is 24 | executing a special move. 25 | Aborting indicates that a special move is 26 | prematurely terminating. 27 | ---------------------------------------------------*/ 28 | 29 | typedef enum player_mov_state 30 | { 31 | PMov_FreeMovement, 32 | PMov_SpecialMovement, 33 | PMov_AbortingSpecialMovement, 34 | }PLAYER_MOVEMENT_STATE; 35 | 36 | /*--------------Patrick 15/10/96 --------------------- 37 | Enumeration of special move types 38 | Special moves are flagged as belonging to a 39 | character type 40 | ---------------------------------------------------*/ 41 | 42 | 43 | /*--------------Patrick 31/10/96 --------------------- 44 | Enumeration of player's morphing states for crouching 45 | and lying down. 46 | ---------------------------------------------------*/ 47 | typedef enum player_morph_state 48 | { 49 | PMph_Standing, 50 | PMph_Crouching, 51 | PMph_Lying, 52 | PMph_StoC, 53 | PMph_CtoS, 54 | PMph_StoL, 55 | PMph_LtoS, 56 | 57 | }PLAYER_MORPH_STATE; 58 | 59 | 60 | 61 | 62 | /*--------------Patrick 1/11/96 --------------------- 63 | this define determines how crouching and lying down 64 | are implemented for the player. It can either be 65 | done by changing the shape, or by morphing.... 66 | Morphing is better, but doesn't work with the current 67 | collision system. 68 | ---------------------------------------------------*/ 69 | #define CrouchByMorphingPlayer 0 70 | 71 | 72 | /* Prototypes */ 73 | extern void InitPlayerMovementData(STRATEGYBLOCK* sbPtr); 74 | extern void PlayerBehaviour(STRATEGYBLOCK* sbptr); 75 | extern void ExecuteFreeMovement(STRATEGYBLOCK* sbPtr); 76 | void ThrowAFlare(void); 77 | void StartPlayerTaunt(void); 78 | void NetPlayerRespawn(STRATEGYBLOCK *sbPtr); 79 | 80 | 81 | #ifdef __cplusplus 82 | 83 | } 84 | 85 | #endif 86 | 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/avp/projfont.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | projfont.h 4 | 5 | Defines a project-specific enum for all possible fonts that can loaded 6 | by the program; used by the indexed-font code. 7 | 8 | Also defines a macro for the maximum number of fonts "IndexedFonts_MAX_NUMBER_OF_FONTS"; 9 | this macro must evaluate at compile time to a constant integer. 10 | 11 | It is assumed that font indices are in the range: 12 | 13 | [ 0, IndexedFonts_MAX_NUMBER_OF_FONTS ) 14 | 15 | i.e. inclusive on the LHS, exclusive on the RHS 16 | 17 | (AVP version created 19/11/97) 18 | */ 19 | 20 | #ifndef _projfont 21 | #define _projfont 1 22 | 23 | #ifndef _font_h_included 24 | #include "font.h" 25 | #endif 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Version settings *****************************************************/ 32 | 33 | /* Constants ***********************************************************/ 34 | #define IndexedFonts_MAX_NUMBER_OF_FONTS ( NUM_FONTS ) 35 | 36 | /* Macros ***************************************************************/ 37 | 38 | /* Type definitions *****************************************************/ 39 | typedef enum fonts FontIndex; 40 | 41 | 42 | 43 | /* Exported globals *****************************************************/ 44 | 45 | /* Function prototypes **************************************************/ 46 | 47 | 48 | 49 | /* End of the header ****************************************************/ 50 | 51 | 52 | #ifdef __cplusplus 53 | }; 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/avp/projtext.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | projtext.h 4 | 5 | Created 12 Nov 97 by DHM: Project specific text type 6 | 7 | */ 8 | 9 | #ifndef _projtext 10 | #define _projtext 1 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* Version settings *****************************************************/ 17 | 18 | /* Constants ***********************************************************/ 19 | 20 | /* Macros ***************************************************************/ 21 | 22 | /* Type definitions *****************************************************/ 23 | 24 | typedef char ProjChar; 25 | 26 | /* Exported globals *****************************************************/ 27 | 28 | /* Function prototypes **************************************************/ 29 | 30 | 31 | 32 | /* End of the header ****************************************************/ 33 | 34 | 35 | #ifdef __cplusplus 36 | }; 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/avp/scream.h: -------------------------------------------------------------------------------- 1 | #ifndef scream_h 2 | #define scream_h 1 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef enum sound_category { 9 | SC_Angry=0, 10 | SC_Panic, 11 | SC_Pain, 12 | SC_Death, 13 | SC_Surprise, 14 | SC_Oooph, 15 | SC_OnFire, 16 | SC_Electrocution, 17 | SC_Sobbing, 18 | SC_Acid, 19 | SC_Facehugged, 20 | SC_PC_OnFire, 21 | SC_Taunt, 22 | SC_Falling, 23 | SC_Jump, 24 | } SOUND_CATERGORY; 25 | 26 | typedef enum alien_sound_category 27 | { 28 | ASC_TailSound, 29 | ASC_Swipe, 30 | ASC_Scream_Hurt, 31 | ASC_Scream_Dying, 32 | ASC_Scream_General, 33 | ASC_Taunt, 34 | ASC_LimbLoss, 35 | ASC_Death, 36 | ASC_PC_OnFire, 37 | }ALIEN_SOUND_CATEGORY; 38 | 39 | typedef enum predator_sound_category 40 | { 41 | PSC_Swipe, 42 | PSC_Scream_Hurt, 43 | PSC_Scream_Dying, 44 | PSC_Scream_General, 45 | PSC_Taunt, 46 | PSC_Acid, 47 | PSC_Facehugged, 48 | PSC_PC_OnFire, 49 | PSC_Jump, 50 | PSC_Medicomp_Special, 51 | }PREDATOR_SOUND_CATEGORY; 52 | 53 | typedef enum queen_sound_category 54 | { 55 | QSC_Hiss, 56 | QSC_Scream_Hurt, 57 | 58 | QSC_Object_Bounce, //not actually used by the queen , but only occurs in queen's level 59 | }QUEEN_SOUND_CATEGORY; 60 | 61 | void UnloadScreamSounds(); 62 | 63 | void LoadMarineScreamSounds(); 64 | void LoadAlienScreamSounds(); 65 | void LoadPredatorScreamSounds(); 66 | void LoadQueenScreamSounds(); 67 | 68 | void PlayMarineScream(int VoiceType,int SoundCategory,int PitchShift,int* ExternalRef,VECTORCH* Location); 69 | void PlayAlienSound(int VoiceType,int SoundCategory,int PitchShift,int* ExternalRef,VECTORCH* Location); 70 | void PlayPredatorSound(int VoiceType,int SoundCategory,int PitchShift,int* ExternalRef,VECTORCH* Location); 71 | void PlayQueenSound(int VoiceType,int SoundCategory,int PitchShift,int* ExternalRef,VECTORCH* Location); 72 | 73 | #ifdef __cplusplus 74 | }; 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/avp/sfx.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_sfx_h_ /* Is this your first time? */ 2 | #define _included_sfx_h_ 1 3 | 4 | #define MAX_NO_OF_SFX_BLOCKS 10 5 | enum SFX_ID 6 | { 7 | SFX_NONE, 8 | SFX_MUZZLE_FLASH_SMARTGUN, 9 | SFX_MUZZLE_FLASH_AMORPHOUS, 10 | SFX_PREDATOR_PLASMA_BOLT, 11 | SFX_SMALL_PREDATOR_PLASMA_BOLT, 12 | SFX_FRISBEE_PLASMA_BOLT, 13 | SFX_MUZZLE_FLASH_SKEETER, 14 | MAX_NO_OF_SFXS, 15 | }; 16 | 17 | typedef struct sfxblock 18 | { 19 | enum SFX_ID SfxID; 20 | 21 | unsigned int EffectDrawnLastFrame:1; // useful for strobing effects 22 | 23 | 24 | } SFXBLOCK; 25 | 26 | #define SFXFLAG_ISAFFECTEDBYHEAT 0x1 27 | #define SFXFLAG_MELTINGINTOGROUND 0x2 28 | #define SFXFLAG_ONFIRE 0x4 29 | #define SFXFLAG_SPARKING 0x8 30 | 31 | typedef struct forcefield 32 | { 33 | VECTORCH Corner; 34 | VECTORCH Scale; 35 | int ModuleIndex; 36 | 37 | } FORCEFIELD; 38 | 39 | 40 | 41 | extern void InitialiseSfxBlocks(void); 42 | extern SFXBLOCK* AllocateSfxBlock(void); 43 | extern void DeallocateSfxBlock(SFXBLOCK *sfxPtr); 44 | DISPLAYBLOCK *CreateSFXObject(enum SFX_ID sfxID); 45 | 46 | 47 | extern struct displayblock *CreateSFXObject(enum SFX_ID sfxID); 48 | extern void DrawSfxObject(struct displayblock *dispPtr); 49 | 50 | extern void HandleSfxForObject(DISPLAYBLOCK *dispPtr); 51 | void HandleObjectOnFire(DISPLAYBLOCK *dispPtr); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/avp/support/command.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | command.hpp 4 | 5 | An object for encapsulating requests; see pp233-242 of 6 | "Design Patterns" 7 | 8 | */ 9 | 10 | #ifndef _command 11 | #define _command 1 12 | 13 | #ifndef _refobj 14 | #include "refobj.hpp" 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Version settings *****************************************************/ 22 | 23 | /* Constants ***********************************************************/ 24 | 25 | /* Macros ***************************************************************/ 26 | 27 | /* Type definitions *****************************************************/ 28 | class Command : public RefCountObject 29 | { 30 | public: 31 | virtual OurBool Execute(void) = 0; 32 | // return value is "was command completed successfully?" 33 | 34 | protected: 35 | // Empty constructor: 36 | Command() : RefCountObject() {} 37 | 38 | protected: 39 | // Protected destructor; Release() is the only method allowed to 40 | // delete it... 41 | virtual ~Command() 42 | { 43 | // empty 44 | } 45 | }; 46 | 47 | /* Exported globals *****************************************************/ 48 | 49 | /* Function prototypes **************************************************/ 50 | 51 | 52 | 53 | /* End of the header ****************************************************/ 54 | 55 | 56 | #ifdef __cplusplus 57 | }; 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/avp/support/consbtch.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | consbtch.hpp 4 | 5 | Console batch file support 6 | 7 | */ 8 | 9 | #ifndef _consbtch 10 | #define _consbtch 1 11 | 12 | #if defined( _MSC_VER ) 13 | #pragma once 14 | #endif 15 | 16 | #ifndef _scstring 17 | #include "scstring.hpp" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Version settings *****************************************************/ 25 | 26 | /* Constants ***********************************************************/ 27 | 28 | /* Macros ***************************************************************/ 29 | 30 | /* Type definitions *****************************************************/ 31 | class BatchFileProcessing 32 | { 33 | public: 34 | static OurBool Run(char* Filename); 35 | // Tries to find the file, if it finds it it reads it, 36 | // adds the non-comment lines to the pending list, and returns Yes 37 | // If it can't find the file, it returns No 38 | 39 | public: 40 | static int bEcho; 41 | }; 42 | 43 | /* Exported globals *****************************************************/ 44 | 45 | /* Function prototypes **************************************************/ 46 | 47 | 48 | 49 | /* End of the header ****************************************************/ 50 | 51 | 52 | #ifdef __cplusplus 53 | }; 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/avp/support/dcontext.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | DCONTEXT.HPP 4 | 5 | Created 14/1/98 by DHM: 6 | 7 | Dump-contexts for use by debugging routines. 8 | 9 | The idea is that debug-dump routines take a reference 10 | to one of these, signifying how they should output; 11 | these are in separate headers to avoid dependencies. 12 | 13 | There are derived classes for the screen and for log files. 14 | 15 | Analagous to the class CDumpContext in Microsoft's MFC. 16 | 17 | */ 18 | 19 | #ifndef _dcontext 20 | #define _dcontext 1 21 | 22 | #if defined( _MSC_VER ) 23 | #pragma once 24 | #endif 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Version settings *****************************************************/ 31 | 32 | /* Constants ***********************************************************/ 33 | 34 | /* Macros ***************************************************************/ 35 | 36 | /* Type definitions *****************************************************/ 37 | class R_DumpContext 38 | { 39 | public: 40 | virtual int dputs(char const * const buf) = 0; 41 | virtual int dprintf(char const * format, ... ) = 0; 42 | virtual int vdprintf(char const * format, va_list ap ) = 0; 43 | }; 44 | 45 | /* Exported globals *****************************************************/ 46 | 47 | /* Function prototypes **************************************************/ 48 | 49 | 50 | 51 | /* End of the header ****************************************************/ 52 | 53 | 54 | #ifdef __cplusplus 55 | }; 56 | #endif 57 | 58 | #endif 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/avp/support/ourbool.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | ourbool.h 4 | 5 | Exists in order to define the type OurBool; 6 | */ 7 | 8 | #ifndef _ourbool 9 | #define _ourbool 1 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | /* Version settings *****************************************************/ 16 | 17 | /* Constants ***********************************************************/ 18 | 19 | /* Macros ***************************************************************/ 20 | 21 | /* Type definitions *****************************************************/ 22 | typedef char OurBool; 23 | // marker for an explicitly boolean type (e.g. for a return value) 24 | 25 | /* Exported globals *****************************************************/ 26 | 27 | /* Function prototypes **************************************************/ 28 | 29 | 30 | 31 | /* End of the header ****************************************************/ 32 | 33 | 34 | #ifdef __cplusplus 35 | }; 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/avp/support/r2pos666.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | r2pos666.hpp 4 | 5 | */ 6 | 7 | #ifndef _r2pos666 8 | #define _r2pos666 1 9 | 10 | #ifndef _r2base 11 | #include "r2base.h" 12 | #endif 13 | 14 | #ifndef _daemon 15 | #include "daemon.h" 16 | #endif 17 | 18 | 19 | /* Version settings *****************************************************/ 20 | 21 | /* Constants ***********************************************************/ 22 | 23 | /* Macros ***************************************************************/ 24 | 25 | /* Type definitions *****************************************************/ 26 | class R2PosDaemon : public Daemon 27 | { 28 | public: 29 | R2PosDaemon 30 | ( 31 | r2pos R2Pos_Int_Initial, 32 | OurBool bActive 33 | ); 34 | 35 | ~R2PosDaemon() 36 | { 37 | // empty 38 | } 39 | 40 | r2pos GetPos_Int(void) const; 41 | r2pos GetPos_FixP(void) const; 42 | 43 | void SetPos_Int(const r2pos R2Pos_Int_New ); 44 | void SetPos_FixP(const r2pos R2Pos_FixP_New ); 45 | 46 | // Activity remains pure virtual... 47 | 48 | private: 49 | r2pos R2Pos_Int_Current; 50 | r2pos R2Pos_FixP_Current; 51 | 52 | }; 53 | // Inline methods: 54 | inline r2pos R2PosDaemon::GetPos_Int(void) const 55 | { 56 | return R2Pos_Int_Current; 57 | } 58 | inline r2pos R2PosDaemon::GetPos_FixP(void) const 59 | { 60 | return R2Pos_FixP_Current; 61 | } 62 | 63 | /* Exported globals *****************************************************/ 64 | 65 | /* Function prototypes **************************************************/ 66 | 67 | 68 | 69 | /* End of the header ****************************************************/ 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/avp/support/reflist.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * 3 | * DESCRIPTION: reflist.cpp 4 | * 5 | * AUTHOR: David Malcolm 6 | * 7 | * HISTORY: Created 28/1/98 8 | * 9 | *******************************************************************/ 10 | 11 | /* Includes ********************************************************/ 12 | #include "3dc.h" 13 | #include "reflist.hpp" 14 | 15 | /* Exported globals ************************************************/ 16 | 17 | char const* reflist_fail_destructor = "Failure in RefList destructor\n"; 18 | -------------------------------------------------------------------------------- /src/avp/support/rentrntq.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | rentrntq.h 4 | 5 | Created 21/11/97 by DHM: 6 | 7 | "Support for a queue of messages (generated by/analagous to Windows messages) 8 | to avoid problems with re-entrancy". 9 | 10 | The problem being solved is that (in theory at least) the application's 11 | WinProc() procedure can be called at any point within any function in the Win32 API. 12 | 13 | This means that any code that the application's WinProc procedure 14 | calls (both directly or indirectly) must, in general, be re-entrant 15 | 16 | For example, textprint(), the memory allocators, etc. can't be guaranteed to work if 17 | called from WinProc() or something called by it. This is a mahor restriction on what 18 | you can call from WinProc. 19 | 20 | The idea of this code is to isolate the re-entrancy by buffering the 21 | messages, which can then be flushed somewhere "safe" within the main loop 22 | that doesn't need to be re-entrant. 23 | 24 | Functions within this header are labelled with either (i)"WinProc" or (ii)"WinMain" 25 | in their names to indicate whether (i)they should be called from the windows procedure 26 | or (ii) from within the WinMain function (or anything it calls i.e. the entire program 27 | and main loop _except_ for the windows procedure) 28 | */ 29 | 30 | #ifndef _rentrntq 31 | #define _rentrntq 1 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Version settings *****************************************************/ 38 | 39 | /* Constants ***********************************************************/ 40 | 41 | /* Macros ***************************************************************/ 42 | 43 | /* Type definitions *****************************************************/ 44 | 45 | /* Exported globals *****************************************************/ 46 | 47 | /* Function prototypes **************************************************/ 48 | /* Functions callable within the Windows procedure */ 49 | extern void RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_CHAR 50 | ( 51 | char Ch 52 | ); 53 | 54 | extern void RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN 55 | ( 56 | WPARAM wParam 57 | ); 58 | 59 | /* Functions callable from the WinMain() body of code */ 60 | extern void RE_ENTRANT_QUEUE_WinMain_FlushMessages(void); 61 | extern void RE_ENTRANT_QUEUE_WinMain_FlushMessagesWithoutProcessing(void); 62 | 63 | 64 | /* End of the header ****************************************************/ 65 | 66 | 67 | #ifdef __cplusplus 68 | }; 69 | #endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/avp/support/strtab.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | strtab.hpp 4 | 5 | */ 6 | 7 | #ifndef _strtab 8 | #define _strtab 1 9 | 10 | #ifndef _projtext 11 | #include "projtext.h" 12 | #endif 13 | 14 | #ifndef _langenum_h_ 15 | #include "langenum.h" 16 | #endif 17 | 18 | #ifdef __cplusplus 19 | #ifndef _scstring 20 | #include "scstring.hpp" 21 | #endif 22 | #endif 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Version settings *****************************************************/ 29 | #define OnlyOneStringTable Yes 30 | 31 | /* Constants ***********************************************************/ 32 | 33 | /* Macros ***************************************************************/ 34 | #if OnlyOneStringTable 35 | #define STRINGTABLE_DECL_SPECIFIER static 36 | #else 37 | #define STRINGTABLE_DECL_SPECIFIER 38 | #endif 39 | 40 | /* Type definitions *****************************************************/ 41 | #ifdef __cplusplus 42 | class StringTable 43 | { 44 | public: 45 | STRINGTABLE_DECL_SPECIFIER SCString& GetSCString 46 | ( 47 | enum TEXTSTRING_ID stringID 48 | ); 49 | 50 | STRINGTABLE_DECL_SPECIFIER void Add( ProjChar* pProjChar ); 51 | 52 | #if OnlyOneStringTable 53 | static void Unload(void); 54 | #else 55 | StringTable(); 56 | ~StringTable(); 57 | #endif 58 | 59 | private: 60 | STRINGTABLE_DECL_SPECIFIER unsigned int NumStrings; 61 | STRINGTABLE_DECL_SPECIFIER SCString* pSCString[ MAX_NO_OF_TEXTSTRINGS ]; 62 | }; 63 | #endif // __cplusplus 64 | 65 | /* Exported globals *****************************************************/ 66 | 67 | /* Function prototypes **************************************************/ 68 | #if OnlyOneStringTable 69 | extern void AddToTable( ProjChar* pProjChar ); 70 | extern void UnloadTable(void); 71 | #endif 72 | 73 | 74 | /* End of the header ****************************************************/ 75 | 76 | 77 | #ifdef __cplusplus 78 | }; 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/avp/support/trig666.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | trig666.hpp 4 | 5 | */ 6 | 7 | #ifndef _trig666 8 | #define _trig666 1 9 | 10 | #ifndef _daemon 11 | #include "daemon.h" 12 | #endif 13 | 14 | /* Version settings *****************************************************/ 15 | 16 | /* Macros ***************************************************************/ 17 | 18 | /* Type definitions *****************************************************/ 19 | class TriggerDaemon : public Daemon 20 | { 21 | public: 22 | TriggerDaemon 23 | ( 24 | OurBool fActive 25 | ); 26 | ~TriggerDaemon(); 27 | virtual void Triggered(void) = 0; 28 | // called by the daemon's activity whenever the daemon decides to 29 | // trigger it. 30 | private: 31 | 32 | }; 33 | 34 | // A daemon which fires at regular intervals (potentially more than once per frame) 35 | class PulsingTriggerDaemon : public TriggerDaemon 36 | { 37 | public: 38 | PulsingTriggerDaemon 39 | ( 40 | OurBool fActive, 41 | int FixP_Period // interval between triggers in seconds 42 | ); 43 | 44 | ~PulsingTriggerDaemon(); 45 | 46 | ACTIVITY_RETURN_TYPE Activity(ACTIVITY_INPUT); 47 | // never causes callback hooks to fire 48 | 49 | void SetFuse_FixP 50 | ( 51 | int FixP_Fuse // time until it next triggers; doesn't change the period 52 | ); 53 | 54 | // void Triggered(void) remains pure virtual 55 | private: 56 | int FixP_Period_Val; 57 | int FixP_TimeToNextPulse; 58 | }; 59 | 60 | // A countdown daemon which DESTROYS ITSELF after it triggers 61 | class CountdownDaemon : public TriggerDaemon 62 | { 63 | public: 64 | CountdownDaemon 65 | ( 66 | OurBool fActive, 67 | int FixP_Fuse // time until it triggers 68 | ); 69 | 70 | ~CountdownDaemon(); 71 | 72 | ACTIVITY_RETURN_TYPE Activity(ACTIVITY_INPUT); 73 | // never causes callback hooks to fire 74 | 75 | void SetFuse_FixP 76 | ( 77 | int FixP_Fuse // time until it triggers 78 | ); 79 | 80 | // void Triggered(void) remains pure virtual 81 | private: 82 | int FixP_TimeRemaining; 83 | }; 84 | 85 | 86 | /* Exported globals *****************************************************/ 87 | 88 | /* Function prototypes **************************************************/ 89 | 90 | 91 | 92 | /* End of the header ****************************************************/ 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /src/avp/support/wrapstr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | wrapstr.hpp 4 | 5 | Support for word-wrapping strings: the heart of it takes a string, 6 | a font, and a width, and creates a list of strings objects guaranteed 7 | to have width less than or equal to the specified width when displayed with 8 | the specified font. 9 | 10 | This guarantee is not absolute; it can fail to be upheld if there's a word 11 | in the string that's wider than the width you give it (and thus can't fit 12 | without being broken) 13 | 14 | There is no support for mixing fonts. 15 | 16 | There is no support for carriage returns, tabs, etc. 17 | 18 | */ 19 | 20 | #ifndef _wrapstr_hpp 21 | #define _wrapstr_hpp 1 22 | 23 | #if defined( _MSC_VER ) 24 | #pragma once 25 | #endif 26 | 27 | #ifndef _scstring 28 | #include "scstring.hpp" 29 | #endif 30 | 31 | #ifndef _indexfnt 32 | #include "indexfnt.hpp" 33 | #endif 34 | 35 | #ifndef _reflist_hpp 36 | #include "reflist.hpp" 37 | #endif 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /* Version settings *****************************************************/ 44 | 45 | /* Constants ***********************************************************/ 46 | 47 | /* Macros ***************************************************************/ 48 | 49 | /* Type definitions *****************************************************/ 50 | 51 | /* Exported globals *****************************************************/ 52 | 53 | /* Function prototypes **************************************************/ 54 | namespace WordWrap 55 | { 56 | /* Deprecated version; to be phased out once we have interators for RefLists 57 | since you have to manually release references as you destroy all/parts of the list 58 | */ 59 | extern List* DeprecatedMake 60 | ( 61 | const SCString& SCString_In, 62 | 63 | const IndexedFont& IndexedFnt_In, 64 | 65 | int W_FirstLine_In, 66 | int W_Subsequently_In 67 | // widths to wrap with. 68 | // They are different in order to support paragraph starts of various kinds 69 | // e.g. bulleting 70 | ); 71 | 72 | extern RefList* Make 73 | ( 74 | const SCString& SCString_In, 75 | 76 | const IndexedFont& IndexedFnt_In, 77 | 78 | int W_FirstLine_In, 79 | int W_Subsequently_In 80 | // widths to wrap with. 81 | // They are different in order to support paragraph starts of various kinds 82 | // e.g. bulleting 83 | ); 84 | 85 | int bWhitespace( ProjChar ProjCh ); 86 | 87 | int bWithinWord( ProjChar* pProjCh_Test ); 88 | 89 | }; 90 | 91 | 92 | /* End of the header ****************************************************/ 93 | 94 | 95 | #ifdef __cplusplus 96 | }; 97 | #endif 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /src/avp/targeting.h: -------------------------------------------------------------------------------- 1 | /* KJL 16:20:20 19/05/98 - targeting externs */ 2 | 3 | extern void GetTargetingPointOfObject(DISPLAYBLOCK *objectPtr, VECTORCH *targetPtr); 4 | extern void GetTargetingPointOfObject_Far(STRATEGYBLOCK *sbPtr, VECTORCH *targetPtr); 5 | extern void CalculatePlayersTarget(TEMPLATE_WEAPON_DATA *twPtr, PLAYER_WEAPON_DATA *weaponPtr); 6 | void SmartTarget_GetCofM(DISPLAYBLOCK *target,VECTORCH *viewSpaceOutput); 7 | -------------------------------------------------------------------------------- /src/avp/triggers.h: -------------------------------------------------------------------------------- 1 | extern void OperateObjectInLineOfSight(void); 2 | extern BOOL AnythingInMyModule(MODULE* my_mod); 3 | -------------------------------------------------------------------------------- /src/avp/win95/avpreg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "avpreg.hpp" 4 | 5 | extern "C" 6 | { 7 | char* AvpCDPath=0; 8 | extern char const * SecondTex_Directory; 9 | extern char * SecondSoundDir; 10 | 11 | void GetPathFromRegistry() 12 | { 13 | HKEY hKey; 14 | 15 | if(AvpCDPath) 16 | { 17 | delete AvpCDPath; 18 | AvpCDPath=0; 19 | } 20 | 21 | if 22 | ( 23 | ERROR_SUCCESS == RegOpenKeyEx 24 | ( 25 | HKEY_LOCAL_MACHINE, 26 | "Software\\Fox Interactive\\Aliens vs Predator\\1.00", 27 | REG_OPTION_NON_VOLATILE, 28 | KEY_ALL_ACCESS, 29 | &hKey 30 | ) 31 | ) 32 | { 33 | char szBuf[MAX_PATH+1]; 34 | DWORD dwType = REG_NONE; 35 | DWORD dwSize = sizeof szBuf; 36 | 37 | if 38 | ( 39 | ERROR_SUCCESS == RegQueryValueEx 40 | ( 41 | hKey, 42 | const_cast("Source Path"), 43 | 0, 44 | &dwType, 45 | reinterpret_cast(szBuf), 46 | &dwSize 47 | ) 48 | && REG_SZ == dwType 49 | ) 50 | { 51 | int length=strlen(szBuf); 52 | if(length) 53 | { 54 | AvpCDPath=new char[length+1]; 55 | strcpy(AvpCDPath,szBuf); 56 | } 57 | 58 | } 59 | 60 | RegCloseKey(hKey); 61 | } 62 | 63 | //now set second texture directory 64 | if(!SecondTex_Directory) 65 | { 66 | char* directory; 67 | if(AvpCDPath) 68 | { 69 | directory=new char[strlen(AvpCDPath)+10]; 70 | sprintf(directory,"%sGraphics",AvpCDPath); 71 | } 72 | else 73 | { 74 | directory=new char[40]; 75 | strcpy(directory,"\\\\bob\\textures\\avp_graphics"); 76 | } 77 | *(char**)&SecondTex_Directory=directory; 78 | } 79 | 80 | //and the second sound directory 81 | if(!SecondSoundDir) 82 | { 83 | char* directory; 84 | if(AvpCDPath) 85 | { 86 | directory=new char[strlen(AvpCDPath)+20]; 87 | sprintf(directory,"%ssound\\",AvpCDPath); 88 | } 89 | else 90 | { 91 | directory=new char[40]; 92 | strcpy(directory,"\\\\bob\\vss\\avp\\sound\\"); 93 | } 94 | SecondSoundDir=directory; 95 | } 96 | 97 | 98 | } 99 | 100 | }; -------------------------------------------------------------------------------- /src/avp/win95/avpreg.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _avpreg_h 2 | #define _avpreg_h 1 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | 10 | extern char* AvpCDPath; 11 | void GetPathFromRegistry(); 12 | 13 | 14 | #ifdef __cplusplus 15 | }; 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /src/avp/win95/cheat.h: -------------------------------------------------------------------------------- 1 | extern void HandleCheatModes(void); 2 | extern void GiveAllWeaponsCheat(void); 3 | -------------------------------------------------------------------------------- /src/avp/win95/d3d_hud.h: -------------------------------------------------------------------------------- 1 | #ifndef __AVP_WIN95_D3D_HUD_H__ 2 | #define __AVP_WIN95_D3D_HUD_H__ 3 | 4 | #include "langenum.h" 5 | 6 | extern int TransparencyLevelOfHUD; 7 | /* takes values of 0 (not drawn) to 255 (opaque) */ 8 | 9 | struct VertexTag 10 | { 11 | int X; 12 | int Y; 13 | int U; 14 | int V; 15 | }; 16 | 17 | typedef struct 18 | { 19 | int ImageNumber; 20 | 21 | int TopLeftX; 22 | int TopLeftY; 23 | 24 | int TopLeftU; 25 | int TopLeftV; 26 | 27 | int Width; 28 | int Height; 29 | 30 | int Scale; 31 | 32 | unsigned char Red; 33 | unsigned char Green; 34 | unsigned char Blue; 35 | unsigned char Translucency; /* 0 == invisible, 255 == opaque */ 36 | 37 | } HUDImageDesc; 38 | 39 | 40 | typedef struct 41 | { 42 | char Character; 43 | int X; 44 | int Y; 45 | 46 | unsigned char Red; 47 | unsigned char Green; 48 | unsigned char Blue; 49 | unsigned char Alpha; 50 | 51 | } HUDCharDesc; 52 | 53 | extern void D3D_HUD_Setup(void); 54 | extern void D3D_HUDQuad_Output(int imageNumber,struct VertexTag *quadVerticesPtr,unsigned int colour); 55 | 56 | extern void D3D_DrawHUDFontCharacter(HUDCharDesc *charDescPtr); 57 | extern void D3D_DrawHUDDigit(HUDCharDesc *charDescPtr); 58 | 59 | 60 | extern void D3D_BlitWhiteChar(int x, int y, unsigned char c); 61 | 62 | 63 | 64 | /* KJL 17:55:48 18/04/98 - called by HUD.c */ 65 | extern void Render_HealthAndArmour(unsigned int health, unsigned int armour); 66 | extern void Render_MarineAmmo(enum TEXTSTRING_ID ammoText, enum TEXTSTRING_ID magazinesText, unsigned int magazines, enum TEXTSTRING_ID roundsText, unsigned int rounds, int primaryAmmo); 67 | void D3D_DrawHUDPredatorDigit(HUDCharDesc *charDescPtr, int scale); 68 | void Draw_HUDImage(HUDImageDesc *imageDescPtr); 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/avp/win95/d3d_render.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_d3d_render_h_ /* Is this your first time? */ 2 | #define _included_d3d_render_h_ 1 3 | #include "particle.h" 4 | 5 | extern void D3D_SetupSceneDefaults(void); 6 | extern void D3D_DrawBackdrop(void); 7 | extern void PostLandscapeRendering(void); 8 | extern void D3D_DrawWaterTest(MODULE *testModulePtr); 9 | 10 | 11 | extern void D3D_ZBufferedCloakedPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr); 12 | extern void D3D_ZBufferedGouraudTexturedPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr); 13 | extern void D3D_ZBufferedGouraudPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr); 14 | extern void D3D_ZBufferedTexturedPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr); 15 | extern void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr); 16 | 17 | extern void D3D_BackdropPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr); 18 | extern void D3D_Decal_Output(DECAL *decalPtr,RENDERVERTEX *renderVerticesPtr); 19 | extern void D3D_Particle_Output(PARTICLE *particlePtr,RENDERVERTEX *renderVerticesPtr); 20 | extern void D3D_DrawParticle_Rain(PARTICLE *particlePtr,VECTORCH *prevPositionPtr); 21 | 22 | extern void D3D_DecalSystem_Setup(void); 23 | extern void D3D_DecalSystem_End(void); 24 | 25 | extern void D3D_FadeDownScreen(int brightness, int colour); 26 | extern void D3D_PlayerOnFireOverlay(void); 27 | 28 | 29 | extern void CheckWireFrameMode(int shouldBeOn); 30 | 31 | extern void InitForceField(void); 32 | #endif 33 | -------------------------------------------------------------------------------- /src/avp/win95/datatype.h: -------------------------------------------------------------------------------- 1 | #define CHAR char 2 | #define BYTE unsigned char 3 | #define WORD unsigned short 4 | #define DWORD unsigned int 5 | 6 | #define SHORT short 7 | #define VOID void 8 | -------------------------------------------------------------------------------- /src/avp/win95/dp_func.h: -------------------------------------------------------------------------------- 1 | /*------------------------------Patrick 18/3/97------------------------ 2 | Header for setting up and handling direct play objects 3 | (This is mostly nicked from DHM's headhunter stuff) 4 | -----------------------------------------------------------------------*/ 5 | #ifndef dpfunc_h_included 6 | #define dpfunc_h_included 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /* globals */ 12 | extern LPDIRECTPLAY4 glpDP; 13 | extern LPGUID glpGuid; 14 | 15 | extern DPNAME AVPDPplayerName; 16 | extern DPID AVPDPNetID; 17 | 18 | 19 | /* Constants */ 20 | #define MAX_SIZE_FORMAL_NAME 128+1 21 | #define MAX_SIZE_FRIENDLY_NAME 128+1 22 | 23 | 24 | HRESULT DPlayClose(void); 25 | HRESULT DPlayCreate(LPVOID lpCon); 26 | HRESULT DPlayCreatePlayer(LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent, 27 | LPVOID lpData, DWORD dwDataSize); 28 | HRESULT DPlayCreateSession(LPTSTR lptszSessionName,int maxPlayers,int dwUser1,int dwUser2); 29 | HRESULT DPlayDestroyPlayer(DPID pid); 30 | HRESULT DPlayEnumPlayers(LPGUID lpSessionGuid, LPDPENUMPLAYERSCALLBACK2 lpEnumCallback, 31 | LPVOID lpContext, DWORD dwFlags); 32 | HRESULT DPlayEnumSessions(DWORD dwTimeout, LPDPENUMSESSIONSCALLBACK2 lpEnumCallback, 33 | LPVOID lpContext, DWORD dwFlags); 34 | HRESULT DPlayGetPlayerData(DPID pid, LPVOID lpData, LPDWORD lpdwDataSize, DWORD dwFlags); 35 | HRESULT DPlayClose(void); 36 | HRESULT DPlayCreate(LPVOID lpCon); 37 | HRESULT DPlayCreatePlayer(LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent, 38 | LPVOID lpData, DWORD dwDataSize); 39 | HRESULT DPlayDestroyPlayer(DPID pid); 40 | HRESULT DPlayEnumSessions(DWORD dwTimeout, LPDPENUMSESSIONSCALLBACK2 lpEnumCallback, 41 | LPVOID lpContext, DWORD dwFlags); 42 | HRESULT DPlayGetPlayerData(DPID pid, LPVOID lpData, LPDWORD lpdwDataSize, DWORD dwFlags); 43 | HRESULT DPlayGetSessionDesc(void); 44 | BOOL IsDPlay(void); 45 | HRESULT DPlayOpenSession(LPGUID lpSessionGuid); 46 | HRESULT DPlayReceive(LPDPID lpidFrom, LPDPID lpidTo, DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize); 47 | HRESULT DPlayRelease(void); 48 | HRESULT DPlaySend(DPID idFrom, DPID idTo, DWORD dwFlags, LPVOID lpData, DWORD dwDataSize); 49 | HRESULT DPlaySetPlayerData(DPID pid, LPVOID lpData, DWORD dwSize, DWORD dwFlags); 50 | 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /src/avp/win95/endianio.c: -------------------------------------------------------------------------------- 1 | #include "endianio.h" 2 | 3 | BYTE GetByte(FILE *fp) 4 | { 5 | unsigned char c = fgetc(fp); 6 | return c; 7 | } 8 | 9 | WORD GetLittleWord(FILE *fp) 10 | { 11 | unsigned char c1 = fgetc(fp); 12 | unsigned char c2 = fgetc(fp); 13 | return c1 + (c2 << 8); 14 | } 15 | 16 | DWORD GetLittleDword(FILE *fp) 17 | { 18 | unsigned char c1 = fgetc(fp); 19 | unsigned char c2 = fgetc(fp); 20 | unsigned char c3 = fgetc(fp); 21 | unsigned char c4 = fgetc(fp); 22 | 23 | return c1 + ((c2 + ((c3 + (c4 << 8)) << 8)) << 8); 24 | } 25 | 26 | VOID PutByte(BYTE v, FILE *fp) 27 | { 28 | fputc(v, fp); 29 | } 30 | 31 | VOID PutLittleWord(WORD v, FILE *fp) 32 | { 33 | unsigned char c1 = v & 0xff; 34 | unsigned char c2 = (v >> 8) & 0xff; 35 | fputc(c1, fp); 36 | fputc(c2, fp); 37 | } 38 | 39 | VOID PutLittleDword(DWORD v, FILE *fp) 40 | { 41 | unsigned char c1 = v & 0xff; 42 | unsigned char c2 = (v >> 8) & 0xff; 43 | unsigned char c3 = (v >> 16) & 0xff; 44 | unsigned char c4 = (v >> 24) & 0xff; 45 | 46 | fputc(c1, fp); 47 | fputc(c2, fp); 48 | fputc(c3, fp); 49 | fputc(c4, fp); 50 | } 51 | -------------------------------------------------------------------------------- /src/avp/win95/endianio.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_endianio_h_ 2 | #define _included_endianio_h_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif /* __cplusplus */ 7 | 8 | #include 9 | 10 | #include "datatype.h" 11 | 12 | BYTE GetByte(FILE *fp); 13 | WORD GetLittleWord(FILE *fp); 14 | DWORD GetLittleDword(FILE *fp); 15 | 16 | VOID PutByte(BYTE v, FILE *fp); 17 | VOID PutLittleWord(WORD v, FILE *fp); 18 | VOID PutLittleDword(DWORD v, FILE *fp); 19 | 20 | #ifdef __cplusplus 21 | }; 22 | #endif /* __cplusplus */ 23 | 24 | #endif /* _included_endianio_h_ */ 25 | 26 | -------------------------------------------------------------------------------- /src/avp/win95/ffstdio.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_ffstdio_h_ 2 | #define _included_ffstdio_h_ 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define FFF_EOF 0x0001 11 | #define FFF_ERR 0x0002 12 | #define FFF_ALOC 0x0004 13 | 14 | struct _FFile 15 | { 16 | void const * data_start; 17 | unsigned char const * data_ptr; 18 | size_t length; 19 | size_t pos; 20 | size_t remaining; 21 | int flag; 22 | }; 23 | typedef struct _FFile FFILE; 24 | typedef size_t ffpos_t; 25 | 26 | extern int ffInit(char const * infofilename, char const * ffpath); 27 | extern void ffKill(void); /* only need to call this to prevent misreported memory leaks */ 28 | 29 | /* only mode supported is "rb" */ 30 | extern int ffclearerr(FFILE * fp); 31 | extern int ffclose(FFILE * fp); 32 | extern int ffcloseall(void); 33 | extern int ffclose_almost_all(void); 34 | extern int ffeof(FFILE * fp); 35 | extern int fferror(FFILE * fp); 36 | extern int ffgetc(FFILE * fp); 37 | extern int ffgetpos(FFILE * fp, ffpos_t * pos); 38 | extern char * ffgets(char * s, int n, FFILE * fp); 39 | extern size_t fflook(void const * * ptr, size_t size, size_t n, FFILE * fp); 40 | extern size_t fflookb(void const * * ptr, size_t n, FFILE * fp); 41 | extern FFILE * ffopen(char const * filename, char const * mode); 42 | extern size_t ffread(void * ptr, size_t size, size_t n, FFILE * fp); 43 | extern size_t ffreadb(void * ptr, size_t n, FFILE * fp); 44 | extern int ffseek(FFILE * fp, long offset, int whence); 45 | extern int ffsetpos(FFILE * fp, ffpos_t const * pos); 46 | extern long fftell(FFILE * fp); 47 | 48 | /* this function is called by ffopen, but you can call it direct 49 | to get a pointer to memory where the contents of a file exist */ 50 | /* nb. the buffer remains valid until a call to ffcloseall */ 51 | extern void const * ffreadbuf(char const * filename, size_t * len); 52 | 53 | /* speedy macros */ 54 | #define ffclearerr(fp) ((fp)->flag &= ~(FFF_ERR|FFF_EOF)) 55 | #define ffeof(fp) ((fp)->flag & FFF_EOF) 56 | #define fferror(fp) ((fp)->flag & FFF_ERR) 57 | #define ffgetpos(fp,pos) (*(pos) = (fp)->pos,0) 58 | #define fftell(fp) ((fp)->pos) 59 | #define ffread(ptr,size,n,fp) ffreadb(ptr,(size)*(n),fp) 60 | #define fflook(ptr,size,n,fp) fflookb(ptr,(size)*(n),fp) 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* ! _included_ffstdio_h_ */ 67 | -------------------------------------------------------------------------------- /src/avp/win95/frontend/avp_intro.h: -------------------------------------------------------------------------------- 1 | #ifndef AVP_INTRO_H 2 | #define AVP_INTRO_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | void PlayMenuMusic(void); 9 | void EndMenuMusic(void); 10 | void PlayIntroSequence(void); 11 | void WeWantAnIntro(void); 12 | #ifdef __cplusplus 13 | }; 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/avp/win95/frontend/avp_menudata.h: -------------------------------------------------------------------------------- 1 | #ifndef AVP_MENUDATA_H 2 | #define AVP_MENUDATA_H 3 | 4 | void MakeConnectionSelectMenu(); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/avp/win95/frontend/avp_mp_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_AvP_MP_Config_h_ 2 | #define _included_AvP_MP_Config_h_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | BOOL BuildLoadMPConfigMenu(); 9 | void LoadMultiplayerConfigurationByIndex(int index); 10 | void LoadMultiplayerConfiguration(const char* name); 11 | void SaveMultiplayerConfiguration(const char* name); 12 | const char* GetMultiplayerConfigDescription(int index); 13 | void DeleteMultiplayerConfigurationByIndex(int index); 14 | 15 | 16 | BOOL BuildLoadIPAddressMenu(); 17 | void SaveIPAddress(const char* name,const char* address); 18 | void LoadIPAddress(const char* name); 19 | 20 | #define LOAD_NEW_MPCONFIG_ENTRIES (1) 21 | #define SAVE_NEW_MPCONFIG_ENTRIES (1) 22 | 23 | 24 | 25 | extern int NumCustomLevels; 26 | extern int NumMultiplayerLevels; 27 | extern int NumCoopLevels; 28 | 29 | //list of all multiplayer level names as they appear in the menus 30 | extern char** MultiplayerLevelNames; 31 | extern char** CoopLevelNames; 32 | 33 | extern void BuildMultiplayerLevelNameArray(); 34 | 35 | //returns local index of a custom level (if it is a custom level) 36 | int GetCustomMultiplayerLevelIndex(char* name,int gameType); 37 | //returns name of custom level (without stuff tacked on the end) 38 | char* GetCustomMultiplayerLevelName(int index,int gameType); 39 | 40 | int GetLocalMultiplayerLevelIndex(int index,char* customLevelName,int gameType); 41 | 42 | #ifdef __cplusplus 43 | }; 44 | #endif 45 | 46 | #endif // _included_AvP_MP_Config_h_ 47 | -------------------------------------------------------------------------------- /src/avp/win95/gadgets/ahudgadg.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | ahudgadg.hpp 4 | 5 | Alien HUD gadget; a concrete derived class of abstract class "HUDGadget" 6 | 7 | */ 8 | 9 | #ifndef _ahudgadg 10 | #define _ahudgadg 1 11 | 12 | #ifndef _hudgadg 13 | #include "hudgadg.hpp" 14 | #endif 15 | 16 | 17 | #ifdef __cplusplus 18 | /* Version settings *****************************************************/ 19 | 20 | /* Constants ***********************************************************/ 21 | 22 | /* Macros ***************************************************************/ 23 | 24 | /* Type definitions *****************************************************/ 25 | #if UseGadgets 26 | class TextEntryGadget; // fully declared in TEXTIN.HPP 27 | 28 | class AlienHUDGadget : public HUDGadget 29 | { 30 | public: 31 | void Render 32 | ( 33 | const struct r2pos& R2Pos, 34 | const struct r2rect& R2Rect_Clip, 35 | int FixP_Alpha 36 | ); 37 | 38 | AlienHUDGadget(); 39 | ~AlienHUDGadget(); 40 | 41 | void AddTextReport 42 | ( 43 | SCString* pSCString_ToAdd 44 | // ultimately turn into an MCString 45 | ); 46 | void ClearTheTextReportQueue(void); 47 | 48 | #if EnableStatusPanels 49 | void RequestStatusPanel 50 | ( 51 | enum StatusPanelIndex I_StatusPanel 52 | ); 53 | 54 | void NoRequestedPanel(void); 55 | #endif 56 | 57 | void CharTyped 58 | ( 59 | char Ch 60 | // note that this _is _ a char 61 | ); 62 | void Key_Backspace(void); 63 | void Key_End(void); 64 | void Key_Home(void); 65 | void Key_Left(void); 66 | void Key_Up(void); 67 | void Key_Right(void); 68 | void Key_Down(void); 69 | void Key_Delete(void); 70 | void Key_Tab(void); 71 | 72 | void SetString(const char* text); 73 | 74 | void Jitter(int FixP_Magnitude); 75 | 76 | TextReportGadget* pTextReportGadg; 77 | private: 78 | // not allowed to be NULL 79 | 80 | TextEntryGadget* pTextEntryGadg; 81 | // not allowed to be NULL 82 | }; 83 | #endif // UseGadgets 84 | #endif 85 | 86 | /* Exported globals *****************************************************/ 87 | 88 | #ifdef __cplusplus 89 | extern "C" { 90 | #endif 91 | 92 | /* Function prototypes **************************************************/ 93 | void BringDownConsoleWithSayTypedIn(); 94 | void BringDownConsoleWithSaySpeciesTypedIn(); 95 | 96 | 97 | /* End of the header ****************************************************/ 98 | 99 | 100 | #ifdef __cplusplus 101 | }; 102 | #endif 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /src/avp/win95/gadgets/conscmnd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | conscmnd.hpp 4 | 5 | */ 6 | 7 | #ifndef _conscmnd 8 | #define _conscmnd 1 9 | 10 | #if defined( _MSC_VER ) 11 | #pragma once 12 | #endif 13 | 14 | #ifndef _conssym_hpp 15 | #include "conssym.hpp" 16 | #endif 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /* Version settings *****************************************************/ 23 | 24 | /* Constants ***********************************************************/ 25 | 26 | /* Macros ***************************************************************/ 27 | 28 | /* Type definitions *****************************************************/ 29 | class ConsoleCommand : public ConsoleSymbol 30 | { 31 | public: 32 | static void CreateAll(void); 33 | 34 | // Various factory methods: 35 | static void Make 36 | ( 37 | ProjChar* pProjCh_ToUse, 38 | ProjChar* pProjCh_Description_ToUse, 39 | void (&f) (void), 40 | OurBool Cheat = FALSE 41 | ); 42 | static void Make 43 | ( 44 | ProjChar* pProjCh_ToUse, 45 | ProjChar* pProjCh_Description_ToUse, 46 | void (&f) (int), 47 | OurBool Cheat = FALSE 48 | ); 49 | static void Make 50 | ( 51 | ProjChar* pProjCh_ToUse, 52 | ProjChar* pProjCh_Description_ToUse, 53 | int (&f) (void), 54 | OurBool Cheat = FALSE 55 | ); 56 | static void Make 57 | ( 58 | ProjChar* pProjCh_ToUse, 59 | ProjChar* pProjCh_Description_ToUse, 60 | int (&f) (int), 61 | OurBool Cheat = FALSE 62 | ); 63 | static void Make 64 | ( 65 | ProjChar* pProjCh_ToUse, 66 | ProjChar* pProjCh_Description_ToUse, 67 | void (&f) (char*), 68 | OurBool Cheat = FALSE 69 | ); 70 | 71 | static OurBool Process( ProjChar* pProjCh_In ); 72 | // used for proccesing input text. 73 | // return value = was any processing performed? 74 | 75 | static void ListAll(void); 76 | 77 | virtual void Execute( ProjChar* pProjCh_In ) = 0; 78 | 79 | 80 | 81 | void Display(void) const; 82 | 83 | 84 | protected: 85 | ConsoleCommand 86 | ( 87 | ProjChar* pProjCh_ToUse, 88 | ProjChar* pProjCh_Description_ToUse, 89 | OurBool Cheat = FALSE 90 | ); 91 | 92 | void EchoResult(int Result); 93 | int GetArg(ProjChar* pProjCh_Arg); 94 | 95 | private: 96 | SCString* pSCString_Description; 97 | 98 | static List List_pConsoleCommand; 99 | public: 100 | virtual ~ConsoleCommand(); 101 | }; 102 | 103 | 104 | /* Exported globals *****************************************************/ 105 | 106 | /* Function prototypes **************************************************/ 107 | 108 | 109 | 110 | /* End of the header ****************************************************/ 111 | 112 | 113 | #ifdef __cplusplus 114 | }; 115 | #endif 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /src/avp/win95/gadgets/conssym.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * 3 | * DESCRIPTION: conssym.cpp 4 | * 5 | * AUTHOR: David Malcolm 6 | * 7 | * HISTORY: Created 26/1/98 8 | * 9 | *******************************************************************/ 10 | 11 | /* Includes ********************************************************/ 12 | #include "3dc.h" 13 | #include "conssym.hpp" 14 | 15 | #define UseLocalAssert Yes 16 | #include "ourasert.h" 17 | 18 | /* Version settings ************************************************/ 19 | 20 | /* Constants *******************************************************/ 21 | 22 | /* Macros **********************************************************/ 23 | 24 | /* Imported function prototypes ************************************/ 25 | 26 | /* Imported data ***************************************************/ 27 | #ifdef __cplusplus 28 | extern "C" 29 | { 30 | #endif 31 | #if 0 32 | extern OurBool DaveDebugOn; 33 | extern FDIEXTENSIONTAG FDIET_Dummy; 34 | extern IFEXTENSIONTAG IFET_Dummy; 35 | extern FDIQUAD FDIQuad_WholeScreen; 36 | extern FDIPOS FDIPos_Origin; 37 | extern FDIPOS FDIPos_ScreenCentre; 38 | extern IFOBJECTLOCATION IFObjLoc_Origin; 39 | extern UncompressedGlobalPlotAtomID UGPAID_StandardNull; 40 | extern IFCOLOUR IFColour_Dummy; 41 | extern IFVECTOR IFVec_Zero; 42 | #endif 43 | #ifdef __cplusplus 44 | }; 45 | #endif 46 | 47 | 48 | 49 | /* Exported globals ************************************************/ 50 | /*static*/ List ConsoleSymbol :: List_pConsoleSym; 51 | 52 | /* Internal type definitions ***************************************/ 53 | 54 | /* Internal function prototypes ************************************/ 55 | 56 | /* Internal globals ************************************************/ 57 | 58 | /* Exported function definitions ***********************************/ 59 | // class ConsoleSymbol 60 | // public: 61 | 62 | // protected: 63 | ConsoleSymbol :: ConsoleSymbol 64 | ( 65 | ProjChar* pProjCh_ToUse 66 | ) : pSCString_Symbol 67 | ( 68 | new SCString( pProjCh_ToUse ) 69 | // constructor for the SCString adds the required reference 70 | ) 71 | { 72 | List_pConsoleSym . add_entry 73 | ( 74 | this 75 | ); 76 | } 77 | 78 | ConsoleSymbol :: ~ConsoleSymbol() 79 | { 80 | pSCString_Symbol ->R_Release(); 81 | 82 | // remove from the list 83 | List_pConsoleSym . delete_entry 84 | ( 85 | this 86 | ); 87 | } 88 | 89 | 90 | 91 | 92 | /* Internal function definitions ***********************************/ 93 | -------------------------------------------------------------------------------- /src/avp/win95/gadgets/conssym.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | conssym.hpp 4 | 5 | "Console symbols" - a base class for managing auto-completion of typing. 6 | 7 | Console commands and variables are derived from this class 8 | 9 | */ 10 | 11 | #ifndef _conssym_hpp 12 | #define _conssym_hpp 1 13 | 14 | #if defined( _MSC_VER ) 15 | #pragma once 16 | #endif 17 | 18 | #ifndef _scstring 19 | #include "scstring.hpp" 20 | #endif 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* Version settings *****************************************************/ 27 | 28 | /* Constants ***********************************************************/ 29 | 30 | /* Macros ***************************************************************/ 31 | 32 | /* Type definitions *****************************************************/ 33 | 34 | class ConsoleSymbol 35 | { 36 | friend class TextInputState; 37 | /* WARNING! 38 | 39 | TextInputState objects can refer to the list of ConsoleSymbols 40 | in order to iterate through possible completion strings. For 41 | this reason, don't destroy ConsoleSymbol objects if TextInputState 42 | objects exist... 43 | (I believe I've asserted against all such possible failures) 44 | */ 45 | 46 | public: 47 | 48 | OurBool ThisIsACheat; 49 | protected: 50 | ConsoleSymbol 51 | ( 52 | ProjChar* pProjCh_ToUse 53 | ); 54 | 55 | 56 | SCString* pSCString_Symbol; 57 | 58 | public: 59 | SCString* GetpSCString(void) const 60 | { 61 | return pSCString_Symbol; 62 | } 63 | 64 | 65 | private: 66 | 67 | static List List_pConsoleSym; 68 | 69 | public: 70 | virtual ~ConsoleSymbol(); 71 | }; // suggested naming: "ConsoleSym" 72 | 73 | /* Exported globals *****************************************************/ 74 | 75 | /* Function prototypes **************************************************/ 76 | 77 | 78 | 79 | /* End of the header ****************************************************/ 80 | 81 | 82 | #ifdef __cplusplus 83 | }; 84 | #endif 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/avp/win95/gadgets/rootgadg.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | rootgadg.hpp 4 | 5 | */ 6 | 7 | #ifndef _rootgadg 8 | #define _rootgadg 1 9 | 10 | #ifndef _gadget 11 | #include "gadget.h" 12 | #endif 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* Version settings *****************************************************/ 19 | 20 | /* Constants ***********************************************************/ 21 | 22 | /* Macros ***************************************************************/ 23 | 24 | /* Type definitions *****************************************************/ 25 | 26 | #if UseGadgets 27 | class HUDGadget; // fully declared in HUDGADG.HPP 28 | 29 | class RootGadget : public Gadget 30 | { 31 | friend void GADGET_Init(void); 32 | friend void GADGET_UnInit(void); 33 | // friend functions: these get permission in order to allow 34 | // construction/destruction 35 | 36 | public: 37 | void Render 38 | ( 39 | const struct r2pos& R2Pos, 40 | const struct r2rect& R2Rect_Clip, 41 | int FixP_Alpha 42 | ); 43 | 44 | static RootGadget* GetRoot(void); 45 | 46 | HUDGadget* GetHUD(void); 47 | 48 | void RefreshHUD(void); 49 | 50 | private: 51 | RootGadget(); 52 | 53 | 54 | private: 55 | static RootGadget* pSingleton; 56 | 57 | HUDGadget* pHUDGadg; 58 | // allowed to be NULL if no head-up-display e.g. when not in a game 59 | private: 60 | ~RootGadget(); 61 | }; 62 | 63 | // Inline methods: 64 | inline /*static*/ RootGadget* RootGadget::GetRoot(void) 65 | { 66 | return pSingleton; 67 | } 68 | inline HUDGadget* RootGadget::GetHUD(void) 69 | { 70 | return pHUDGadg; 71 | } 72 | #endif // UseGadgets 73 | 74 | /* Exported globals *****************************************************/ 75 | 76 | /* Function prototypes **************************************************/ 77 | 78 | 79 | 80 | /* End of the header ****************************************************/ 81 | 82 | 83 | #ifdef __cplusplus 84 | }; 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/avp/win95/gadgets/teletype.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | teletype.hpp 4 | 5 | Created 17/11/97 by David Malcolm 6 | 7 | */ 8 | 9 | #ifndef _teletype 10 | #define _teletype 1 11 | 12 | #ifndef _gadget 13 | #include "gadget.h" 14 | #endif 15 | 16 | /* Version settings *****************************************************/ 17 | 18 | /* Constants ***********************************************************/ 19 | #define I_Font_TeletypeLettering (DATABASE_MESSAGE_FONT) 20 | 21 | /* Macros ***************************************************************/ 22 | 23 | /* Type definitions *****************************************************/ 24 | #if UseGadgets 25 | #ifndef _ourbool 26 | #include "ourbool.h" 27 | #endif 28 | 29 | #ifndef _scstring 30 | #include "scstring.hpp" 31 | #endif 32 | 33 | // moved wrapper here since scstring.hpp is a C++ header and templates can't have C linkage 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | class TeletypeDaemon; // fully declared in TELETYPE.CPP 39 | class TextReportGadget; // fully declared in TREPGADG.HPP 40 | 41 | class TeletypeGadget : public Gadget 42 | { 43 | public: 44 | void Render 45 | ( 46 | const struct r2pos& R2Pos, 47 | const struct r2rect& R2Rect_Clip, 48 | int FixP_Alpha 49 | ); 50 | TeletypeGadget 51 | ( 52 | TextReportGadget* pTextReportGadg, 53 | // parent 54 | SCString* pSCString 55 | ); 56 | ~TeletypeGadget(); 57 | 58 | OurBool HasFinishedPrinting(void); 59 | // so that the next line knows when to begin 60 | 61 | SCString* GetStringWithoutReference(void); 62 | // Doesn't bother adding to reference count: 63 | 64 | void InformParentOfTeletypeCompletion(void); 65 | 66 | void DirectRenderCursor 67 | ( 68 | const struct r2pos& R2Pos, 69 | const struct r2rect& R2Rect_Clip, 70 | int FixP_Alpha 71 | ); 72 | // called by parent so that it can render its cursor even if 73 | // it's finished printing - so that the last message can have 74 | // a flashing cursor 75 | 76 | private: 77 | TextReportGadget* pTextReportGadg_Val; 78 | // so that when the daemon finishes it can inform the parent; the 79 | // parent can then start displaying any further lines in the queue... 80 | 81 | SCString* pSCString_Val; 82 | 83 | TeletypeDaemon* p666; 84 | 85 | }; 86 | 87 | inline SCString* TeletypeGadget::GetStringWithoutReference(void) 88 | { 89 | // Doesn't bother adding to reference count: 90 | return pSCString_Val; 91 | } 92 | 93 | #endif // UseGadgets 94 | 95 | /* Exported globals *****************************************************/ 96 | 97 | /* Function prototypes **************************************************/ 98 | 99 | 100 | 101 | /* End of the header ****************************************************/ 102 | 103 | 104 | #ifdef __cplusplus 105 | }; 106 | #endif 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /src/avp/win95/gadgets/textexp.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | textexp.hpp 4 | 5 | Text Expansions for typing 6 | 7 | */ 8 | 9 | #ifndef _textexp 10 | #define _textexp 1 11 | 12 | #ifndef _scstring 13 | #include "scstring.hpp" 14 | #endif 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* Version settings *****************************************************/ 21 | 22 | /* Constants ***********************************************************/ 23 | 24 | /* Macros ***************************************************************/ 25 | 26 | /* Type definitions *****************************************************/ 27 | // When typing, whenever space is pressed, the program searches 28 | // the last word typed to see if it matches one of the expansions 29 | // If it does, then the word is replaced by the expanded version 30 | // E.g. "SG" could be defined to expand to "SENTRYGUN" 31 | 32 | class TextInputState; // fully declared in TEXTIN.HPP 33 | 34 | class TextExpansion 35 | { 36 | public: 37 | 38 | 39 | void Display(void); 40 | // sends info on this expansion to the screen 41 | 42 | static void AddExpansion 43 | ( 44 | ProjChar* pProjCh_ToParse 45 | ); 46 | static void TryToRemoveExpansion 47 | ( 48 | ProjChar* pProjCh_ToParse 49 | ); 50 | 51 | static void TestForExpansions 52 | ( 53 | TextInputState* pTextInputState_In 54 | ); 55 | // Called by the typing code whenever a word is completed 56 | // This function is a friend to the class TextInputState 57 | 58 | static void ListAll(void); 59 | 60 | static int bVerbose; 61 | // public global so it can be accessed via a console variable 62 | 63 | private: 64 | TextExpansion 65 | ( 66 | SCString* pSCString_Short, 67 | SCString* pSCString_Expansion 68 | ); 69 | 70 | static void TryToRemoveExpansion 71 | ( 72 | SCString* pSCString_Word 73 | ); 74 | // assumed the word is already parsed/doesn't contain whitespace 75 | 76 | SCString* pSCString_Short_Val; 77 | SCString* pSCString_Expansion_Val; 78 | 79 | SCString* pSCString_Description_Val; 80 | // a string of the form: "" -> "" 81 | 82 | static List List_pTextExp; 83 | 84 | public: 85 | ~TextExpansion(); 86 | }; // suggested naming: TextExp 87 | 88 | /* Exported globals *****************************************************/ 89 | 90 | /* Function prototypes **************************************************/ 91 | 92 | 93 | 94 | 95 | 96 | /* End of the header ****************************************************/ 97 | 98 | 99 | #ifdef __cplusplus 100 | }; 101 | #endif 102 | 103 | 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /src/avp/win95/gameplat.h: -------------------------------------------------------------------------------- 1 | /* 2 | This contains project platfrom specifc externs 3 | and prototypes. Only valid when we are calling one 4 | p\p function from another. 5 | */ 6 | 7 | 8 | 9 | extern void LoadRifFile(); 10 | 11 | 12 | 13 | /* record of the histance passed to winmain */ 14 | 15 | 16 | extern HINSTANCE AVP_HInstance; 17 | extern int AVP_NCmd; 18 | 19 | extern int AVP_ChangeDisplayMode 20 | ( 21 | HINSTANCE hInst, 22 | int nCmd, 23 | int NewVideoMode, 24 | int NewWindowMode, 25 | int NewZBufferMode, 26 | int NewRasterisationMode, 27 | int NewSoftwareScanDrawMode, 28 | int NewDXMemoryMode 29 | ); 30 | 31 | 32 | 33 | extern int WindowMode; 34 | extern int WindowRequestMode; 35 | extern int VideoRequestMode; 36 | extern int ZBufferRequestMode; 37 | extern int RasterisationRequestMode; 38 | extern int SoftwareScanDrawRequestMode; 39 | extern int DXMemoryRequestMode; 40 | -------------------------------------------------------------------------------- /src/avp/win95/gammacontrol.cpp: -------------------------------------------------------------------------------- 1 | extern "C" 2 | { 3 | 4 | #include "3dc.h" 5 | #include "module.h" 6 | #include "inline.h" 7 | #include "gammacontrol.h" 8 | 9 | static int ActualGammaSetting; 10 | int RequestedGammaSetting; 11 | 12 | unsigned char GammaValues[256]; 13 | 14 | void InitialiseGammaSettings(int gamma) 15 | { 16 | ActualGammaSetting = gamma+1; 17 | RequestedGammaSetting = gamma; 18 | UpdateGammaSettings(); 19 | } 20 | 21 | void UpdateGammaSettings(void) 22 | { 23 | if (RequestedGammaSetting==ActualGammaSetting) return; 24 | 25 | for (int i=0; i<=255; i++) 26 | { 27 | int u = ((i*65536)/255); 28 | int m = MUL_FIXED(u,u); 29 | int l = MUL_FIXED(2*u,ONE_FIXED-u); 30 | 31 | int a; 32 | 33 | a = m+MUL_FIXED(RequestedGammaSetting*256,l); 34 | 35 | 36 | m = MUL_FIXED(a,a); 37 | l = MUL_FIXED(2*a,ONE_FIXED-a); 38 | 39 | a = m/256+MUL_FIXED(RequestedGammaSetting,l); 40 | 41 | if (a<0) a=0; 42 | if (a>255) a=255; 43 | 44 | GammaValues[i]=a; 45 | } 46 | 47 | ActualGammaSetting=RequestedGammaSetting; 48 | 49 | } 50 | 51 | }; 52 | -------------------------------------------------------------------------------- /src/avp/win95/gammacontrol.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_GammaControl_h_ 2 | #define _included_GammaControl_h_ 1 3 | 4 | extern void InitialiseGammaSettings(int gamma); 5 | extern void UpdateGammaSettings(void); 6 | extern int RequestedGammaSetting; 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/avp/win95/hierplace.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _hierplace_hpp 2 | #define _hierplace_hpp 1 3 | 4 | #include "chunk.hpp" 5 | #include "chnktype.hpp" 6 | 7 | class Placed_Hierarchy_Data_Chunk; 8 | 9 | class Placed_Hierarchy_Chunk : public Chunk_With_Children 10 | { 11 | public : 12 | 13 | Placed_Hierarchy_Chunk(Chunk_With_Children* parent,const char* _name,int _hierarchy_index,ChunkVectorInt& _location,ChunkQuat& _orientation); 14 | Placed_Hierarchy_Chunk(Chunk_With_Children * const parent,const char* ,const size_t); 15 | 16 | 17 | Placed_Hierarchy_Data_Chunk* get_data_chunk() 18 | { 19 | return (Placed_Hierarchy_Data_Chunk*)lookup_single_child("PLACHIDT"); 20 | } 21 | }; 22 | 23 | class Placed_Hierarchy_Data_Chunk : public Chunk 24 | { 25 | public : 26 | Placed_Hierarchy_Data_Chunk(Chunk_With_Children* parent,const char* , const size_t); 27 | Placed_Hierarchy_Data_Chunk(Chunk_With_Children* parent,const char* _name,int _hierarchy_index,ChunkVectorInt& _location,ChunkQuat& _orientation); 28 | ~Placed_Hierarchy_Data_Chunk(); 29 | 30 | void fill_data_block(char*); 31 | size_t size_chunk(); 32 | 33 | 34 | 35 | char* name; 36 | 37 | int hierarchy_index; 38 | 39 | ChunkVectorInt location; 40 | ChunkQuat orientation; 41 | 42 | ObjectID id; 43 | 44 | int num_extra_data; 45 | int* extra_data; 46 | 47 | 48 | }; 49 | 50 | struct Timed_Sound_Description 51 | { 52 | int sound_index; 53 | int start_time; //in ms 54 | int end_time; //in ms 55 | }; 56 | 57 | 58 | #define HierarchySequenceFlag_Loop 0x00000001 59 | #define HierarchySequenceFlag_InitialSequence 0x00000002 60 | #define HierarchySequenceFlag_Playing 0x00000004 61 | class Placed_Hierarchy_Sequence_Chunk : public Chunk 62 | { 63 | public: 64 | Placed_Hierarchy_Sequence_Chunk(Chunk_With_Children* parent,const char* , const size_t); 65 | Placed_Hierarchy_Sequence_Chunk(Chunk_With_Children* parent,int _index); 66 | ~Placed_Hierarchy_Sequence_Chunk(); 67 | 68 | void fill_data_block(char*); 69 | size_t size_chunk(); 70 | 71 | 72 | int index; 73 | int sequence; 74 | int sub_sequence; 75 | int time; //time to play sequence in ms 76 | int flags; 77 | 78 | int sound_list_size; 79 | Timed_Sound_Description* sound_list; 80 | 81 | 82 | int num_extra_data; 83 | int* extra_data; 84 | }; 85 | 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/avp/win95/hud_layout.h: -------------------------------------------------------------------------------- 1 | /* KJL 17:58:47 18/04/98 - layout defines */ 2 | 3 | #define HUD_FONT_WIDTH 15 4 | //5 5 | #define HUD_FONT_HEIGHT 15 6 | //8 7 | #define HUD_DIGITAL_NUMBERS_WIDTH 14 8 | #define HUD_DIGITAL_NUMBERS_HEIGHT 22 9 | 10 | #define HUDLayout_RightmostTextCentre -40 11 | 12 | #define HUDLayout_Health_TopY 10 13 | #define HUDLayout_Armour_TopY 60 14 | 15 | /* KJL 15:28:12 09/06/98 - the following are pixels from the bottom of the screen */ 16 | #define HUDLayout_Rounds_TopY 40 17 | #define HUDLayout_Magazines_TopY 90 18 | #define HUDLayout_AmmoDesc_TopY 115 19 | 20 | 21 | #define HUDLayout_Colour_BrightWhite 0xffffffff 22 | #define HUDLayout_Colour_MarineGreen ((255<<24)+(95<<16)+(179<<8)+(39)) 23 | #define HUDLayout_Colour_MarineRed ((255<<24)+(255<<16)) 24 | #define HUDLayout_Linespacing 16 25 | 26 | #ifdef __cplusplus 27 | extern "C" 28 | { 29 | #endif 30 | extern char AAFontWidths[]; 31 | #ifdef __cplusplus 32 | }; 33 | #endif 34 | -------------------------------------------------------------------------------- /src/avp/win95/iofocus.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * 3 | * DESCRIPTION: iofocus.cpp 4 | * 5 | * AUTHOR: David Malcolm 6 | * 7 | * HISTORY: Created 21/11/97 8 | * 9 | *******************************************************************/ 10 | 11 | /* Includes ********************************************************/ 12 | #include "3dc.h" 13 | #include "iofocus.h" 14 | #include "gadget.h" 15 | #include "psnd.h" 16 | extern "C" 17 | { 18 | #include "avp_menus.h" 19 | 20 | #define UseLocalAssert Yes 21 | #include "ourasert.h" 22 | 23 | /* Version settings ************************************************/ 24 | 25 | /* Constants *******************************************************/ 26 | 27 | /* Macros **********************************************************/ 28 | 29 | /* Imported function prototypes ************************************/ 30 | extern int InGameMenusAreRunning(void); 31 | 32 | /* Imported data ***************************************************/ 33 | 34 | 35 | /* Exported globals ************************************************/ 36 | 37 | /* Internal type definitions ***************************************/ 38 | 39 | /* Internal function prototypes ************************************/ 40 | 41 | /* Internal globals ************************************************/ 42 | static OurBool iofocus_AcceptTyping = No; 43 | 44 | /* Exported function definitions ***********************************/ 45 | OurBool IOFOCUS_AcceptControls(void) 46 | { 47 | return !iofocus_AcceptTyping; 48 | } 49 | 50 | OurBool IOFOCUS_AcceptTyping(void) 51 | { 52 | return iofocus_AcceptTyping; 53 | } 54 | 55 | void IOFOCUS_Toggle(void) 56 | { 57 | #if CONSOLE_DEBUGGING_COMMANDS_ACTIVATED||!(PREDATOR_DEMO||MARINE_DEMO||ALIEN_DEMO) 58 | if(InGameMenusAreRunning()) return;; 59 | 60 | iofocus_AcceptTyping = !iofocus_AcceptTyping; 61 | if (iofocus_AcceptTyping) 62 | { 63 | Sound_Play(SID_CONSOLE_ACTIVATES,NULL); 64 | } 65 | else 66 | { 67 | Sound_Play(SID_CONSOLE_DEACTIVATES,NULL); 68 | RemoveTheConsolePlease(); 69 | } 70 | #endif 71 | } 72 | 73 | 74 | /* Internal function definitions ***********************************/ 75 | 76 | }; 77 | -------------------------------------------------------------------------------- /src/avp/win95/iofocus.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | iofocus.h 4 | 5 | Created 21/11/97 by DHM: is input focus set to normal controls, 6 | or to typing? 7 | */ 8 | 9 | #ifndef _iofocus 10 | #define _iofocus 1 11 | 12 | #ifndef _ourbool 13 | #include "ourbool.h" 14 | #endif 15 | 16 | #ifndef _gadget 17 | #include "gadget.h" 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Version settings *****************************************************/ 25 | 26 | /* Constants ***********************************************************/ 27 | 28 | /* Macros ***************************************************************/ 29 | 30 | /* Type definitions *****************************************************/ 31 | 32 | /* Exported globals *****************************************************/ 33 | 34 | /* Function prototypes **************************************************/ 35 | #if UseGadgets 36 | extern OurBool IOFOCUS_AcceptControls(void); 37 | extern OurBool IOFOCUS_AcceptTyping(void); 38 | 39 | extern void IOFOCUS_Toggle(void); 40 | #else 41 | /* Otherwise: the functions collapse to macros: */ 42 | #define IOFOCUS_AcceptControls() (1) 43 | #define IOFOCUS_AcceptTyping() (0) 44 | 45 | #define IOFOCUS_Toggle() ((void) 0) 46 | #endif /* UseGadgets */ 47 | 48 | 49 | /* End of the header ****************************************************/ 50 | 51 | 52 | #ifdef __cplusplus 53 | }; 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/avp/win95/jsndsup.h: -------------------------------------------------------------------------------- 1 | #ifndef _jsndsup_h 2 | #define _jsndsup_h 1 3 | 4 | #include "3dc.h" 5 | #include "inline.h" 6 | #include "module.h" 7 | 8 | #ifdef __cplusplus 9 | 10 | extern "C" { 11 | 12 | #endif 13 | 14 | typedef struct loaded_sound 15 | { 16 | int sound_num; 17 | 18 | char * wavname; 19 | int num_attached; 20 | 21 | unsigned long permanent :1; 22 | 23 | } LOADED_SOUND; 24 | 25 | 26 | void LoseSound (LOADED_SOUND const * ls); 27 | LOADED_SOUND const * GetSound (char const * fname); 28 | 29 | #ifdef __cplusplus 30 | 31 | }; // end of extern "c" 32 | 33 | #endif 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/avp/win95/kzsort.h: -------------------------------------------------------------------------------- 1 | /* If this is set to a non-zero value then kzsort.c hijacks the pipeline */ 2 | #define KZSORT_ON 1 3 | 4 | /* maximum number of modules likely to appear on-screen */ 5 | #define MAX_NUMBER_OF_VISIBLE_MODULES 400 6 | 7 | struct KItem 8 | { 9 | POLYHEADER *PolyPtr; 10 | 11 | int SortKey; 12 | }; 13 | 14 | struct KObject 15 | { 16 | DISPLAYBLOCK *DispPtr; 17 | 18 | int SortKey; 19 | 20 | int DrawBeforeEnvironment; 21 | }; 22 | 23 | /* render with new z-sort */ 24 | extern void KRenderItems(VIEWDESCRIPTORBLOCK *VDBPtr); 25 | 26 | /* generic item shape function */ 27 | extern void KShapeItemsInstr(SHAPEINSTR *shapeinstrptr); 28 | extern void OutputKItem(int *shapeitemptr); 29 | 30 | extern void RenderThisDisplayblock(DISPLAYBLOCK *dbPtr); 31 | -------------------------------------------------------------------------------- /src/avp/win95/langplat.c: -------------------------------------------------------------------------------- 1 | #include "3dc.h" 2 | #include "inline.h" 3 | #include "language.h" 4 | /* KJL 12:07:26 05/02/97 - this will be buggered 5 | up if the enum in gamedef.h changes */ 6 | unsigned char *LanguageFilename[] = 7 | { 8 | ENGLISH_TEXT_FILENAME, /* I_English */ 9 | ENGLISH_TEXT_FILENAME, /* I_French */ 10 | ENGLISH_TEXT_FILENAME, /* I_Spanish */ 11 | ENGLISH_TEXT_FILENAME, /* I_German */ 12 | ENGLISH_TEXT_FILENAME, /* I_Italian */ 13 | ENGLISH_TEXT_FILENAME, /* I_Swedish */ 14 | }; 15 | -------------------------------------------------------------------------------- /src/avp/win95/modcmds.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | modcmds.hpp 4 | 5 | */ 6 | 7 | #ifndef _modcmds 8 | #define _modcmds 1 9 | 10 | #ifndef MODULE_INCLUDED 11 | #include "module.h" 12 | #endif 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* Version settings *****************************************************/ 19 | 20 | /* Constants ***********************************************************/ 21 | 22 | /* Macros ***************************************************************/ 23 | 24 | /* Type definitions *****************************************************/ 25 | 26 | /* Exported globals *****************************************************/ 27 | 28 | /* Function prototypes **************************************************/ 29 | namespace ModuleCommands 30 | { 31 | void ListModules(void); 32 | 33 | void TryToTeleport(char* UpperCasePotentialModuleName); 34 | 35 | MODULE* FindModule(char* UpperCasePotentialModuleName); 36 | // allowed to return NULL if no match 37 | 38 | void TeleportPlayerToModule(MODULE* pModule_Dst); 39 | }; 40 | 41 | 42 | 43 | /* End of the header ****************************************************/ 44 | 45 | 46 | #ifdef __cplusplus 47 | }; 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/avp/win95/npcsetup.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_npcsetup_h_ 2 | #define _included_npcsetup_h_ 3 | 4 | #include "chnkload.h" /* for RIFFHANDLE type */ 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* pass handle to environment rif */ 11 | void InitNPCs(RIFFHANDLE); 12 | 13 | /* unload them all after intance of game */ 14 | void EndNPCs(); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif /* ! _included_npcsetup_h_ */ 21 | -------------------------------------------------------------------------------- /src/avp/win95/objsetup.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _objsetup_hpp_ 2 | #define _objsetup_hpp_ 3 | 4 | #include "envchunk.hpp" 5 | #include "obchunk.hpp" 6 | 7 | extern "C" { 8 | #include "3dc.h" 9 | void SetUpRunTimeLights (); 10 | void create_strategies_from_list(); 11 | void deallocate_behaviour_list(); 12 | }; 13 | 14 | void deal_with_module_object(Object_Chunk * ob, int shape1, int AnimationShape, int shape2, MODULE * mod); 15 | void deal_with_placed_object(Object_Chunk * ob, int shape1, int AnimationShape); 16 | void setup_generators (Environment_Data_Chunk * envd); 17 | void setup_particle_generators (Environment_Data_Chunk * envd); 18 | void setup_cables (Environment_Data_Chunk * envd); 19 | void DealWithExternalObjectStategies (Environment_Data_Chunk * envd); 20 | void Create_Xenoborg_Morph_Jobby(Object_Chunk * ob, int AnimationShape, MODULE * mod, MORPHCTRL * mc); 21 | void setup_sounds (Environment_Data_Chunk * envd); 22 | #endif 23 | -------------------------------------------------------------------------------- /src/avp/win95/pathchnk.cpp: -------------------------------------------------------------------------------- 1 | #include "pathchnk.hpp" 2 | 3 | //macro for helping to force inclusion of chunks when using libraries 4 | FORCE_CHUNK_INCLUDE_IMPLEMENT(pathchnk) 5 | 6 | RIF_IMPLEMENT_DYNCREATE("AVPPATH2",AVP_Path_Chunk) 7 | 8 | AVP_Path_Chunk::AVP_Path_Chunk(Chunk_With_Children* parent) 9 | :Chunk(parent,"AVPPATH2") 10 | { 11 | PathLength=0; 12 | Path=0; 13 | PathID=0; 14 | PathName=0; 15 | flags=spare2=0; 16 | } 17 | 18 | AVP_Path_Chunk::AVP_Path_Chunk(Chunk_With_Children* parent,const char* data,size_t datasize) 19 | :Chunk(parent,"AVPPATH2") 20 | { 21 | int name_length=strlen(data); 22 | PathName=new char[name_length+1]; 23 | strcpy(PathName,data); 24 | data+=(name_length+4)&~3; 25 | 26 | PathID=*(int*)data; 27 | data+=4; 28 | flags=*(int*)data; 29 | data+=4; 30 | spare2=*(int*)data; 31 | data+=4; 32 | PathLength=*(int*)data; 33 | data+=4; 34 | 35 | if(PathLength) Path=new ChunkPathPoint[PathLength]; 36 | else Path=0; 37 | 38 | for(int i=0;i 9 | #include 10 | 11 | #define FILEMODE_READONLY 0x01 12 | #define FILEMODE_WRITEONLY 0x02 13 | #define FILEMODE_READWRITE 0x04 14 | #define FILEMODE_APPEND 0x08 15 | 16 | #define FILETYPE_PERM 0x10 17 | #define FILETYPE_OPTIONAL 0x20 18 | #define FILETYPE_CONFIG 0x40 19 | 20 | #define FILEATTR_DIRECTORY 0x0100 21 | #define FILEATTR_READABLE 0x0200 22 | #define FILEATTR_WRITABLE 0x0400 23 | 24 | typedef struct GameDirectoryFile 25 | { 26 | char *filename; 27 | int attr; 28 | time_t timestamp; 29 | } GameDirectoryFile; 30 | 31 | int SetGameDirectories(const char *local, const char *global); 32 | FILE *OpenGameFile(const char *filename, int mode, int type); 33 | int CloseGameFile(FILE *pfd); 34 | int GetGameFileAttributes(const char *filename, int type); 35 | int DeleteGameFile(const char *filename); 36 | int CreateGameDirectory(const char *dirname); 37 | void *OpenGameDirectory(const char *dirname, const char *pattern, int type); 38 | GameDirectoryFile *ScanGameDirectory(void *dir); 39 | int CloseGameDirectory(void *dir); 40 | void InitGameDirectories(char *argv0); 41 | 42 | #ifdef __cplusplus 43 | }; 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/fmv.h: -------------------------------------------------------------------------------- 1 | #ifndef FMV_H 2 | #define FMV_H 3 | 4 | typedef struct 5 | { 6 | IMAGEHEADER *ImagePtr; 7 | int SoundVolume; 8 | int IsTriggeredPlotFMV; 9 | int StaticImageDrawn; 10 | 11 | int MessageNumber; 12 | 13 | // disabled direct3d stuff 14 | //LPDIRECTDRAWSURFACE SrcSurface; 15 | //LPDIRECT3DTEXTURE SrcTexture; 16 | //LPDIRECT3DTEXTURE DestTexture; 17 | PALETTEENTRY SrcPalette[256]; 18 | 19 | // buffer used for opengl texture uploads 20 | unsigned char* PalettedBuf; 21 | unsigned char* RGBBuf; 22 | 23 | int RedScale; 24 | int GreenScale; 25 | int BlueScale; 26 | 27 | } FMVTEXTURE; 28 | 29 | 30 | extern int NextFMVTextureFrame(FMVTEXTURE *ftPtr, void *bufferPtr); 31 | extern void UpdateFMVTexturePalette(FMVTEXTURE *ftPtr); 32 | extern void InitialiseTriggeredFMVs(void); 33 | extern void StartTriggerPlotFMV(int number); 34 | 35 | extern void StartFMVAtFrame(int number, int frame); 36 | extern void GetFMVInformation(int *messageNumberPtr, int *frameNumberPtr); 37 | 38 | void UpdateAllFMVTextures(void); 39 | void ScanImagesForFMVs(void); 40 | void ReleaseAllFMVTextures(void); 41 | 42 | //void PlayBinkedFMV(char *filenamePtr); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/frustum.h: -------------------------------------------------------------------------------- 1 | #ifndef _frustrum_h_ /* Is this your first time? */ 2 | #define _frustrum_h_ 1 3 | 4 | #include "kshape.h" 5 | /* 6 | * KJL 15:13:43 7/17/97 - frustrum.h 7 | * 8 | * function prototypes & pointers for things connected 9 | * to the view frustrum and clipping 10 | * 11 | */ 12 | 13 | enum FrustrumType 14 | { 15 | FRUSTRUM_TYPE_NORMAL, 16 | FRUSTRUM_TYPE_WIDE 17 | }; 18 | 19 | extern void SetFrustrumType(enum FrustrumType frustrumType); 20 | 21 | /* GOURAUD POLYGON CLIPPING */ 22 | extern void GouraudPolygon_ClipWithZ(void); 23 | extern void (*GouraudPolygon_ClipWithNegativeX)(void); 24 | extern void (*GouraudPolygon_ClipWithPositiveY)(void); 25 | extern void (*GouraudPolygon_ClipWithNegativeY)(void); 26 | extern void (*GouraudPolygon_ClipWithPositiveX)(void); 27 | 28 | /* TEXTURED POLYGON CLIPPING */ 29 | extern void TexturedPolygon_ClipWithZ(void); 30 | extern void (*TexturedPolygon_ClipWithNegativeX)(void); 31 | extern void (*TexturedPolygon_ClipWithPositiveY)(void); 32 | extern void (*TexturedPolygon_ClipWithNegativeY)(void); 33 | extern void (*TexturedPolygon_ClipWithPositiveX)(void); 34 | 35 | /* GOURAUD TEXTURED POLYGON CLIPPING */ 36 | extern void GouraudTexturedPolygon_ClipWithZ(void); 37 | extern void (*GouraudTexturedPolygon_ClipWithNegativeX)(void); 38 | extern void (*GouraudTexturedPolygon_ClipWithPositiveY)(void); 39 | extern void (*GouraudTexturedPolygon_ClipWithNegativeY)(void); 40 | extern void (*GouraudTexturedPolygon_ClipWithPositiveX)(void); 41 | 42 | /* FRUSTRUM TESTS */ 43 | extern int PolygonWithinFrustrum(POLYHEADER *polyPtr); 44 | extern int PolygonShouldBeDrawn(POLYHEADER *polyPtr); 45 | extern int (*ObjectWithinFrustrum)(DISPLAYBLOCK *dbPtr); 46 | extern int (*ObjectCompletelyWithinFrustrum)(DISPLAYBLOCK *dbPtr); 47 | extern int (*VertexWithinFrustrum)(RENDERVERTEX *vertexPtr); 48 | extern void (*TestVerticesWithFrustrum)(void); 49 | 50 | extern int DecalWithinFrustrum(DECAL *decalPtr); 51 | extern int QuadWithinFrustrum(void); 52 | extern int TriangleWithinFrustrum(void); 53 | 54 | 55 | /* pass a pointer to a vertex to be tested; results are returned in an int, 56 | using the following defines */ 57 | #define INSIDE_FRUSTRUM_Z_PLANE 1 58 | #define INSIDE_FRUSTRUM_PX_PLANE 2 59 | #define INSIDE_FRUSTRUM_NX_PLANE 4 60 | #define INSIDE_FRUSTRUM_PY_PLANE 8 61 | #define INSIDE_FRUSTRUM_NY_PLANE 16 62 | #define INSIDE_FRUSTRUM 31 63 | 64 | extern char FrustrumFlagForVertex[maxrotpts]; 65 | 66 | #define USE_FOV_53 0 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/include/3dc.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "system.h" 6 | #include "equates.h" 7 | #include "platform.h" 8 | #include "shape.h" 9 | #include "prototyp.h" 10 | -------------------------------------------------------------------------------- /src/mathline.h: -------------------------------------------------------------------------------- 1 | #ifndef MATHLINE_H 2 | #define MATHLINE_H 3 | 4 | #include 5 | 6 | #define f2i(a, b) a = lrintf(b) 7 | 8 | /* 9 | 10 | Fixed Point Multiply. 11 | 12 | 13 | 16.16 * 16.16 -> 16.16 14 | or 15 | 16.16 * 0.32 -> 0.32 16 | 17 | A proper version of this function ought to read 18 | 16.16 * 16.16 -> 32.16 19 | but this would require a __int64 result 20 | 21 | Algorithm: 22 | 23 | Take the mid 32 bits of the 64 bit result 24 | 25 | */ 26 | 27 | /* 28 | These functions have been checked for suitability for 29 | a Pentium and look as if they would work adequately. 30 | Might be worth a more detailed look at optimising 31 | them though. 32 | */ 33 | 34 | static __inline int MUL_FIXED(int a, int b) 35 | { 36 | /* 37 | int retval; 38 | _asm 39 | { 40 | mov eax,a 41 | imul b 42 | shrd eax,edx,16 43 | mov retval,eax 44 | } 45 | */ 46 | 47 | #if defined(ASM386) 48 | int retval; 49 | __asm__("imull %2 \n\t" 50 | "shrdl $16, %%edx, %%eax \n\t" 51 | : "=a" (retval) 52 | : "0" (a), "m" (b) 53 | : "%edx", "cc" 54 | ); 55 | return retval; 56 | #else 57 | __int64 aa = (__int64) a; 58 | __int64 bb = (__int64) b; 59 | 60 | __int64 cc = aa * bb; 61 | 62 | return (int) ((cc >> 16) & 0xffffffff); 63 | #endif 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/maths.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neuromancer/avp/2d5774781dd2ed959a83b2a98ab6f3f26e1dcc51/src/maths.c -------------------------------------------------------------------------------- /src/maths.h: -------------------------------------------------------------------------------- 1 | #ifndef MATHS_H 2 | #define MATHS_H 3 | 4 | void SetSeededFastRandom(int seed); 5 | int SeededFastRandom(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is the header file for the MD5 message-digest algorithm. 3 | * The algorithm is due to Ron Rivest. This code was 4 | * written by Colin Plumb in 1993, no copyright is claimed. 5 | * This code is in the public domain; do with it what you wish. 6 | * 7 | * Equivalent code is available from RSA Data Security, Inc. 8 | * This code has been tested against that, and is equivalent, 9 | * except that you don't need to include two pages of legalese 10 | * with every copy. 11 | * 12 | * To compute the message digest of a chunk of bytes, declare an 13 | * MD5Context structure, pass it to MD5Init, call MD5Update as 14 | * needed on buffers full of bytes, and then call MD5Final, which 15 | * will fill a supplied 16-byte array with the digest. 16 | * 17 | * Changed so as no longer to depend on Colin Plumb's `usual.h' 18 | * header definitions; now uses stuff from dpkg's config.h 19 | * - Ian Jackson . 20 | * Still in the public domain. 21 | * 22 | * md5_buffer added by Steven Fuller 23 | * Still in the public domain. 24 | */ 25 | 26 | #ifndef MD5_H 27 | #define MD5_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | typedef unsigned int UWORD32; 34 | 35 | #define md5byte unsigned char 36 | 37 | struct MD5Context { 38 | UWORD32 buf[4]; 39 | UWORD32 bytes[2]; 40 | UWORD32 in[16]; 41 | }; 42 | 43 | void MD5Init(struct MD5Context *context); 44 | void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len); 45 | void MD5Final(unsigned char digest[16], struct MD5Context *context); 46 | void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]); 47 | 48 | /* md5_buffer frontend added for AvP */ 49 | void md5_buffer(char const *buffer, unsigned int len, char *digest); 50 | 51 | #ifdef __cplusplus 52 | }; 53 | #endif 54 | 55 | #endif /* !MD5_H */ 56 | -------------------------------------------------------------------------------- /src/mem3dcpp.cpp: -------------------------------------------------------------------------------- 1 | #include "mem3dc.h" 2 | 3 | #if DBGMALLOC 4 | 5 | #if 1 6 | 7 | // try and turn C++ new/delete tracking on such that 8 | // we can do a malloc dump when the global objects 9 | // with associated memory allocated is recored, the 10 | // deallocation is recored, and then a malloc dump 11 | // is done 12 | 13 | // note that some global objects wont have their memory 14 | // allocations/deallocations in the constructor/destructor 15 | // tracked through record_malloc/record_free, but since 16 | // global objects are deconstructed in the reverse order 17 | // from construction, the deallocation type in the destructor 18 | // will correspond to the allocation type in the constructor 19 | 20 | int __cpp_new_recording = 0; 21 | 22 | class DebugObject 23 | { 24 | public: 25 | DebugObject(); 26 | ~DebugObject(); 27 | }; 28 | 29 | DebugObject::DebugObject() 30 | { 31 | __cpp_new_recording = 1; 32 | } 33 | 34 | DebugObject::~DebugObject() 35 | { 36 | __cpp_new_recording = 0; 37 | DumpMallocInfo(DUMPTOFILE); 38 | } 39 | 40 | static DebugObject dbo; 41 | 42 | #else 43 | 44 | int __cpp_new_recording = 1; 45 | 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/net.h: -------------------------------------------------------------------------------- 1 | #ifndef AVP_NET_H 2 | #define AVP_NET_H 3 | 4 | BOOL DpExtInit(DWORD cGrntdBufs, DWORD cBytesPerBuf, BOOL bErrChcks); 5 | HRESULT DpExtRecv(int lpDP2A, void *lpidFrom, void *lpidTo, DWORD dwFlags, void *lplpData, LPDWORD lpdwDataSize); 6 | HRESULT DpExtSend(int lpDP2A, DPID idFrom, DPID idTo, DWORD dwFlags, void *lpData, DWORD dwDataSize); 7 | void DpExtUnInit(); 8 | int DirectPlay_Disconnect(); 9 | HRESULT IDirectPlayX_GetPlayerName(int glpDP, DPID id, void *data, void *size); 10 | int DirectPlay_ConnectingToSession(); 11 | int DirectPlay_ConnectingToLobbiedGame(char* playerName); 12 | void DirectPlay_EnumConnections(); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/opengl.h: -------------------------------------------------------------------------------- 1 | #ifndef AVP_OPENGL_H 2 | #define AVP_OPENGL_H 3 | 4 | #include "kshape.h" 5 | 6 | 7 | #define OPENGL_VERTEX_ATTRIB_INDEX 0 8 | #define OPENGL_TEXCOORD_ATTRIB_INDEX 1 9 | #define OPENGL_COLOR0_ATTRIB_INDEX 2 10 | #define OPENGL_COLOR1_ATTRIB_INDEX 3 11 | 12 | #define OPENGL_VERTEX_ATTRIB_BITINDEX (1 << OPENGL_VERTEX_ATTRIB_INDEX) 13 | #define OPENGL_TEXCOORD_ATTRIB_BITINDEX (1 << OPENGL_TEXCOORD_ATTRIB_INDEX) 14 | #define OPENGL_COLOR0_ATTRIB_BITINDEX (1 << OPENGL_COLOR0_ATTRIB_INDEX) 15 | #define OPENGL_COLOR1_ATTRIB_BITINDEX (1 << OPENGL_COLOR1_ATTRIB_INDEX) 16 | 17 | enum AVP_SHADER_PROGRAM { 18 | AVP_SHADER_PROGRAM_DEFAULT, 19 | AVP_SHADER_PROGRAM_NO_SECONDARY, 20 | AVP_SHADER_PROGRAM_NO_TEXTURE, 21 | AVP_SHADER_PROGRAM_NO_DISCARD, 22 | AVP_SHADER_PROGRAM_NO_SECONDARY_NO_DISCARD, 23 | AVP_SHADER_PROGRAM_NO_COLOR_NO_DISCARD, 24 | AVP_SHADER_PROGRAM_MAX 25 | }; 26 | 27 | void SelectProgram(enum AVP_SHADER_PROGRAM program); 28 | void DrawFullscreenTexture(int texureObject); 29 | 30 | void InitOpenGL(int firsttime); 31 | void ThisFramesRenderingHasBegun(); 32 | void ThisFramesRenderingHasFinished(); 33 | void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr); 34 | void D3D_DrawBackdrop(); 35 | void D3D_FadeDownScreen(int brightness, int colour); 36 | void RenderString(char *stringPtr, int x, int y, int colour); 37 | void RenderStringCentred(char *stringPtr, int centreX, int y, int colour); 38 | void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colour); 39 | void D3D_DecalSystem_Setup(); 40 | void D3D_DecalSystem_End(); 41 | void SecondFlushD3DZBuffer(); 42 | void D3D_PlayerDamagedOverlay(int intensity); 43 | void D3D_PredatorScreenInversionOverlay(); 44 | void D3D_ScreenInversionOverlay(); 45 | void D3D_DrawColourBar(int yTop, int yBottom, int rScale, int gScale, int bScale); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/sdl12/SDLMain.h: -------------------------------------------------------------------------------- 1 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app 2 | Initial Version: Darrell Walisser 3 | Non-NIB-Code & other changes: Max Horn 4 | 5 | Feel free to customize this file to suit your needs 6 | */ 7 | 8 | #ifndef _SDLMain_h_ 9 | #define _SDLMain_h_ 10 | 11 | #import 12 | 13 | @interface SDLMain : NSObject 14 | @end 15 | 16 | #endif /* _SDLMain_h_ */ 17 | -------------------------------------------------------------------------------- /src/sphere.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_sphere_h_ /* Is this your first time? */ 2 | #define _included_sphere_h_ 1 3 | 4 | 5 | typedef struct 6 | { 7 | int v[3]; 8 | } TRI_FACE; 9 | 10 | #define SPHERE_ORDER 6 11 | #define SPHERE_RADIUS ONE_FIXED 12 | #define SPHERE_FACES (8*SPHERE_ORDER*SPHERE_ORDER) 13 | #define SPHERE_VERTICES (4*SPHERE_ORDER*SPHERE_ORDER+2) 14 | #define SPHERE_TEXTURE_WRAP 4 15 | extern VECTORCH SphereVertex[]; 16 | extern VECTORCH SphereRotatedVertex[]; 17 | extern VECTORCH SphereAtmosRotatedVertex[]; 18 | extern int SphereAtmosU[]; 19 | extern int SphereAtmosV[]; 20 | extern TRI_FACE SphereFace[]; 21 | extern int SphereVertexHeight[]; 22 | 23 | typedef struct 24 | { 25 | VECTORCH Position[SPHERE_VERTICES]; 26 | VECTORCH Velocity[SPHERE_VERTICES]; 27 | int RipplePhase[SPHERE_VERTICES]; 28 | int BeenStopped[SPHERE_VERTICES]; 29 | 30 | int ExplosionPhase; 31 | int NumberVerticesMoving; 32 | int LifeTime; 33 | int UseCollisions; 34 | 35 | } VOLUMETRIC_EXPLOSION; 36 | 37 | extern void Generate_Sphere(void); 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/unaligned.h: -------------------------------------------------------------------------------- 1 | #ifndef UNALIGNED_H 2 | #define UNALIGNED_H 3 | 4 | // Anything using these types is not alignment and endian clean. 5 | 6 | #if EMSCRIPTEN 7 | #include 8 | 9 | typedef emscripten_align1_short unaligned_s16; 10 | typedef emscripten_align1_int unaligned_s32; 11 | typedef emscripten_align1_short unaligned_u16; 12 | typedef emscripten_align1_int unaligned_u32; 13 | typedef emscripten_align1_float unaligned_f32; 14 | typedef emscripten_align1_double unaligned_f64; 15 | 16 | #else 17 | 18 | #include 19 | 20 | typedef int16_t unaligned_s16; 21 | typedef int32_t unaligned_s32; 22 | typedef uint16_t unaligned_u16; 23 | typedef uint32_t unaligned_u32; 24 | typedef float unaligned_f32; 25 | typedef double unaligned_f64; 26 | 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/version.c: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | extern void NewOnScreenMessage(unsigned char *messagePtr); 4 | 5 | const char *AvPVersionString = "Aliens vs Predator Linux \n Build 000 (CVS) \n Based on Rebellion Developments AvP Gold source \n"; 6 | 7 | void GiveVersionDetails(void) 8 | { 9 | NewOnScreenMessage((unsigned char *)AvPVersionString); 10 | } 11 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #ifndef __VERSION_H__ 2 | #define __VERSION_H__ 3 | 4 | extern const char *AvPVersionString; 5 | 6 | /* KJL 15:56:24 29/03/98 - this function supplies a text 7 | description of the current build, and the build date. */ 8 | extern void GiveVersionDetails(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/win95/alt_tab.h: -------------------------------------------------------------------------------- 1 | /* 2 | JH - 18/02/98 3 | Deal with lost surfaces and textures - restore them when the application is re-activated 4 | */ 5 | 6 | #ifndef _INCLUDED_ALT_TAB_H_ 7 | #define _INCLUDED_ALT_TAB_H_ 8 | 9 | #include "aw.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef void (* AT_PFN_RESTORETEXTURE) (D3DTexture * pTexture, void * pUser); 16 | typedef void (* AT_PFN_RESTORESURFACE) (DDSurface * pSurface, void * pUser); 17 | 18 | #ifdef NDEBUG 19 | extern void ATIncludeTexture(D3DTexture * pTexture, AW_BACKUPTEXTUREHANDLE hBackup); 20 | extern void ATIncludeTextureEx(D3DTexture * pTexture, AT_PFN_RESTORETEXTURE pfnRestore, void * pUser); 21 | extern void ATIncludeSurface(DDSurface * pSurface, AW_BACKUPTEXTUREHANDLE hBackup); 22 | extern void ATIncludeSurfaceEx(DDSurface * pSurface, AT_PFN_RESTORESURFACE pfnRestore, void * pUser); 23 | #else 24 | extern void _ATIncludeTexture(D3DTexture * pTexture, AW_BACKUPTEXTUREHANDLE hBackup, char const * pszFile, unsigned nLine, char const * pszDebugString); 25 | extern void _ATIncludeTextureEx(D3DTexture * pTexture, AT_PFN_RESTORETEXTURE pfnRestore, void * pUser, char const * pszFile, unsigned nLine, char const * pszFuncName, char const * pszDebugString); 26 | extern void _ATIncludeSurface(DDSurface * pSurface, AW_BACKUPTEXTUREHANDLE hBackup, char const * pszFile, unsigned nLine, char const * pszDebugString); 27 | extern void _ATIncludeSurfaceEx(DDSurface * pSurface, AT_PFN_RESTORESURFACE pfnRestore, void * pUser, char const * pszFile, unsigned nLine, char const * pszFuncName, char const * pszDebugString); 28 | #define ATIncludeTexture(p,h) _ATIncludeTexture(p,h,__FILE__,__LINE__,NULL) 29 | #define ATIncludeTextureEx(p,f,u) _ATIncludeTextureEx(p,f,u,__FILE__,__LINE__,#f ,NULL) 30 | #define ATIncludeSurface(p,h) _ATIncludeSurface(p,h,__FILE__,__LINE__,NULL) 31 | #define ATIncludeSurfaceEx(p,f,u) _ATIncludeSurfaceEx(p,f,u,__FILE__,__LINE__,#f ,NULL) 32 | #define ATIncludeTextureDb(p,h,d) _ATIncludeTexture(p,h,__FILE__,__LINE__,d) 33 | #define ATIncludeTextureExDb(p,f,u,d) _ATIncludeTextureEx(p,f,u,__FILE__,__LINE__,#f ,d) 34 | #define ATIncludeSurfaceDb(p,h,d) _ATIncludeSurface(p,h,__FILE__,__LINE__,d) 35 | #define ATIncludeSurfaceExDb(p,f,u,d) _ATIncludeSurfaceEx(p,f,u,__FILE__,__LINE__,#f ,d) 36 | #endif 37 | 38 | extern void ATRemoveTexture(D3DTexture * pTexture); 39 | extern void ATRemoveSurface(DDSurface * pSurface); 40 | 41 | extern void ATOnAppReactivate(); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* ! _INCLUDED_ALT_TAB_H_ */ 48 | -------------------------------------------------------------------------------- /src/win95/animchnk.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _animchnk_hpp 2 | #define _animchnk_hpp 3 | #include "chunk.hpp" 4 | #include "chnktype.hpp" 5 | 6 | struct TEXANIM; 7 | 8 | 9 | class Animation_Chunk : public Chunk 10 | { 11 | public : 12 | Animation_Chunk(Chunk_With_Children* parent,const char*,size_t); 13 | Animation_Chunk(Chunk_With_Children* parent); 14 | ~Animation_Chunk(); 15 | 16 | virtual BOOL output_chunk (HANDLE &hand); 17 | 18 | virtual size_t size_chunk(); 19 | 20 | virtual void fill_data_block(char* data_start); 21 | 22 | int NumPolys; //with animation in this shape 23 | TEXANIM** AnimList; 24 | 25 | }; 26 | 27 | #define txa_flag_nointerptofirst 0x80000000 28 | 29 | struct FrameList 30 | { 31 | ~FrameList(); 32 | FrameList(TEXANIM*); 33 | FrameList(TEXANIM* p,FrameList* fl,int* conv); 34 | int Speed; 35 | int Flags; 36 | 37 | int NumFrames; 38 | int CurFrame; 39 | TEXANIM* parent; 40 | 41 | int* Textures; 42 | int* UVCoords; 43 | int spare1,spare2; 44 | }; 45 | 46 | #define AnimFlag_NotPlaying 0x00000001 47 | struct TEXANIM 48 | { 49 | TEXANIM(TEXANIM*); 50 | TEXANIM(); 51 | ~TEXANIM(); 52 | 53 | int shape; 54 | int poly; 55 | int NumVerts; 56 | int ID; 57 | int NumSeq;//number of sequences 58 | int CurSeq; 59 | int AnimFlags; 60 | int Identifier; 61 | FrameList** Seq; 62 | 63 | void CopyAnimData(TEXANIM* ta,int* conv); 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/win95/aw.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDED_AW_H_ 2 | #define _INCLUDED_AW_H_ 3 | 4 | struct AwBackupTexture; 5 | typedef struct AwBackupTexture * AW_BACKUPTEXTUREHANDLE; 6 | 7 | // fake type used by opengl.c 8 | typedef struct DIRECTDRAWSURFACE 9 | { 10 | unsigned char *buf; 11 | int id; 12 | 13 | unsigned int w; 14 | unsigned int h; 15 | 16 | unsigned int IsNpot; 17 | unsigned int TexWidth; 18 | unsigned int TexHeight; 19 | float RecipW; 20 | float RecipH; 21 | 22 | int hasAlpha; 23 | int hasChroma; 24 | 25 | int filter; 26 | } DIRECTDRAWSURFACE; 27 | 28 | typedef DIRECTDRAWSURFACE * LPDIRECTDRAWSURFACE; 29 | typedef DIRECTDRAWSURFACE DDSurface; 30 | 31 | typedef DIRECTDRAWSURFACE DIRECT3DTEXTURE; 32 | typedef DIRECT3DTEXTURE * LPDIRECT3DTEXTURE; 33 | typedef DIRECT3DTEXTURE D3DTexture; 34 | 35 | typedef int D3DTEXTUREHANDLE; 36 | 37 | #endif /* _INCLUDED_AW_H_ */ 38 | -------------------------------------------------------------------------------- /src/win95/chnktexi.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDED_CHNKTEXI_H_ 2 | #define _INCLUDED_CHNKTEXI_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif /* __cplusplus */ 7 | 8 | /* image number for already loaded image - really an internal function */ 9 | #define GEI_NOTLOADED (-1) 10 | extern int GetExistingImageNum(char const * pszActualFileName); 11 | 12 | enum /* flags, etc */ 13 | { 14 | /* destination surface type */ 15 | LIO_CHIMAGE = 0x00000000U, /* Chris Humphries texture */ 16 | LIO_DDSURFACE = 0x00000001U, /* Direct Draw Surface */ 17 | LIO_D3DTEXTURE = 0x00000002U, /* Direct 3D Texture */ 18 | _LIO_SURFTYPEMASK= 0x00000003U, 19 | /* target memory type for DDSURFACE only - D3DTextures dest depends on driver */ 20 | LIO_SYSMEM = 0x00000000U, /* system memory */ 21 | LIO_VIDMEM = 0x00000004U, /* video memory */ 22 | /* transparency flags - unless specified in the file */ 23 | LIO_NONTRANSP = 0x00000000U, /* no transparency */ 24 | LIO_TRANSPARENT = 0x00000008U, /* has transparency */ 25 | /* alpha or chroma key? */ 26 | LIO_USEALPHA = 0x00000000U, /* use alpha mask if available instead of chroma keying */ 27 | LIO_CHROMAKEY = 0x00000010U, /* use chroma key even if surface has alpha channel */ 28 | /* path flags */ 29 | LIO_ABSOLUTEPATH = 0x00000000U, /* path is correct */ 30 | LIO_RELATIVEPATH = 0x00000020U, /* path is relative to a textures directory */ 31 | LIO_RIFFPATH = 0x00000040U, /* current RIF file used to build path and extension */ 32 | _LIO_PATHTYPEMASK= 0x00000060U, 33 | /* mip maps? */ 34 | LIO_NOMIPMAPS = 0x00000000U, /* no mip maps */ 35 | LIO_LOADMIPMAPS = 0x00000080U, /* load mip maps if available */ 36 | /* restorable ? */ 37 | LIO_NORESTORE = 0x00000000U, /* not going to be restorable */ 38 | LIO_RESTORABLE = 0x00000100U, /* put something in imageheader to allow restoring */ 39 | }; 40 | 41 | /* CL_LoadImageOnce relies on this value to be 1 greater 42 | than the index of the last loaded image */ 43 | extern int NumImages; 44 | 45 | /* directories used with the LIO_RIFFPATH flag */ 46 | extern char const * GameTex_Directory; 47 | extern char const * SubShps_Directory; 48 | extern char const * GenTex_Directory; 49 | extern char const * FixTex_Directory; 50 | extern char const * ToolsTex_Directory; 51 | 52 | /* game mode for use with the above */ 53 | extern char const * cl_pszGameMode; 54 | 55 | /* directories used with the LIO_RELATIVEPATH flag 56 | these are searched in order*/ 57 | extern char const * FirstTex_Directory; 58 | extern char const * SecondTex_Directory; 59 | 60 | /* returns GEI_NOTLOADED on failure */ 61 | extern int CL_LoadImageOnce(char const * pszFileName, unsigned fFlagsEtc); 62 | 63 | /* returns NULL on failure, or pointer to pszDestBuf on success, nBufSize includes nul terminator */ 64 | extern char * CL_GetImageFileName(char * pszDestBuf, unsigned nBufSize, char const * pszFileName, unsigned fFlagsEtc); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif /* __cplusplus */ 69 | 70 | #endif /* !_INCLUDED_CHNKTEXI_H_ */ 71 | -------------------------------------------------------------------------------- /src/win95/debuglog.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "debuglog.hpp" 4 | 5 | LogFile::LogFile(char const * const _fname) : fname(0) , ever_written(0) 6 | { 7 | FILE * fp = fopen(_fname,"w"); 8 | if (fp) 9 | { 10 | fclose(fp); 11 | fname = new char[strlen(_fname)+1]; 12 | strcpy(fname,_fname); 13 | return; 14 | } 15 | char const * path = getenv("TEMP"); 16 | if (!path) path = getenv("TMP"); 17 | if (!path) return; 18 | fname = new char[strlen(path)+1+strlen(_fname)+1]; 19 | strcpy(fname,path); 20 | strncat(fname,"\\",1); 21 | strcat(fname,_fname); 22 | fp = fopen(fname,"w"); 23 | if (fp) 24 | fclose(fp); 25 | else 26 | { 27 | delete[] fname; 28 | fname = 0; 29 | } 30 | } 31 | 32 | LogFile::~LogFile() 33 | { 34 | if (unwritten.size()) 35 | { 36 | FILE * fp = fopen(fname,"a"); 37 | for (int attempt=0; !fp && attempt<10; ++attempt) 38 | { 39 | /* Sleep(100); */ 40 | fp = fopen(fname,"a"); 41 | } 42 | if (fp) 43 | { 44 | FlushOut(fp); 45 | fclose(fp); 46 | } 47 | } 48 | if (fname) delete[] fname; 49 | } 50 | 51 | LogFile & LogFile::operator = (LogFile const & l) 52 | { 53 | if (&l != this) 54 | { 55 | if (fname) delete[] fname; 56 | if (l.fname) 57 | { 58 | fname = new char[strlen(l.fname)+1]; 59 | strcpy(fname,l.fname); 60 | } 61 | else 62 | fname = 0; 63 | 64 | unwritten = l.unwritten; 65 | ever_written = l.ever_written; 66 | } 67 | return *this; 68 | } 69 | 70 | LogFile::LogFile(LogFile const & l) 71 | : unwritten(l.unwritten) 72 | , ever_written(l.ever_written) 73 | { 74 | if (l.fname) 75 | { 76 | fname = new char[strlen(l.fname)+1]; 77 | strcpy(fname,l.fname); 78 | } 79 | else 80 | fname = 0; 81 | } 82 | 83 | void LogFile::FlushOut(FILE * fp) 84 | { 85 | while (unwritten.size()) 86 | { 87 | char * str = unwritten.first_entry(); 88 | unwritten.delete_first_entry(); 89 | fputs(str,fp); 90 | delete[] str; 91 | } 92 | } 93 | 94 | int vlfprintf(LOGFILE * lfp, char const * format, va_list args ) 95 | { 96 | return lfp->vlprintf(format,args); 97 | } 98 | 99 | int lfprintf(LOGFILE * lfp, char const * format, ... ) 100 | { 101 | va_list ap; 102 | va_start(ap, format); 103 | int rv = lfp->vlprintf(format,ap); 104 | va_end(ap); 105 | return rv; 106 | } 107 | 108 | int lfputs(LOGFILE * lfp, char const * str) 109 | { 110 | return lfp->lputs(str); 111 | } 112 | 113 | LOGFILE * lfopen(char const * fname) 114 | { 115 | return new LogFile(fname); 116 | } 117 | 118 | void lfclose(LOGFILE * lfp) 119 | { 120 | delete lfp; 121 | } 122 | -------------------------------------------------------------------------------- /src/win95/debuglog.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_debuglog_h_ 2 | #define _included_debuglog_h_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | typedef struct LogFile LOGFILE; 11 | 12 | int vlfprintf(LOGFILE * lfp, char const * format, va_list args ); 13 | 14 | int lfprintf(LOGFILE * lfp, char const * format, ... ); 15 | 16 | int lfputs(LOGFILE * lfp, char const * str); 17 | 18 | LOGFILE * lfopen(char const * fname); 19 | 20 | void lfclose(LOGFILE * lfp); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* ! _included_debuglog_h_ */ 27 | -------------------------------------------------------------------------------- /src/win95/dummyobjectchunk.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DummyObjectChunk_hpp 3 | #define _DummyObjectChunk_hpp 1 4 | 5 | #include "chunk.hpp" 6 | #include "list_tem.hpp" 7 | #include "chnktype.hpp" 8 | 9 | class Dummy_Object_Data_Chunk; 10 | 11 | class Dummy_Object_Chunk : public Chunk_With_Children 12 | { 13 | public: 14 | 15 | Dummy_Object_Chunk(Chunk_With_Children* parent,const char* _name ,ChunkVectorInt& _location,ChunkVectorInt& min ,ChunkVectorInt& max ,ChunkQuat& orient); 16 | 17 | // constructor from buffer 18 | Dummy_Object_Chunk (Chunk_With_Children * const parent,const char *, size_t const); 19 | 20 | Dummy_Object_Data_Chunk * get_data_chunk();//gets data chunk (name and location) 21 | 22 | const char* get_text(); //get text attached to a dummy object 23 | void set_text(const char* text); //change the text attached to a dummy object 24 | 25 | }; 26 | 27 | //chunk containing name and location of dummy object 28 | class Dummy_Object_Data_Chunk : public Chunk 29 | { 30 | public : 31 | Dummy_Object_Data_Chunk(Dummy_Object_Chunk* parent,const char* _name ,ChunkVectorInt& _location,ChunkVectorInt& min ,ChunkVectorInt& max ,ChunkQuat& orient); 32 | Dummy_Object_Data_Chunk (Chunk_With_Children * parent, const char * data, size_t ); 33 | ~Dummy_Object_Data_Chunk(); 34 | 35 | 36 | /*------------------------** 37 | ** Main dummy object data ** 38 | **------------------------*/ 39 | char* name; 40 | 41 | ChunkVectorInt location; 42 | ChunkQuat orientation; 43 | 44 | ChunkVectorInt min_extents; 45 | ChunkVectorInt max_extents; 46 | /*------------------------** 47 | ** Main dummy object data ** 48 | **------------------------*/ 49 | 50 | size_t size_chunk(); 51 | void fill_data_block (char * data); 52 | 53 | private : 54 | 55 | friend class Dummy_Object_Chunk; 56 | 57 | }; 58 | 59 | 60 | //contains the 'user text' from 3dsmax 61 | class Dummy_Object_Text_Chunk : public Chunk 62 | { 63 | public : 64 | Dummy_Object_Text_Chunk(Dummy_Object_Chunk* parent,const char* _text); 65 | Dummy_Object_Text_Chunk(Chunk_With_Children * parent, const char * data, size_t ); 66 | ~Dummy_Object_Text_Chunk(); 67 | 68 | size_t size_chunk(); 69 | void fill_data_block (char * data); 70 | 71 | 72 | const char* get_text() {return text;} 73 | void set_text(const char* _text); 74 | 75 | private : 76 | char* text; 77 | 78 | }; 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/win95/dxlog.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_dxlog_h_ 2 | #define _included_dxlog_h_ 3 | 4 | #include "system.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #if debug 11 | 12 | void dx_err_log(int error, int line, char const * file); 13 | void dx_str_log(char const * str, int line, char const * file); 14 | void dx_line_log(int line, char const * file); 15 | void dx_strf_log(char const * fmt, ...); 16 | 17 | #define LOGDXERR(error) dx_err_log(error,__LINE__,__FILE__) 18 | #define LOGDXSTR(str) dx_str_log(str,__LINE__,__FILE__) 19 | #define LOGDXFMT(args) (dx_line_log(__LINE__,__FILE__),dx_strf_log args) 20 | 21 | #else 22 | 23 | /* TODO: make these static inline to hush the compiler */ 24 | void dx_err_log(int error, int line, char const * file); 25 | void dx_str_log(char const * str, int line, char const * file); 26 | void dx_line_log(int line, char const * file); 27 | void dx_strf_log(char const * fmt, ...); 28 | 29 | #define LOGDXERR(error) dx_err_log(error,__LINE__,__FILE__) 30 | #define LOGDXSTR(str) dx_str_log(str,__LINE__,__FILE__) 31 | #define LOGDXFMT(args) (dx_line_log(__LINE__,__FILE__),dx_strf_log args) 32 | 33 | /* 34 | #define LOGDXERR(error) (void)0 35 | #define LOGDXSTR(str) (void)0 36 | #define LOGDXFMT(args) (void)0 37 | */ 38 | #endif 39 | 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* ! _included_dxlog_h_ */ 46 | -------------------------------------------------------------------------------- /src/win95/enumchnk.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _included_enumchnk_hpp_ 2 | #define _included_enumchnk_hpp_ 3 | 4 | #include "chunk.hpp" 5 | #include "mishchnk.hpp" 6 | 7 | class Enum_Header_Chunk; 8 | 9 | class Enum_Chunk : public Lockable_Chunk_With_Children 10 | { 11 | public: 12 | 13 | // empty constructor 14 | Enum_Chunk (Chunk_With_Children * parent); 15 | 16 | // constructor from buffer 17 | Enum_Chunk (Chunk_With_Children * const parent,const char *, size_t const); 18 | 19 | Enum_Header_Chunk * get_header(); 20 | 21 | // functions for the locking functionality 22 | 23 | BOOL file_equals (HANDLE &); 24 | const char * get_head_id(); 25 | void set_lock_user(char *); 26 | 27 | void post_input_processing(); 28 | 29 | private: 30 | 31 | friend class File_Chunk; 32 | friend class GodFather_Chunk; 33 | 34 | 35 | 36 | 37 | }; 38 | 39 | /////////////////////////////////////////////// 40 | 41 | class Enum_Header_Chunk : public Chunk 42 | { 43 | public: 44 | // constructor from buffer 45 | Enum_Header_Chunk (Chunk_With_Children * parent, const char * pdata, size_t psize); 46 | 47 | virtual size_t size_chunk () 48 | { 49 | chunk_size = 36; 50 | return chunk_size; 51 | } 52 | 53 | virtual BOOL output_chunk (HANDLE &); 54 | 55 | virtual void fill_data_block (char * data_start); 56 | 57 | void prepare_for_output(); 58 | 59 | private: 60 | 61 | friend class Enum_Chunk; 62 | friend class File_Chunk; 63 | 64 | int flags; 65 | 66 | int version_no; 67 | 68 | char lock_user[17]; 69 | 70 | 71 | // constructor from parent 72 | Enum_Header_Chunk (Enum_Chunk * parent) 73 | : Chunk (parent, "ENUMHEAD"), 74 | flags (0), version_no (0) 75 | {} 76 | 77 | }; 78 | 79 | 80 | 81 | 82 | #endif // _included_enumchnk_hpp_ 83 | -------------------------------------------------------------------------------- /src/win95/enumsch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _included_enumsch_hpp_ 2 | #define _included_enumsch_hpp_ 3 | 4 | #include "chunk.hpp" 5 | 6 | class Enum_Constant 7 | { 8 | public: 9 | char * cname; 10 | int value; 11 | int reserved; 12 | 13 | Enum_Constant() : cname(0), value(0), reserved(0) {} 14 | 15 | ~Enum_Constant() 16 | { 17 | if (cname) delete[] cname; 18 | } 19 | 20 | Enum_Constant(char const * const _cname, int const _value); 21 | Enum_Constant(Enum_Constant const & ec2); 22 | 23 | Enum_Constant & operator = (Enum_Constant const & ec2); 24 | 25 | BOOL operator == (Enum_Constant const & ec2) const; 26 | BOOL operator != (Enum_Constant const & ec2) const; 27 | BOOL operator < (Enum_Constant const & ec2) const; 28 | 29 | private: 30 | 31 | friend class BMP_Enums_Chunk; 32 | 33 | // constructor from buffer 34 | Enum_Constant(char const * sdata); 35 | 36 | size_t size_chunk() const; 37 | 38 | void fill_data_block(char * data_start); 39 | }; 40 | 41 | 42 | class Enum_Const_List 43 | { 44 | public: 45 | List enums; 46 | 47 | virtual ~Enum_Const_List(){} 48 | }; 49 | 50 | 51 | class BMP_Enums_Chunk : public Chunk, public Enum_Const_List 52 | { 53 | public: 54 | // constructor from buffer 55 | BMP_Enums_Chunk (Chunk_With_Children * const parent, char const * sdata, size_t const ssize); 56 | 57 | ~BMP_Enums_Chunk () 58 | { 59 | if (ctype) delete[] ctype; 60 | } 61 | 62 | virtual size_t size_chunk (); 63 | virtual void fill_data_block (char * data_start); 64 | 65 | char * ctype; 66 | int reserved1; 67 | int reserved2; 68 | // List enums; 69 | 70 | private: 71 | 72 | friend class Enum_Chunk; 73 | 74 | }; 75 | 76 | 77 | #endif // !_included_enumsch_hpp_ 78 | -------------------------------------------------------------------------------- /src/win95/fail.c: -------------------------------------------------------------------------------- 1 | /* LotU: Error handling functions. 2 | 3 | Copyright (C) 1995, Jamie Lokier. 4 | Written for Rebellion Developments, Ltd. 5 | 6 | Permission to use, copy, modify and distribute this file for any 7 | purpose by Rebellion Developments, Ltd. is hereby granted. If you 8 | want to use this file outside the company, please let me know. 9 | */ 10 | 11 | #include "3dc.h" 12 | #include "fail.h" 13 | #include "dxlog.h" 14 | 15 | void 16 | fail (const char * format, ...) 17 | { 18 | va_list ap; 19 | 20 | LOGDXSTR(format); 21 | va_start (ap, format); 22 | if (format != 0) 23 | vfprintf (stderr, format, ap); 24 | va_end (ap); 25 | 26 | exit (EXIT_FAILURE); 27 | } 28 | -------------------------------------------------------------------------------- /src/win95/fail.h: -------------------------------------------------------------------------------- 1 | /* LotU: Error handling functions. 2 | 3 | Copyright (C) 1995, Jamie Lokier. 4 | Written for Rebellion Developments, Ltd. 5 | 6 | Permission to use, copy, modify and distribute this file for any 7 | purpose by Rebellion Developments, Ltd. is hereby granted. If you 8 | want to use this file outside the company, please let me know. 9 | */ 10 | 11 | #ifndef __fail_h 12 | #define __fail_h 1 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifdef _MSC_VER 19 | #define VARARG_DECL __cdecl 20 | #else 21 | #define VARARG_DECL 22 | #endif 23 | 24 | extern void VARARG_DECL fail (const char * __format, ...); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif /* __fail_h */ 31 | -------------------------------------------------------------------------------- /src/win95/fragchnk.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _fragchnk_hpp_ 2 | #define _fragchnk_hpp_ 3 | 4 | #include "chunk.hpp" 5 | #include "chnktype.hpp" 6 | 7 | 8 | class Fragment_Type_Data_Chunk : public Chunk 9 | { 10 | public : 11 | 12 | Fragment_Type_Data_Chunk(Chunk_With_Children* parent,const char* name); 13 | Fragment_Type_Data_Chunk (Chunk_With_Children * const parent,const char *, size_t const); 14 | ~Fragment_Type_Data_Chunk(); 15 | 16 | size_t size_chunk (); 17 | void fill_data_block (char * data_start); 18 | 19 | 20 | char* frag_type_name; 21 | int pad1,pad2,pad3; 22 | 23 | }; 24 | 25 | class Fragment_Type_Shape_Chunk : public Chunk 26 | { 27 | public: 28 | 29 | Fragment_Type_Shape_Chunk(Chunk_With_Children* parent,const char* _name,int number,ChunkVectorInt _location); 30 | Fragment_Type_Shape_Chunk (Chunk_With_Children * const parent,const char *, size_t const); 31 | ~Fragment_Type_Shape_Chunk(); 32 | 33 | size_t size_chunk (); 34 | void fill_data_block (char * data_start); 35 | 36 | 37 | int num_fragments; 38 | ChunkVectorInt location; 39 | char* name; 40 | 41 | int pad1,pad2,pad3; 42 | 43 | }; 44 | class Fragment_Type_Sound_Chunk : public Chunk 45 | { 46 | public: 47 | 48 | Fragment_Type_Sound_Chunk(Chunk_With_Children* parent); 49 | Fragment_Type_Sound_Chunk (Chunk_With_Children * const parent,const char *, size_t const); 50 | ~Fragment_Type_Sound_Chunk(); 51 | 52 | size_t size_chunk (); 53 | void fill_data_block (char * data_start); 54 | 55 | char* wav_name; 56 | unsigned long inner_range; 57 | unsigned long outer_range; 58 | int max_volume; 59 | int pitch; 60 | int pad; 61 | 62 | }; 63 | 64 | class Fragment_Type_Chunk : public Chunk_With_Children 65 | { 66 | public : 67 | Fragment_Type_Chunk(Chunk_With_Children * parent,const char* name) 68 | : Chunk_With_Children (parent, "FRAGTYPE") 69 | {new Fragment_Type_Data_Chunk(this,name);} 70 | 71 | Fragment_Type_Chunk (Chunk_With_Children * const parent,const char *, size_t const); 72 | 73 | const char* get_name(); 74 | 75 | }; 76 | 77 | 78 | 79 | 80 | 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/win95/gsprchnk.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _included_gsprchnk_hpp_ 2 | #define _included_gsprchnk_hpp_ 3 | 4 | #include "chunk.hpp" 5 | #include "mishchnk.hpp" 6 | 7 | class AllSprites_Header_Chunk; 8 | 9 | class AllSprites_Chunk : public Lockable_Chunk_With_Children 10 | { 11 | public: 12 | 13 | // empty constructor 14 | AllSprites_Chunk (Chunk_With_Children * parent); 15 | // constructor from buffer 16 | AllSprites_Chunk (Chunk_With_Children * const parent,const char *, size_t const); 17 | 18 | AllSprites_Header_Chunk * get_header(); 19 | 20 | // functions for the locking functionality 21 | 22 | BOOL file_equals (HANDLE &); 23 | const char * get_head_id(); 24 | void set_lock_user(char *); 25 | 26 | void post_input_processing(); 27 | 28 | private: 29 | 30 | friend class File_Chunk; 31 | friend class GodFather_Chunk; 32 | 33 | 34 | 35 | 36 | }; 37 | 38 | /////////////////////////////////////////////// 39 | 40 | class AllSprites_Header_Chunk : public Chunk 41 | { 42 | public: 43 | // constructor from buffer 44 | AllSprites_Header_Chunk (Chunk_With_Children * parent, const char * pdata, size_t psize); 45 | 46 | virtual size_t size_chunk () 47 | { 48 | chunk_size = 36; 49 | return chunk_size; 50 | } 51 | 52 | virtual BOOL output_chunk (HANDLE &); 53 | 54 | virtual void fill_data_block (char * data_start); 55 | 56 | void prepare_for_output(); 57 | 58 | private: 59 | 60 | friend class AllSprites_Chunk; 61 | friend class File_Chunk; 62 | 63 | int flags; 64 | 65 | int version_no; 66 | 67 | char lock_user[17]; 68 | 69 | 70 | 71 | // constructor from parent 72 | AllSprites_Header_Chunk (AllSprites_Chunk * parent) 73 | : Chunk (parent, "ASPRHEAD"), 74 | flags (0), version_no (0) 75 | {} 76 | 77 | }; 78 | 79 | 80 | 81 | 82 | #endif // _included_gsprchnk_hpp_ 83 | -------------------------------------------------------------------------------- /src/win95/huffman.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _huffman_hpp_included 2 | #define _huffman_hpp_included 1 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | #define MAX_DEPTH 11 10 | 11 | typedef struct 12 | { 13 | char Identifier[8]; 14 | int CompressedDataSize; 15 | int UncompressedDataSize; 16 | int CodelengthCount[MAX_DEPTH]; 17 | unsigned char ByteAssignment[256]; 18 | } HuffmanPackage; 19 | 20 | 21 | /* KJL 17:16:03 17/09/98 - Compression */ 22 | extern HuffmanPackage *HuffmanCompression(unsigned char *sourcePtr, int length); 23 | 24 | /* KJL 16:53:53 19/09/98 - Decompression */ 25 | extern char *HuffmanDecompress(const HuffmanPackage *inpackage); 26 | 27 | 28 | #define COMPRESSED_RIF_IDENTIFIER "REBCRIF1" 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/win95/ilbm_ext.cpp: -------------------------------------------------------------------------------- 1 | #include "ilbm_ext.hpp" 2 | 3 | IFF_IMPLEMENT_DYNCREATE("ILBM","TRAN",IlbmTranChunk) 4 | IFF_IMPLEMENT_DYNCREATE("ILBM","ALPH",IlbmAlphChunk) 5 | IFF_IMPLEMENT_DYNCREATE("MIPM","CONT",MipmContChunk) 6 | IFF_IMPLEMENT_DYNCREATE("ILBM","S3TC",IlbmS3tcChunk) 7 | IFF_IMPLEMENT_DYNCREATE("MIPM","FLAG",MipmFlagChunk) 8 | 9 | namespace IFF 10 | { 11 | void IlbmTranChunk::Serialize(Archive * pArchv) 12 | { 13 | pArchv->Transfer(eTransType); 14 | pArchv->Transfer(xPos); 15 | pArchv->Transfer(yPos); 16 | pArchv->Transfer(rgb); 17 | } 18 | 19 | void IlbmAlphChunk::Serialize(Archive * pArchv) 20 | { 21 | pArchv->Transfer(width); 22 | pArchv->Transfer(height); 23 | pArchv->Transfer(nBitPlanes); 24 | pArchv->Transfer(eCompression); 25 | 26 | IlbmBodyChunk::Serialize(pArchv); 27 | } 28 | 29 | bool IlbmAlphChunk::GetHeaderInfo() const 30 | { 31 | IlbmBodyChunk::nWidth = width; 32 | IlbmBodyChunk::eCompression = eCompression; 33 | IlbmBodyChunk::nBitPlanes = nBitPlanes; 34 | return true; 35 | } 36 | 37 | void MipmContChunk::Serialize(Archive * pArchv) 38 | { 39 | pArchv->Transfer(nMipMaps); 40 | pArchv->Transfer(eFilter); 41 | } 42 | 43 | void MipmFlagChunk::Serialize(Archive * pArchv) 44 | { 45 | pArchv->Transfer(flags); 46 | } 47 | 48 | IlbmS3tcChunk::IlbmS3tcChunk() 49 | { 50 | m_idCk = "S3TC"; 51 | 52 | pData = NULL; 53 | dataSize = 0; 54 | } 55 | 56 | IlbmS3tcChunk::~IlbmS3tcChunk() 57 | { 58 | if(pData) delete [] pData; 59 | pData = NULL; 60 | } 61 | 62 | void IlbmS3tcChunk::Serialize(Archive * pArchv) 63 | { 64 | pArchv->Transfer(flags); 65 | pArchv->Transfer(fourCC); 66 | pArchv->Transfer(redWeight); 67 | pArchv->Transfer(blueWeight); 68 | pArchv->Transfer(greenWeight); 69 | pArchv->Transfer(width); 70 | pArchv->Transfer(height); 71 | 72 | pArchv->Transfer(dataSize); 73 | 74 | if (pArchv->m_bIsLoading) 75 | { 76 | if(pData) delete [] pData; 77 | pData = new UBYTE[dataSize]; 78 | } 79 | 80 | UBYTE *pDataPos = pData; 81 | for(unsigned i=0;iTransfer(*pDataPos++); 84 | } 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/win95/ilbm_ext.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDED_ILBM_EXT_HPP_ 2 | #define _INCLUDED_ILBM_EXT_HPP_ 3 | 4 | #include "iff.hpp" 5 | #include "iff_ilbm.hpp" 6 | 7 | namespace IFF 8 | { 9 | class IlbmTranChunk : public Chunk 10 | { 11 | public: 12 | enum 13 | { 14 | TRANS_NONE = 0, 15 | TRANS_TOPLEFT = 1, 16 | TRANS_BOTTOMLEFT = 2, 17 | TRANS_TOPRIGHT = 3, 18 | TRANS_BOTTOMRIGHT = 4, 19 | TRANS_XY = 5, 20 | TRANS_RGB = 6 21 | }; 22 | UBYTE eTransType; 23 | UINT16 xPos; 24 | UINT16 yPos; 25 | RGBTriple rgb; 26 | 27 | IlbmTranChunk() { m_idCk = "TRAN"; } 28 | 29 | protected: 30 | virtual void Serialize(Archive * pArchv); 31 | }; 32 | 33 | class IlbmAlphChunk : public IlbmBodyChunk // uses same encoding methodology 34 | { 35 | public: 36 | UINT16 width; 37 | UINT16 height; 38 | UBYTE nBitPlanes; 39 | UBYTE eCompression; 40 | 41 | IlbmAlphChunk() 42 | { m_idCk = "ALPH"; } 43 | 44 | protected: 45 | virtual void Serialize(Archive * pArchv); 46 | 47 | virtual bool GetHeaderInfo() const; 48 | }; 49 | 50 | class IlbmS3tcChunk : public Chunk 51 | { 52 | public: 53 | IlbmS3tcChunk(); 54 | virtual ~IlbmS3tcChunk(); 55 | 56 | 57 | 58 | UINT32 flags; // none at the moment 59 | UINT32 fourCC; //the fourcc code 'DXT1' - 'DXT5' 60 | 61 | UINT16 redWeight; //weighting values used in compression 62 | UINT16 blueWeight; 63 | UINT16 greenWeight; 64 | 65 | UINT16 width; 66 | UINT16 height; 67 | 68 | UINT32 dataSize; 69 | UBYTE* pData; //the compressed texture itself 70 | 71 | protected: 72 | virtual void Serialize(Archive * pArchv); 73 | }; 74 | 75 | 76 | class MipmContChunk : public Chunk 77 | { 78 | public: 79 | enum 80 | { 81 | FILTER_DEFAULT = 0, 82 | FILTER_BOX = 1, 83 | FILTER_TRIANGLE = 2, 84 | FILTER_BELL = 3, 85 | FILTER_BSPLINE = 4, 86 | FILTER_LANCZOS3 = 5, 87 | FILTER_MITCHELL = 6 88 | }; 89 | UBYTE nMipMaps; 90 | UBYTE eFilter; 91 | 92 | MipmContChunk() 93 | { m_idCk = "CONT"; } 94 | 95 | protected: 96 | virtual void Serialize(Archive * pArchv); 97 | }; 98 | 99 | class MipmFlagChunk : public Chunk 100 | { 101 | public: 102 | enum 103 | { 104 | FLAG_MANUAL_MIPS = 0x00000001,//some of the mip maps have been set by hand 105 | }; 106 | UINT32 flags; 107 | 108 | MipmFlagChunk() 109 | { m_idCk = "FLAG"; flags = 0;} 110 | 111 | protected: 112 | virtual void Serialize(Archive * pArchv); 113 | }; 114 | 115 | } 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /src/win95/list_tem.cpp: -------------------------------------------------------------------------------- 1 | #ifdef NDEBUG 2 | ; 3 | #else 4 | 5 | char const * list_fail_get_data_from_sentinel = "%s: Tried to get data from sentinel\n"; 6 | char const * list_fail_add_entry_after = "%s: Tried to add after a nonexistent List entry\n"; 7 | char const * list_fail_add_entry_before = "%s: Tried to add before a nonexistent List entry\n"; 8 | char const * list_fail_delete_entry = "%s: Tried to delete a nonexistent List entry\n"; 9 | char const * list_fail_delete_entry_by_pointer = "%s: Tried to delete-by-pointer the sentinel of a list.\n"; 10 | char const * list_fail_alter_entry = "%s: Tried to alter a nonexistent List entry\n"; 11 | char const * list_fail_next_entry_nonexist = "%s: Tried to get entry after nonexistent entry."; 12 | char const * list_fail_next_entry_sentinel = "%s: Tried to get next entry, which is sentinel."; 13 | char const * list_fail_prev_entry_nonexist = "%s: Tried to get entry before nonexistent entry"; 14 | char const * list_fail_prev_entry_sentinel = "%s: Tried to get previous entry, which is sentinel."; 15 | char const * list_fail_last_entry = "%s: Tried to get last entry from a 0-length list.\n."; 16 | char const * list_fail_first_entry = "%s: Tried to get first entry from a 0-length list.\n."; 17 | char const * list_fail_similar_entry = "%s: Tried to get entry similar to nonexistent entry"; 18 | char const * list_fail_delete_last_entry = "%s: Tried to delete last element from an empty List.\n"; 19 | char const * list_fail_delete_first_entry = "%s: Tried to delete first element from an empty List.\n"; 20 | char const * list_fail_operator = "%s: Tried to get entry %d from %d-entry list.\n"; 21 | char const * lit_fail_next = "%s: Tried to take an Iterator past the sentinel of a List.\n"; 22 | char const * lit_fail_operator = "%s: Tried to take contents of sentinel of List\n"; 23 | char const * lit_fail_delete_current = "%s: Tried to delete sentinel of List\n"; 24 | char const * lit_fail_change_current = "%s: Tried to change contents of sentinel of List\n"; 25 | 26 | #endif 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/win95/oechunk.h: -------------------------------------------------------------------------------- 1 | #ifndef _oechunk_h_ 2 | #define _oechunk_h_ 1 3 | 4 | #include "chunk.hpp" 5 | #include "obchunk.hpp" 6 | 7 | struct ChunkMapBlock 8 | { 9 | char TemplateName[20]; 10 | char TemplateNotes[100]; 11 | int MapType; 12 | int MapShape; 13 | int MapFlags; 14 | int MapFlags2; 15 | int MapFlags3; 16 | int MapCType; 17 | int MapCGameType; 18 | int MapCStrategyS; 19 | int MapCStrategyL; 20 | int MapInteriorType; 21 | int MapLightType; 22 | int MapMass; 23 | VECTORCH MapNewtonV; 24 | VECTORCH MapOrigin; 25 | int MapViewType; 26 | 27 | int MapVDBData; 28 | int SimShapeList; 29 | 30 | 31 | 32 | }; 33 | 34 | class Map_Block_Chunk : public Chunk 35 | { 36 | public: 37 | virtual size_t size_chunk() 38 | { 39 | return (chunk_size=216); 40 | } 41 | virtual BOOL output_chunk (HANDLE &); 42 | 43 | virtual void fill_data_block (char * data_start); 44 | 45 | ChunkMapBlock map_data; 46 | friend class Object_Project_Data_Chunk; 47 | 48 | Map_Block_Chunk (Object_Project_Data_Chunk * parent) 49 | :Chunk(parent,"MAPBLOCK") 50 | {} 51 | 52 | //constructor from buffer 53 | Map_Block_Chunk (Chunk_With_Children * parent,const char* data,size_t); 54 | }; 55 | 56 | struct ChunkStrategy 57 | { 58 | char StrategyName[20]; 59 | char StrategyNotes[100]; 60 | int Strategy; 61 | }; 62 | 63 | class Strategy_Chunk : public Chunk 64 | { 65 | public : 66 | virtual size_t size_chunk() 67 | { 68 | return (chunk_size=136); 69 | } 70 | virtual BOOL output_chunk (HANDLE &); 71 | 72 | virtual void fill_data_block (char * data_start); 73 | 74 | ChunkStrategy strategy_data; 75 | friend class Object_Project_Data_Chunk; 76 | 77 | Strategy_Chunk(Object_Project_Data_Chunk *parent) 78 | :Chunk(parent,"STRATEGY") 79 | {} 80 | 81 | //constructor from buffer 82 | Strategy_Chunk (Chunk_With_Children * parent,const char* data,size_t); 83 | }; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/win95/our_mem.c: -------------------------------------------------------------------------------- 1 | #include "3dc.h" 2 | 3 | #include 4 | 5 | #define UseLocalAssert No 6 | 7 | #include "ourasert.h" 8 | 9 | #if debug 10 | int alloc_cnt = 0; 11 | int deall_cnt = 0; 12 | #endif 13 | 14 | void *AllocMem(size_t __size); 15 | void DeallocMem(void *__ptr); 16 | 17 | /* Note: Never use AllocMem directly ! */ 18 | /* Instead use AllocateMem() which is a */ 19 | /* macro defined in mem3dc.h that allows */ 20 | /* for debugging info. */ 21 | 22 | void *AllocMem(size_t __size) 23 | { 24 | GLOBALASSERT(__size>0); 25 | #if debug 26 | alloc_cnt++; 27 | #endif 28 | 29 | return malloc(__size); 30 | }; 31 | 32 | /* Note: Never use DeallocMem directly ! */ 33 | /* Instead use DeallocateMem() which is a */ 34 | /* macro defined in mem3dc.h that allows */ 35 | /* for debugging info. */ 36 | 37 | void DeallocMem(void *__ptr) 38 | { 39 | #if debug 40 | deall_cnt++; 41 | #endif 42 | 43 | if(__ptr) free(__ptr); 44 | 45 | #if debug 46 | else { 47 | 48 | textprint("ERROR - freeing null ptr\n"); 49 | WaitForReturn(); 50 | 51 | } 52 | #endif 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /src/win95/plat_shp.h: -------------------------------------------------------------------------------- 1 | #ifndef __WIN95_PLAT_SHP_H__ 2 | #define __WIN95_PLAT_SHP_H__ 3 | 4 | /* Plat_Shp.h */ 5 | 6 | struct ColPolyTag; 7 | 8 | extern void SetupPolygonFlagAccessForShape(SHAPEHEADER *shape); 9 | extern int Request_PolyFlags(void *polygon); 10 | 11 | extern int SetupPolygonAccess(DISPLAYBLOCK *objectPtr); 12 | extern void AccessNextPolygon(void); 13 | extern void GetPolygonVertices(struct ColPolyTag *polyPtr); 14 | extern void GetPolygonNormal(struct ColPolyTag *polyPtr); 15 | extern int SetupPolygonAccessFromShapeIndex(int shapeIndex); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/win95/showcmds.h: -------------------------------------------------------------------------------- 1 | /* KJL 14:42:10 29/03/98 - ShowCmds.h 2 | 3 | defines the variables that describe the status of the debugging text 4 | 5 | 6 | eg. if ShowDebuggingText.FPS == 1, then the frame-rate show be displayed. 7 | 8 | */ 9 | struct DEBUGGINGTEXTOPTIONS 10 | { 11 | unsigned int FPS :1; 12 | unsigned int Environment :1; 13 | unsigned int Coords :1; 14 | unsigned int Module :1; 15 | unsigned int Target :1; 16 | 17 | unsigned int Networking: 1; 18 | unsigned int Dynamics :1; 19 | unsigned int GunPos :1; 20 | unsigned int Tears :1; 21 | unsigned int PolyCount :1; 22 | unsigned int Sounds :1; 23 | }; 24 | 25 | extern struct DEBUGGINGTEXTOPTIONS ShowDebuggingText; 26 | 27 | #ifdef AVP_DEBUG_VERSION 28 | #define DEBUGGING_TEXT_ON 1 29 | #else 30 | #define DEBUGGING_TEXT_ON 0 31 | #endif 32 | 33 | #if 0 /* stupid defines */ 34 | #if DEBUGGING_TEXT_ON 35 | extern int PrintDebuggingText(const char* t, ...); 36 | #else 37 | #define PrintDebuggingText(ignore) 38 | #endif 39 | 40 | #if 1 41 | extern int ReleasePrintDebuggingText(const char* t, ...); 42 | #else 43 | #define PrintDebuggingText(ignore) 44 | #endif 45 | #endif /* ... */ 46 | 47 | extern int PrintDebuggingText(const char* t, ...); 48 | extern int ReleasePrintDebuggingText(const char* t, ...); 49 | -------------------------------------------------------------------------------- /src/win95/toolchnk.cpp: -------------------------------------------------------------------------------- 1 | #include "toolchnk.hpp" 2 | 3 | //macro for helping to force inclusion of chunks when using libraries 4 | FORCE_CHUNK_INCLUDE_IMPLEMENT(toolchnk) 5 | 6 | RIF_IMPLEMENT_DYNCREATE("CAMORIGN",Camera_Origin_Chunk) 7 | 8 | Camera_Origin_Chunk::Camera_Origin_Chunk(Chunk_With_Children* parent) 9 | :Chunk(parent,"CAMORIGN") 10 | { 11 | location.x=0; 12 | location.y=0; 13 | location.z=0; 14 | ChunkMatrix identity={1,0,0,0,1,0,0,0,1}; 15 | orientation=identity; 16 | } 17 | 18 | Camera_Origin_Chunk::Camera_Origin_Chunk(Chunk_With_Children* parent,const char* data,size_t ) 19 | :Chunk(parent,"CAMORIGN") 20 | { 21 | location=*(ChunkVector*)data; 22 | data+=sizeof(ChunkVector); 23 | orientation=*(ChunkMatrix*)data; 24 | } 25 | 26 | void Camera_Origin_Chunk::fill_data_block(char * data_start) 27 | { 28 | strncpy (data_start, identifier, 8); 29 | data_start += 8; 30 | *((int *) data_start) = chunk_size; 31 | data_start += 4; 32 | 33 | *(ChunkVector*)data_start=location; 34 | data_start+=sizeof(ChunkVector); 35 | *(ChunkMatrix*)data_start=orientation; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/win95/toolchnk.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _toolchnk_hpp 2 | #define _toolchnk_hpp 3 | 4 | #include "chunk.hpp" 5 | #include "chnktype.hpp" 6 | 7 | class Camera_Origin_Chunk :public Chunk 8 | { 9 | public : 10 | Camera_Origin_Chunk(Chunk_With_Children* parent); 11 | Camera_Origin_Chunk(Chunk_With_Children * parent,const char* data,size_t size); 12 | 13 | ChunkVector location; 14 | ChunkMatrix orientation;//not used yet 15 | 16 | virtual void fill_data_block (char * data_start); 17 | virtual size_t size_chunk (){return chunk_size=12+sizeof(ChunkVector)+sizeof(ChunkMatrix); } 18 | 19 | 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/win95/txioctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef _included_txioctrl_h_ 2 | #define _included_txioctrl_h_ 3 | 4 | #include "system.h" 5 | 6 | #ifdef MaxImageGroups 7 | #if MaxImageGroups < 2 /* optimize if this multiple groups are not required */ 8 | #undef MaxImageGroups 9 | #endif /* MaxImageGroups < 2 */ 10 | #endif /* MaxImageGroups */ 11 | 12 | #ifdef MaxImageGroups 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | void ImageGroupFreed(int img_group); 19 | 20 | void MarkImageInUseByGroup(int img_group, int img_num_offset, int group_using); 21 | 22 | int IsImageInUse(int img_group, int img_num_offset); 23 | 24 | int CanDeleteImage(int img_group, int img_num_offset); 25 | 26 | void NowDeleteImage(int img_group, int img_num_offset); 27 | 28 | #if debug 29 | 30 | void ImageGroupsDebugPrint(void); 31 | 32 | void ImageGroupsDebugPrintInit(void); 33 | 34 | #endif /* debug */ 35 | 36 | typedef void (*ImageNumberCallbackFunction) (int imgnum, void * user); 37 | 38 | void EnumSharedImages(int group_num, int numimages, ImageNumberCallbackFunction callback_fn, void * user); 39 | 40 | void EnumLeftoverImages(int group_num, int numimages, ImageNumberCallbackFunction callback_fn, void * user); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* MaxImageGroups */ 47 | 48 | #endif /* ! _included_txioctrl_h_ */ 49 | -------------------------------------------------------------------------------- /src/win95/videomodes.h: -------------------------------------------------------------------------------- 1 | #define MAX_DEVICES 4 2 | #define MAX_VIDEOMODES 100 3 | 4 | 5 | typedef struct 6 | { 7 | int Width; 8 | int Height; 9 | int ColourDepth; 10 | } VIDEOMODEDESC; 11 | 12 | typedef struct 13 | { 14 | GUID DDGUID; 15 | int DDGUIDIsSet; 16 | 17 | DDDEVICEIDENTIFIER DeviceInfo; 18 | DDDEVICEIDENTIFIER DeviceInfoHost; 19 | DDCAPS DriverCaps; 20 | 21 | VIDEOMODEDESC VideoModes[MAX_VIDEOMODES]; 22 | int NumberOfVideoModes; 23 | 24 | } DEVICEANDVIDEOMODESDESC; 25 | 26 | typedef struct 27 | { 28 | GUID DDGUID; 29 | int DDGUIDIsSet; 30 | int Width; 31 | int Height; 32 | int ColourDepth; 33 | 34 | } DEVICEANDVIDEOMODE; 35 | 36 | extern DEVICEANDVIDEOMODESDESC DeviceDescriptions[MAX_DEVICES]; 37 | extern int NumberOfDevices; 38 | extern int CurrentlySelectedDevice; 39 | extern int CurrentlySelectedVideoMode; 40 | 41 | -------------------------------------------------------------------------------- /src/win95/wpchunk.hpp: -------------------------------------------------------------------------------- 1 | #ifndef wpchunk_hpp 2 | #define wpchunk_hpp 1 3 | 4 | #include "chunk.hpp" 5 | #include "chnktype.hpp" 6 | #include "obchunk.hpp" 7 | 8 | struct WaypointLink 9 | { 10 | int index; 11 | int flags; 12 | }; 13 | 14 | struct ModuleLink 15 | { 16 | ~ModuleLink(); 17 | 18 | char* module_name; 19 | int flags; 20 | }; 21 | 22 | #define WaypointFlag_CentreDefinedByUser 0x80000000 23 | #define WaypointFlag_FirstGroundWaypoint 0x40000000 24 | struct ChunkWaypoint 25 | { 26 | ChunkWaypoint(); 27 | ~ChunkWaypoint(); 28 | 29 | int index; 30 | ChunkVectorInt min,max; //relative to centre 31 | ChunkVectorInt centre; //relative to world 32 | 33 | int NumWPLinks; 34 | WaypointLink* WayLinks; 35 | 36 | int NumModLinks; 37 | ModuleLink* ModLinks; 38 | 39 | int flags,spare2; 40 | 41 | }; 42 | 43 | class Module_Waypoint_Chunk : public Chunk 44 | { 45 | public : 46 | Module_Waypoint_Chunk(Chunk_With_Children*,const char *,size_t); 47 | Module_Waypoint_Chunk(Chunk_With_Children*); 48 | ~Module_Waypoint_Chunk(); 49 | 50 | virtual size_t size_chunk(); 51 | virtual void fill_data_block(char* data_start); 52 | 53 | //Copies waypoint data and deletes the old waypoint_chunk 54 | void TransferWaypointData(Module_Waypoint_Chunk*); 55 | 56 | int NumWaypoints; 57 | ChunkWaypoint* Waypoints; 58 | 59 | ChunkWaypoint* AlienWaypoints; 60 | ChunkWaypoint* GroundWaypoints; 61 | 62 | short NumAlienWaypoints; 63 | short NumGroundWaypoints; 64 | 65 | int spare1; 66 | int spare2; 67 | }; 68 | 69 | class AI_Module_Master_Chunk : public Chunk 70 | { 71 | public : 72 | AI_Module_Master_Chunk(Chunk_With_Children*,const char*,size_t); 73 | AI_Module_Master_Chunk(Object_Module_Data_Chunk*); 74 | 75 | virtual size_t size_chunk(); 76 | virtual void fill_data_block(char* data_start); 77 | 78 | void AddModule(Object_Chunk*); 79 | Object_Chunk* get_my_object_chunk(); 80 | 81 | List ModuleList; 82 | }; 83 | 84 | class AI_Module_Slave_Chunk : public Chunk 85 | { 86 | public : 87 | AI_Module_Slave_Chunk(Chunk_With_Children*,const char*,size_t); 88 | AI_Module_Slave_Chunk(Object_Module_Data_Chunk*,Object_Chunk*); 89 | ~AI_Module_Slave_Chunk(); 90 | 91 | virtual size_t size_chunk(); 92 | virtual void fill_data_block(char* data_start); 93 | virtual void post_input_processing(); 94 | 95 | Object_Chunk* get_my_object_chunk(); 96 | 97 | Object_Chunk* MasterModule; 98 | int MasterModuleIndex; 99 | }; 100 | 101 | 102 | #endif 103 | 104 | 105 | -------------------------------------------------------------------------------- /src/win95/zsp.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _zsp_hpp 2 | #define _zsp_hpp 1 3 | 4 | #include "shpchunk.hpp" 5 | 6 | 7 | #define rsp_oc_x0 0x00000001 8 | #define rsp_oc_x1 0x00000002 9 | #define rsp_oc_y0 0x00000004 10 | #define rsp_oc_y1 0x00000008 11 | #define rsp_oc_z0 0x00000010 12 | #define rsp_oc_z1 0x00000020 13 | 14 | 15 | // this file should be included from chunk.hpp 16 | 17 | 18 | struct ChunkShape; 19 | 20 | struct ZSP_zone 21 | { 22 | ZSP_zone (); 23 | ~ZSP_zone(); 24 | 25 | ZSP_zone (const ZSP_zone &); 26 | ZSP_zone & operator=(const ZSP_zone &); 27 | 28 | int num_z_polys; 29 | int * z_poly_list; 30 | int num_z_verts; 31 | int * z_vert_list; 32 | 33 | friend unsigned char operator==(const ZSP_zone &, const ZSP_zone &); 34 | friend unsigned char operator!=(const ZSP_zone &, const ZSP_zone &); 35 | }; 36 | 37 | 38 | class ZSP_Data 39 | { 40 | 41 | public: 42 | ZSP_Data (const char * zdata, size_t zsize); 43 | 44 | ~ZSP_Data (); 45 | 46 | double cube_size; 47 | double cube_radius; 48 | 49 | int num_x_cubes, num_y_cubes, num_z_cubes; 50 | 51 | List zone_array; 52 | 53 | 54 | }; 55 | 56 | 57 | ///////////////////////////////////////// 58 | 59 | class Shape_ZSP_Data_Chunk : public Chunk 60 | { 61 | public: 62 | const ZSP_Data zspdata; 63 | 64 | size_t size_chunk (); 65 | void fill_data_block (char *); 66 | 67 | Shape_ZSP_Data_Chunk (Shape_Sub_Shape_Chunk * parent, const char * zdata, size_t zsize) 68 | : Chunk (parent, "SHPZSPDT"), zspdata (zdata, zsize) 69 | {} 70 | 71 | Shape_ZSP_Data_Chunk (Shape_Chunk * parent, const char * zdata, size_t zsize) 72 | : Chunk (parent, "SHPZSPDT"), zspdata (zdata, zsize) 73 | {} 74 | 75 | }; 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | #endif 88 | --------------------------------------------------------------------------------