Shove the early Hexen 2 work in here.

This commit is contained in:
Marco Cawthorne 2023-08-04 06:47:29 -07:00
parent 0f2b845902
commit 1739999520
Signed by: eukara
GPG key ID: CE2032F0A2882A22
34 changed files with 885 additions and 113 deletions

13
README
View file

@ -11,5 +11,18 @@ such as the Dreamcast without doing any heavy engine modifications.
Games can then query a very simple API and get started making games rather quickly!
There are 3 sample directories. Each has a different engine/protocol target:
q1 = Quake, qw = QuakeWorld, h2 = Hexen II.
Copy the base you'd like to target. If you need to switch targets later down the
line simply either this to your progs.src:
#define TARGET_QUAKEWORLD
#define TARGET_HEXEN2
This will make Nuclide target those protocol standards instead.
Games should ideally not break. Nuclide tries its best to ensure the code
builds, but the behaviour may be slightly different between the targets.
Hope you enjoy,
Marco

View file

@ -0,0 +1,81 @@
class H2ObjPot:idEntity {
void H2ObjPot( void );
virtual void Spawn( void );
};
void H2ObjPot:: H2ObjPot( void ) {
}
void H2ObjPot::Spawn( void ) {
#if 0
if (gameWorld.GetWorldType() == WORLDTYPE_CASTLE) {
SetSkin(0);
} else if (gameWorld.GetWorldType() == WORLDTYPE_EGPT) {
SetSkin(1);
} else if (gameWorld.GetWorldType() == WORLDTYPE_MESO) {
SetSkin(2);
} else if (gameWorld.GetWorldType() == WORLDTYPE_ROMAN) {
SetSkin(3);
}
#endif
}
class obj_pot1:H2ObjPot {
void obj_pot1( void );
virtual void Precache( void );
virtual void Spawn( void );
};
void obj_pot1::obj_pot1( void ) {
}
void obj_pot1::Precache( void ) {
gameEngine.Precache_Model( "models/pot1.mdl" );
}
void obj_pot1::Spawn( void ) {
super::Spawn();
SetModel( "models/pot1.mdl" );
}
class obj_pot2:H2ObjPot {
void obj_pot2( void );
virtual void Precache( void );
virtual void Spawn( void );
};
void obj_pot2::obj_pot2( void ) {
}
void obj_pot2::Precache( void ) {
gameEngine.Precache_Model( "models/pot2.mdl" );
}
void obj_pot2::Spawn( void ) {
super::Spawn();
SetModel( "models/pot2.mdl" );
}
class obj_pot3:H2ObjPot {
void obj_pot3( void );
virtual void Precache( void );
virtual void Spawn( void );
};
void obj_pot3::obj_pot3( void ) {
}
void obj_pot3::Precache( void ) {
gameEngine.Precache_Model( "models/pot3.mdl" );
}
void obj_pot3::Spawn( void ) {
super::Spawn();
SetModel( "models/pot1.mdl" );
}

View file

@ -0,0 +1,17 @@
class obj_tree:idEntity {
void obj_tree( void );
virtual void Precache( void );
virtual void Spawn( void );
};
void obj_tree::obj_tree( void ) {
}
void obj_tree::Spawn( void ) {
SetModel( "models/tree.mdl" );
}
void obj_tree::Precache( void ) {
gameEngine.Precache_Model( "models/tree.mdl" );
}

View file

@ -0,0 +1,47 @@
class obj_tree2:idEntity {
void obj_tree2( void );
virtual void Precache( void );
virtual void Spawn( void );
};
void obj_tree2::obj_tree2( void ) {
}
void obj_tree2::Spawn( void ) {
SetModel( "models/tree2.mdl" );
AddEffect( EF_DARKFIELD );
}
void obj_tree2::Precache( void ) {
gameEngine.Precache_Model( "models/tree2.mdl" );
}
LINK_ENTITY_TO_CLASS(art_HealthBoost, idNull)
LINK_ENTITY_TO_CLASS(art_torch, idNull)
LINK_ENTITY_TO_CLASS(breakable_brush, idNull)
LINK_ENTITY_TO_CLASS(func_button, idNull)
LINK_ENTITY_TO_CLASS(func_door, idNull)
LINK_ENTITY_TO_CLASS(func_door_rotating, idNull)
LINK_ENTITY_TO_CLASS(func_train, idNull)
LINK_ENTITY_TO_CLASS(item_armor_amulet, idNull)
LINK_ENTITY_TO_CLASS(light_flame_large_yellow, idNull)
LINK_ENTITY_TO_CLASS(light_flame_small_yellow, idNull)
LINK_ENTITY_TO_CLASS(light_torch_castle, idNull)
LINK_ENTITY_TO_CLASS(monster_archer, idNull)
LINK_ENTITY_TO_CLASS(monster_ratnest, idNull)
LINK_ENTITY_TO_CLASS(monster_skull_wizard, idNull)
LINK_ENTITY_TO_CLASS(obj_barrel, idNull)
LINK_ENTITY_TO_CLASS(obj_corpse1, idNull)
LINK_ENTITY_TO_CLASS(obj_book_open, idNull)
LINK_ENTITY_TO_CLASS(obj_bush1, idNull)
LINK_ENTITY_TO_CLASS(obj_seaweed, idNull)
LINK_ENTITY_TO_CLASS(obj_statue_angel, idNull)
LINK_ENTITY_TO_CLASS(obj_tombstone1, idNull)
LINK_ENTITY_TO_CLASS(obj_tombstone2, idNull)
LINK_ENTITY_TO_CLASS(path_corner, idNull)
LINK_ENTITY_TO_CLASS(plaque, idNull)
LINK_ENTITY_TO_CLASS(player_sheep, idNull)
LINK_ENTITY_TO_CLASS(puzzle_piece, idNull)
LINK_ENTITY_TO_CLASS(trigger_once, idNull)

10
h2/src/progs.src Normal file
View file

@ -0,0 +1,10 @@
#define TARGET_HEXEN2
#pragma progs_dat "../progs.dat"
#includelist
../../src/include.src
entities/obj_tree.qc
entities/obj_tree2.qc
entities/obj_pots.qc
#endlist

9
q1/src/defs.qh Normal file
View file

@ -0,0 +1,9 @@
float WEAPON_AXE = 4096;
float WEAPON_SHOTGUN = 1;
float WEAPON_SUPER_SHOTGUN = 2;
float WEAPON_NAILGUN = 4;
float WEAPON_SUPER_NAILGUN = 8;
float WEAPON_GRENADE_LAUNCHER = 16;
float WEAPON_ROCKET_LAUNCHER = 32;
float WEAPON_LIGHTNING = 64;
float WEAPON_EXTRA_WEAPON = 128;

7
q1/src/progs.src Normal file
View file

@ -0,0 +1,7 @@
#pragma progs_dat "../progs.dat"
#includelist
../../src/include.src
defs.qh
weapon_supershotgun.qc
#endlist

View file

@ -0,0 +1,29 @@
class Q1SuperShotgun:idItem {
void Q1SuperShotgun( void );
virtual void Precache( void );
virtual void Spawn( void );
virtual void PrimaryAttack( void );
};
void Q1SuperShotgun::Q1SuperShotgun( void ) {
}
void Q1SuperShotgun::Precache( void ) {
gameEngine.Precache_Model( "progs/g_shot.mdl" );
}
void Q1SuperShotgun::Spawn( void ) {
SetModel( "progs/g_shot.mdl" );
SetSolid( SOLID_TRIGGER );
SetID( WEAPON_SUPER_SHOTGUN );
}
void Q1SuperShotgun::PrimaryAttack( void ) {
}
LINK_ENTITY_TO_CLASS(weapon_supershotgun, Q1SuperShotgun)

6
qw/src/progs.src Normal file
View file

@ -0,0 +1,6 @@
#define TARGET_QUAKEWORLD
#pragma progs_dat "../progs.dat"
#includelist
../../src/include.src
#endlist

View file

@ -3,7 +3,13 @@ void makevectors(vector ang) = #1
void setorigin(entity e, vector o) = #2;
void setmodel(entity e, string m) = #3;
void setsize(entity e, vector min, vector max) = #4;
#ifdef TARGET_HEXEN2
void lightstylestatic(float style, float value) = #5;
#else
/* 5 was removed */
#endif
void break(void) = #6;
float random(void) = #7;
void sound(entity e, float chan, string samp, float vol, float atten) = #8;
@ -22,7 +28,7 @@ string precache_model(string s) = #20;
void stuffcmd(entity client, string s) = #21;
entity findradius(vector org, float rad) = #22;
#ifndef TARGET_QUAKEWORLD
#ifndef TARGET_QUAKEWORLD /* also HEXEN2 */
void bprint(string s) = #23;
void sprint(entity client, string s) = #24;
#else
@ -38,16 +44,35 @@ void traceon(void) = #29;
void traceoff(void) = #30;
void eprint(entity e) = #31;
float walkmove(float yaw, float dist) = #32;
#ifdef TARGET_HEXEN2
float tracearea(vector v1, vector v2, vector mins, vector maxs, float nomonsters, entity forent) = #33;
#else
/* #33 was removed */
#endif
float droptofloor(float yaw, float dist) = #34;
void lightstyle(float style, string value) = #35;
float rint(float v) = #36;
float floor(float v) = #37;
float ceil(float v) = #38;
#ifdef TARGET_HEXEN2
void AwardExperience(entity ToEnt, entity FromEnt, float Amount) = #39;
#else
/* #39 was removed */
#endif
float checkbottom(entity e) = #40;
float pointcontents(vector v) = #41;
#ifdef TARGET_HEXEN2
void particle2(vector o, vector dmin, vector dmax, float color, float type, float count) : 42;
#else
/* #42 was removed */
#endif
float fabs(float f) = #43;
vector aim(entity e, float speed) = #44;
float cvar(string s) = #45;
@ -59,7 +84,13 @@ void particle(vector o, vector d, float color, float count) = #48;
#endif
void changeyaw(void) = #49;
#ifdef TARGET_HEXEN2
float vhlen(vector v) = #50;
#else
/* #50 was removed */
#endif
vector vectoangles(vector v) = #51;
void writeByte(float to, float f) = #52;
void writeChar(float to, float f) = #53;
@ -69,6 +100,16 @@ void writeCoord(float to, float f) = #56;
void writeAngle(float to, float f) = #57;
void writeString(float to, string s) = #58;
void writeEntity(float to, entity s) = #59;
#ifdef TARGET_HEXEN2
void dprintf(string s, float num) = #60;
float cos(float angle) = #61;
float sin(float angle) = #62;
float AdvanceFrame(float start, float end) = #63;
void dprintv(string s, vector vec) = #64;
float RewindFrame(float start, float end) = #65;
void setclass(entity e, float value) = #66;
#else
/* 60 was removed */
/* 61 was removed */
/* 62 was removed */
@ -76,11 +117,20 @@ void writeEntity(float to, entity s) = #59;
/* 64 was removed */
/* 65 was removed */
/* 66 was removed */
#endif
void movetogoal(float step) = #67;
string precache_file(string s) = #68;
void makestatic(entity e) = #69;
#ifdef TARGET_HEXEN2
void changelevel(string level, string spot) = #70;
float lightstylevalue(float style) = #71;
#else
void changelevel(string s) = #70;
/* 71 was removed */
#endif
void cvar_set(string var, string val) = #72;
void centerprint(entity client, string s) = #73;
void ambientsound(vector pos, string samp, float vol, float atten) = #74;
@ -89,9 +139,32 @@ string precache_sound2(string s) = #76;
string precache_file2(string s) = #77;
void setspawnparms(entity e) = #78;
#ifdef TARGET_QUAKEWORLD
void logfrag(entity killer, entity killee) = #79;
string infokey(entity e, string key) = #80;
float stof(string s) = #81;
void multicast(vector where, float set) = #82;
#ifdef TARGET_HEXEN2
void plaque_draw(float to, float index) = #79;
void rain_go(vector v1, vector v2, vector e_size, vector dir, float color, float count) = #80;
void particleexplosion(vector v,float f,float c,float s) = #81;
float movestep(float x, float y, float z, float set_trace) = #82;
float advanceweaponframe(float startframe, float endframe) = #83;
float sqrt(float num1) = #84;
void particle3(vector o, vector box, float color, float type, float count) = #85;
void particle4(vector o, float radius, float color, float type, float count) = #86;
void setpuzzlemodel(entity e, string m) = #87; /* m will used as: models/puzzle/m.mdl */
float starteffect(float to, float effect) = #88;
float endeffect(float to, float effect_id) = #89;
string precache_puzzle_model(string s) = #90;
vector concatv(vector in, vector limit) = #91;
string getstring(float id) = #92;
entity spawn_temp(void) = #93;
vector v_factor(vector factor) = #94; /* returns (v_right * factor_x) + (v_forward * factor_y) + (v_up * factor_z) */
vector v_factorrange(vector start, vector end) = #95;
string precache_sound3(string s) = #96;
string precache_model3(string s) = #97;
string precache_file3(string s) = #98;
#else
#ifdef TARGET_QUAKEWORLD
void logfrag(entity killer, entity killee) = #79;
string infokey(entity e, string key) = #80;
float stof(string s) = #81;
void multicast(vector where, float set) = #82;
#endif
#endif

View file

@ -199,6 +199,21 @@ typedef enum
} channel_t;
/* entity effects */
#ifdef TARGET_HEXEN2
typedef enumflags
{
EF_BRIGHTFIELD = 1,
EF_MUZZLEFLASH = 2,
EF_BRIGHTLIGHT = 4,
EF_TORCHLIGHT = 6,
EF_DIMLIGHT = 8,
EF_DARKLIGHT = 16,
EF_DARKFIELD = 32,
EF_LIGHT = 64,
EF_NODRAW = 128
} effects_t;
#else
typedef enumflags
{
EF_BRIGHTFIELD, /* not available in QW */
@ -212,6 +227,7 @@ typedef enumflags
EF_RED /* red glow */
#endif
} effects_t;
#endif
/* messages */
typedef enum
@ -247,4 +263,26 @@ typedef enum
MULTICAST_ALL_R, /* reliable version of above */
MULTICAST_PHS_R,
MULTICAST_PVS_R
} multicast_t;
} multicast_t;
#ifdef TARGET_HEXEN2
#define MLS_MASKIN 7 // MLS: Model Light Style
#define MLS_MASKOUT 248
#define MLS_NONE 0
#define MLS_FULLBRIGHT 1
#define MLS_POWERMODE 2
#define MLS_TORCH 3
#define MLS_TOTALDARK 4
#define MLS_ABSLIGHT 7
#define SCALE_TYPE_MASKIN 24
#define SCALE_TYPE_MASKOUT 231
#define SCALE_TYPE_UNIFORM 0 // Scale X, Y, and Z
#define SCALE_TYPE_XYONLY 8 // Scale X and Y
#define SCALE_TYPE_ZONLY 16 // Scale Z
#define SCALE_ORIGIN_MASKIN 96
#define SCALE_ORIGIN_MASKOUT 159
#define SCALE_ORIGIN_CENTER 0 // Scaling origin at object center
#define SCALE_ORIGIN_BOTTOM 32 // Scaling origin at object bottom
#define SCALE_ORIGIN_TOP 64 // Scaling origin at object top
#define DRF_TRANSLUCENT 128
#endif

View file

@ -20,13 +20,21 @@ float force_retouch;
/** Contains the name of the map we're currently on. */
string mapname;
#ifndef TARGET_QUAKEWORLD
/** Mirrors the 'deathmatch' cvar. */
#ifdef TARGET_HEXEN2
string startspot;
float deathmatch;
/** Mirrors the 'coop' cvar. */
float randomclass;
float coop;
/** Mirros the 'teamplay' cvar */
float teamplay;
#else
#ifndef TARGET_QUAKEWORLD
/** Mirrors the 'deathmatch' cvar. */
float deathmatch;
/** Mirrors the 'coop' cvar. */
float coop;
/** Mirros the 'teamplay' cvar */
float teamplay;
#endif
#endif
/** A persistent value that's carried across map changes within a single campaign. */
@ -40,7 +48,32 @@ float found_secrets;
/** The count of monsters that have been disposed of. */
float killed_monsters;
#ifdef TARGET_HEXEN2
/** Number of chunks existing currently. (?) */
float chunk_cnt;
/** Set by monster spawners to ensure init functions aren't called post level init. */
float done_precache;
#endif
/* changelevel parameters, set for each player */
#ifdef TARGET_HEXEN2
float parm1;
float parm2;
float parm4;
float parm5;
float parm6;
float parm7;
float parm8;
float parm9;
float parm10;
float parm11;
float parm12;
float parm13;
float parm14;
float parm15;
float parm16;
string parm3;
#else
float parm1;
float parm2;
float parm3;
@ -57,6 +90,7 @@ float parm13;
float parm14;
float parm15;
float parm16;
#endif
/** Set by makevectors(). Gets the forward direction. */
vector v_forward;
@ -79,6 +113,19 @@ float trace_inwater;
/** The entity that is casting a network message. */
entity msg_entity;
#ifdef TARGET_HEXEN2
/* set by OP_CSTATE functions */
float cycle_wrapped;
float crouch_cnt;
float modelindex_assassin;
float modelindex_crusader;
float modelindex_paladin;
float modelindex_necromancer;
float modelindex_sheep;
float num_players;
float exp_mult;
#endif
/* engine callbacks */
/** Engine callback: Unused */
@ -95,15 +142,39 @@ void ClientKill(void);
void ClientConnect(void);
/** Engine callback: Called on every client when they've fully joined the game. */
void PutClientInServer(void);
#ifdef TARGET_HEXEN2
/** Called when client re-enters the level. */
void ClientReEnter(float TimeDiff);
#endif
/** Engine callback: Called on every client when they're disconnecting from the server. */
void ClientDisconnect(void);
#ifdef TARGET_HEXEN2
/** Called when the class changed weapons. (?) */
void ClassChangeWeapon(void);
#else
/** Engine callback: Called at the start of every new game on a player. Here the parmX globals are set for the player in question. */
void SetNewParms(void);
/** Engine callback: Called at the start of every map change. */
void SetChangeParms(void);
#endif
void end_sys_globals;
#ifdef TARGET_HEXEN2
float movedist;
float gameover;
string string_null;
entity newmis;
entity activator;
entity damage_attacker;
float framecount;
float skill;
float wp_deselect;
#endif
/* edict_t fields */
/* they are much better documented in idEntity */
.float modelindex;
@ -111,9 +182,11 @@ void end_sys_globals;
.vector absmax;
.float ltime;
#ifndef TARGET_HEXEN2
#ifdef TARGET_QUAKEWORLD
.float lastruntime;
#endif
#endif
.float movetype;
.float solid;
@ -132,15 +205,138 @@ void end_sys_globals;
.float frame;
.float skin;
.float effects;
#ifdef TARGET_HEXEN2
.float scale;
.float drawflags;
.float abslight;
#endif
.vector mins;
.vector maxs;
.vector size;
#ifdef TARGET_HEXEN2
.float hull;
#endif
.void() touch;
.void() use;
.void() think;
.void() blocked;
.float nextthink;
.entity groundentity;
#ifdef TARGET_HEXEN2
.float stats_restored;
.float frags;
.float weapon;
.string weaponmodel;
.float weaponframe;
.float health;
.float max_health;
.float playerclass;
.float bluemana;
.float greenmana;
.float max_mana;
.float armor_amulet;
.float armor_bracer;
.float armor_breastplate;
.float armor_helmet;
.float level;
.float intelligence;
.float wisdom;
.float dexterity;
.float strength;
.float experience;
.float ring_flight;
.float ring_water;
.float ring_turning;
.float ring_regeneration;
.float haste_time;
.float tome_time;
.string puzzle_inv1;
.string puzzle_inv2;
.string puzzle_inv3;
.string puzzle_inv4;
.string puzzle_inv5;
.string puzzle_inv6;
.string puzzle_inv7;
.string puzzle_inv8;
.float experience_value;
.float items;
.float takedamage;
.entity chain;
.float deadflag;
.vector view_ofs;
.float button0;
.float button1;
.float button2;
.float impulse;
.float fixangle;
.vector v_angle;
.float idealpitch;
.float idealroll;
.float hoverz;
.string netname;
.entity enemy;
.float flags;
.float flags2;
.float artifact_flags;
.float colormap;
.float team;
.float light_level;
.float teleport_time;
.float armortype;
.float armorvalue;
.float waterlevel;
.float watertype;
.float friction;
.float ideal_yaw;
.float yaw_speed;
.entity goalentity;
.float spawnflags;
.string target;
.string targetname;
.float dmg_take;
.float dmg_save;
.entity dmg_inflictor;
.entity owner;
.vector movedir;
.float message;
.float soundtype;
.string noise;
.string noise1;
.string noise2;
.string noise3;
.float rings;
.float rings_active;
.float rings_low;
.float artifacts;
.float artifact_active;
.float artifact_low;
.float hasted;
.float inventory;
.float cnt_torch;
.float cnt_h_boost;
.float cnt_sh_boost;
.float cnt_mana_boost;
.float cnt_teleport;
.float cnt_tome;
.float cnt_summon;
.float cnt_invisibility;
.float cnt_glyph;
.float cnt_haste;
.float cnt_blast;
.float cnt_polymorph;
.float cnt_flight;
.float cnt_cubeofforce;
.float cnt_invincibility;
.entity cameramode;
.entity movechain;
.void() chainmoved;
.float string_index;
#else
.float health;
.float frags;
.float weapon;
@ -196,4 +392,6 @@ void end_sys_globals;
.string noise1;
.string noise2;
.string noise3;
#endif
void end_sys_fields;

View file

@ -7,4 +7,5 @@ void idNull::idNull( void ) {
}
LINK_ENTITY_TO_CLASS(info_null, idNull)
LINK_ENTITY_TO_CLASS(info_notnull, idNull)
LINK_ENTITY_TO_CLASS(info_teleport_destination, idNull)

View file

@ -11,13 +11,13 @@ void idPlayerStart::idPlayerStart( void ) {
}
idEntity idPlayerStart::MovePlayerToStart( idPlayer player ) {
idEntity point = g_idEngine.Find( ( idEntity ) world, ::classname, "idPlayerStart" );
idEntity point = gameEngine.Find( ( idEntity ) world, ::classname, "idPlayerStart" );
if ( point ) {
player.Transport( point.GetOrigin(), point.GetAngles() );
return point;
} else {
g_idEngine.Error( "Cannot find idPlayerStart on level." );
gameEngine.Error( "Cannot find idPlayerStart on level." );
return __NULL__;
}
}

View file

@ -20,7 +20,7 @@ string idTriggerChangelevel::GetNextLevel( void )
void idTriggerChangelevel::ChangelevelTouched( idEntity toucher ) {
if ( toucher.IsPlayer() ) {
g_idEngine.ChangeLevel( GetNextLevel() );
gameEngine.ChangeLevel( GetNextLevel() );
}
}

View file

@ -5,23 +5,32 @@ class idWorldspawn {
};
void idWorldspawn::idWorldspawn( void ) {
g_idEngine.Precache_Model( "progs/player.mdl" );
#ifdef TARGET_HEXEN2
gameEngine.Precache_Model( "models/paladin.mdl" );
gameEngine.Precache_Model( "models/assassin.mdl" );
gameEngine.Precache_Model( "models/necro.mdl" );
gameEngine.Precache_Model( "models/crusader.mdl" );
gameEngine.Precache_Model( "models/assassin.mdl" );
#else
gameEngine.Precache_Model( "progs/player.mdl" );
#endif
InitLight();
}
void idWorldspawn::InitLight( void ) {
g_idEngine.LightStyle( 0, "m" );
g_idEngine.LightStyle( 1, "mmnmmommommnonmmonqnmmo" );
g_idEngine.LightStyle( 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba" );
g_idEngine.LightStyle( 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg" );
g_idEngine.LightStyle( 4, "mamamamamama" );
g_idEngine.LightStyle( 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj" );
g_idEngine.LightStyle( 6, "nmonqnmomnmomomno" );
g_idEngine.LightStyle( 7, "mmmaaaabcdefgmmmmaaaammmaamm" );
g_idEngine.LightStyle( 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa" );
g_idEngine.LightStyle( 9, "aaaaaaaazzzzzzzz" );
g_idEngine.LightStyle( 10, "mmamammmmammamamaaamammma" );
g_idEngine.LightStyle( 11, "abcdefghijklmnopqrrqponmlkjihgfedcba" );
gameEngine.LightStyle( 0, "m" );
gameEngine.LightStyle( 1, "mmnmmommommnonmmonqnmmo" );
gameEngine.LightStyle( 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba" );
gameEngine.LightStyle( 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg" );
gameEngine.LightStyle( 4, "mamamamamama" );
gameEngine.LightStyle( 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj" );
gameEngine.LightStyle( 6, "nmonqnmomnmomomno" );
gameEngine.LightStyle( 7, "mmmaaaabcdefgmmmmaaaammmaamm" );
gameEngine.LightStyle( 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa" );
gameEngine.LightStyle( 9, "aaaaaaaazzzzzzzz" );
gameEngine.LightStyle( 10, "mmamammmmammamamaaamammma" );
gameEngine.LightStyle( 11, "abcdefghijklmnopqrrqponmlkjihgfedcba" );
}
LINK_ENTITY_TO_CLASS(worldspawn, idWorldspawn)

View file

@ -2,81 +2,84 @@
void main( void ) {
/* all the files that DOSQuake needs to boot. */
g_idEngine.Precache_File( "progs.dat");
g_idEngine.Precache_File( "gfx.wad" );
g_idEngine.Precache_File( "quake.rc" );
g_idEngine.Precache_File( "default.cfg" );
g_idEngine.Precache_File( "gfx/palette.lmp" );
g_idEngine.Precache_File( "gfx/colormap.lmp" );
g_idEngine.Precache_File( "gfx/complete.lmp" );
g_idEngine.Precache_File( "gfx/inter.lmp" );
g_idEngine.Precache_File( "gfx/ranking.lmp" );
g_idEngine.Precache_File( "gfx/vidmodes.lmp" );
g_idEngine.Precache_File( "gfx/finale.lmp" );
g_idEngine.Precache_File( "gfx/conback.lmp" );
g_idEngine.Precache_File( "gfx/qplaque.lmp" );
g_idEngine.Precache_File( "gfx/menudot1.lmp" );
g_idEngine.Precache_File( "gfx/menudot2.lmp" );
g_idEngine.Precache_File( "gfx/menudot3.lmp" );
g_idEngine.Precache_File( "gfx/menudot4.lmp" );
g_idEngine.Precache_File( "gfx/menudot5.lmp" );
g_idEngine.Precache_File( "gfx/menudot6.lmp" );
g_idEngine.Precache_File( "gfx/menuplyr.lmp" );
g_idEngine.Precache_File( "gfx/bigbox.lmp" );
g_idEngine.Precache_File( "gfx/dim_modm.lmp" );
g_idEngine.Precache_File( "gfx/dim_drct.lmp" );
g_idEngine.Precache_File( "gfx/dim_ipx.lmp" );
g_idEngine.Precache_File( "gfx/dim_tcp.lmp" );
g_idEngine.Precache_File( "gfx/dim_mult.lmp" );
g_idEngine.Precache_File( "gfx/mainmenu.lmp" );
g_idEngine.Precache_File( "gfx/box_tl.lmp" );
g_idEngine.Precache_File( "gfx/box_tm.lmp" );
g_idEngine.Precache_File( "gfx/box_tr.lmp" );
g_idEngine.Precache_File( "gfx/box_ml.lmp" );
g_idEngine.Precache_File( "gfx/box_mm.lmp" );
g_idEngine.Precache_File( "gfx/box_mm2.lmp" );
g_idEngine.Precache_File( "gfx/box_mr.lmp" );
g_idEngine.Precache_File( "gfx/box_bl.lmp" );
g_idEngine.Precache_File( "gfx/box_bm.lmp" );
g_idEngine.Precache_File( "gfx/box_br.lmp" );
g_idEngine.Precache_File( "gfx/sp_menu.lmp" );
g_idEngine.Precache_File( "gfx/ttl_sgl.lmp" );
g_idEngine.Precache_File( "gfx/ttl_main.lmp" );
g_idEngine.Precache_File( "gfx/ttl_cstm.lmp" );
g_idEngine.Precache_File( "gfx/mp_menu.lmp" );
g_idEngine.Precache_File( "gfx/netmen1.lmp" );
g_idEngine.Precache_File( "gfx/netmen2.lmp" );
g_idEngine.Precache_File( "gfx/netmen3.lmp" );
g_idEngine.Precache_File( "gfx/netmen4.lmp" );
g_idEngine.Precache_File( "gfx/netmen5.lmp" );
g_idEngine.Precache_File( "gfx/sell.lmp" );
g_idEngine.Precache_File( "gfx/help0.lmp" );
g_idEngine.Precache_File( "gfx/help1.lmp" );
g_idEngine.Precache_File( "gfx/help2.lmp" );
g_idEngine.Precache_File( "gfx/help3.lmp" );
g_idEngine.Precache_File( "gfx/help4.lmp" );
g_idEngine.Precache_File( "gfx/help5.lmp" );
g_idEngine.Precache_File( "gfx/pause.lmp" );
g_idEngine.Precache_File( "gfx/loading.lmp" );
g_idEngine.Precache_File( "gfx/p_option.lmp" );
g_idEngine.Precache_File( "gfx/p_load.lmp" );
g_idEngine.Precache_File( "gfx/p_save.lmp" );
g_idEngine.Precache_File( "gfx/p_multi.lmp" );
g_idEngine.Precache_Sound( "misc/menu1.wav" );
g_idEngine.Precache_Sound( "misc/menu2.wav" );
g_idEngine.Precache_Sound( "misc/menu3.wav" );
g_idEngine.Precache_Sound( "ambience/water1.wav" );
g_idEngine.Precache_Sound( "ambience/wind2.wav" );
g_idEngine.Precache_File( "maps/start.bsp" );
g_idEngine.Precache_File2( "gfx/pop.lmp" );
gameEngine.Precache_File( "progs.dat");
gameEngine.Precache_File( "gfx.wad" );
gameEngine.Precache_File( "quake.rc" );
gameEngine.Precache_File( "default.cfg" );
gameEngine.Precache_File( "gfx/palette.lmp" );
gameEngine.Precache_File( "gfx/colormap.lmp" );
gameEngine.Precache_File( "gfx/complete.lmp" );
gameEngine.Precache_File( "gfx/inter.lmp" );
gameEngine.Precache_File( "gfx/ranking.lmp" );
gameEngine.Precache_File( "gfx/vidmodes.lmp" );
gameEngine.Precache_File( "gfx/finale.lmp" );
gameEngine.Precache_File( "gfx/conback.lmp" );
gameEngine.Precache_File( "gfx/qplaque.lmp" );
gameEngine.Precache_File( "gfx/menudot1.lmp" );
gameEngine.Precache_File( "gfx/menudot2.lmp" );
gameEngine.Precache_File( "gfx/menudot3.lmp" );
gameEngine.Precache_File( "gfx/menudot4.lmp" );
gameEngine.Precache_File( "gfx/menudot5.lmp" );
gameEngine.Precache_File( "gfx/menudot6.lmp" );
gameEngine.Precache_File( "gfx/menuplyr.lmp" );
gameEngine.Precache_File( "gfx/bigbox.lmp" );
gameEngine.Precache_File( "gfx/dim_modm.lmp" );
gameEngine.Precache_File( "gfx/dim_drct.lmp" );
gameEngine.Precache_File( "gfx/dim_ipx.lmp" );
gameEngine.Precache_File( "gfx/dim_tcp.lmp" );
gameEngine.Precache_File( "gfx/dim_mult.lmp" );
gameEngine.Precache_File( "gfx/mainmenu.lmp" );
gameEngine.Precache_File( "gfx/box_tl.lmp" );
gameEngine.Precache_File( "gfx/box_tm.lmp" );
gameEngine.Precache_File( "gfx/box_tr.lmp" );
gameEngine.Precache_File( "gfx/box_ml.lmp" );
gameEngine.Precache_File( "gfx/box_mm.lmp" );
gameEngine.Precache_File( "gfx/box_mm2.lmp" );
gameEngine.Precache_File( "gfx/box_mr.lmp" );
gameEngine.Precache_File( "gfx/box_bl.lmp" );
gameEngine.Precache_File( "gfx/box_bm.lmp" );
gameEngine.Precache_File( "gfx/box_br.lmp" );
gameEngine.Precache_File( "gfx/sp_menu.lmp" );
gameEngine.Precache_File( "gfx/ttl_sgl.lmp" );
gameEngine.Precache_File( "gfx/ttl_main.lmp" );
gameEngine.Precache_File( "gfx/ttl_cstm.lmp" );
gameEngine.Precache_File( "gfx/mp_menu.lmp" );
gameEngine.Precache_File( "gfx/netmen1.lmp" );
gameEngine.Precache_File( "gfx/netmen2.lmp" );
gameEngine.Precache_File( "gfx/netmen3.lmp" );
gameEngine.Precache_File( "gfx/netmen4.lmp" );
gameEngine.Precache_File( "gfx/netmen5.lmp" );
gameEngine.Precache_File( "gfx/sell.lmp" );
gameEngine.Precache_File( "gfx/help0.lmp" );
gameEngine.Precache_File( "gfx/help1.lmp" );
gameEngine.Precache_File( "gfx/help2.lmp" );
gameEngine.Precache_File( "gfx/help3.lmp" );
gameEngine.Precache_File( "gfx/help4.lmp" );
gameEngine.Precache_File( "gfx/help5.lmp" );
gameEngine.Precache_File( "gfx/pause.lmp" );
gameEngine.Precache_File( "gfx/loading.lmp" );
gameEngine.Precache_File( "gfx/p_option.lmp" );
gameEngine.Precache_File( "gfx/p_load.lmp" );
gameEngine.Precache_File( "gfx/p_save.lmp" );
gameEngine.Precache_File( "gfx/p_multi.lmp" );
gameEngine.Precache_Sound( "misc/menu1.wav" );
gameEngine.Precache_Sound( "misc/menu2.wav" );
gameEngine.Precache_Sound( "misc/menu3.wav" );
gameEngine.Precache_Sound( "ambience/water1.wav" );
gameEngine.Precache_Sound( "ambience/wind2.wav" );
gameEngine.Precache_File( "maps/start.bsp" );
gameEngine.Precache_File2( "gfx/pop.lmp" );
}
void StartFrame( void ) {
if (time)
g_world_initialized = true;
/* if our rules class doesn't yet exist - create it! */
if ( !g_gameRules ) {
g_gameRules = g_idEngine.Spawn();
g_gameRules = gameEngine.Spawn();
self = g_gameRules;
spawnfunc_idRules();
Class_Rules();
self = world;
}
}
@ -121,13 +124,11 @@ void PlayerPostThink( void ) {
}
void ClientKill( void ) {
g_gameRules.ApplyDamage( ( idEntity) self, ( idEntity ) self, 200, 0, 0);
g_gameRules.ApplyDamage( ( idEntity ) self, ( idEntity ) self, 200, 0, 0);
}
void ClientConnect( void ) {
/* initialize the player as an NSEntity class type */
spawnfunc_idPlayer();
Class_Player();
g_gameRules.PlayerConnects( ( idPlayer ) self );
}
@ -144,3 +145,13 @@ void SetNewParms( void ) {
void SetChangeParms( void ) {
}
#ifdef TARGET_HEXEN2
void ClientReEnter( float timeDifference ) {
}
void ClassChangeWeapon( void ) {
}
#endif

View file

@ -1,4 +1,65 @@
/* protocol specific network events */
/* listed here mainly for informative reasons */
#ifdef TARGET_HEXEN2
typedef enum
{
SVC_BAD = 0,
SVC_NOP = 1,
SVC_DISCONNECT = 2,
SVC_UPDATESTAT = 3,
SVC_VERSION = 4,
SVC_SETVIEW = 5,
SVC_SOUND = 6,
SVC_TIME = 7,
SVC_PRINT = 8,
SVC_STUFFTEXT = 9,
SVC_SETANGLE = 10,
SVC_SERVERINFO = 11,
SVC_LIGHTSTYLE = 12,
SVC_UPDATENAME = 13,
SVC_UPDATEFRAGS = 14,
SVC_CLIENTDATA = 15,
SVC_STOPSOUND = 16,
SVC_UPDATECOLORS = 17,
SVC_PARTICLE = 18,
SVC_DAMAGE = 19,
SVC_SPAWNSTATIC = 20,
SVC_RAINEFFECT = 21,
SVC_SPAWNBASELINE = 22,
SVC_TEMP_ENTITY = 23,
SVC_SETPAUSE = 24,
SVC_SIGNONNUM = 25,
SVC_CENTERPRINT = 26,
SVC_KILLEDMONSTER = 27,
SVC_FOUNDSECRET = 28,
SVC_SPAWNSTATICSOUND = 29,
SVC_INTERMISSION = 30,
SVC_FINALE = 31,
SVC_CDTRACK = 32,
SVC_SELLSCREEN = 33,
SVC_PARTICLE2 = 34,
SVC_CUTSCENE = 35,
SVC_MIDI_NAME = 36,
SVC_UPDATECLASS = 37,
SVC_PARTICLE3 = 38,
SVC_PARTICLE4 = 39,
SVC_SET_VIEW_FLAGS = 40,
SVC_CLEAR_VIEW_FLAGS = 41,
SVC_START_EFFECT = 42,
SVC_END_EFFECT = 43,
SVC_PLAQUE = 44,
SVC_PARTICLE_EXPLOSION = 45,
SVC_SET_VIEW_TINT = 46,
SVC_REFERENCE = 47,
SVC_CLEAR_EDICTS = 48,
SVC_UPDATE_INV = 49,
SVC_SETANGLE_INTERPOLATE= 50,
SVC_UPDATE_KINGOFHILL = 51,
SVC_TOGGLE_STATBAR = 52,
SVC_SOUND_UPDATE_POS = 53,
} svc_t;
#else
#ifndef TARGET_QUAKEWORLD
typedef enum
{
@ -95,4 +156,5 @@ typedef enum
SVC_SERVERINFO = 52,
SVC_UPDATEPL = 53,
} svc_t;
#endif
#endif

15
src/include.src Normal file
View file

@ -0,0 +1,15 @@
#ifdef TARGET_HEXEN2
#pragma target hexen2
#else
#pragma target standard
#endif
#includelist
defs.qh
constants.qh
events.qh
system/headers.src
entry.qc
entities/sources.src
system/sources.src
#endlist

View file

@ -1,7 +1,14 @@
#pragma target standard
#pragma progs_dat "../progs.dat"
/* choose one only. */
//#define TARGET_QUAKEWORLD 1
#define TARGET_HEXEN2 1
//#define TARGET_QUAKEWORLD 1
#ifdef TARGET_HEXEN2
#pragma target hexen2
#else
#pragma target standard
#endif
#pragma progs_dat "../progs.dat"
#includelist
defs.qh

19
src/system/classes.qc Normal file
View file

@ -0,0 +1,19 @@
__weak void Class_Player(void) {
spawnfunc_idPlayer();
}
__weak void Class_Actor(void) {
spawnfunc_idActor();
}
__weak void Class_Rules(void) {
spawnfunc_idRules();
}
__weak void Class_Engine(void) {
spawnfunc_idEngine();
}
__weak void Class_Entity(void) {
spawnfunc_idEntity();
}

10
src/system/classes.qh Normal file
View file

@ -0,0 +1,10 @@
/* these functions are implemented by Nuclide,
but designed to be overridden. You can simply
implement your own functions of these and they
will get priority over what Nuclide decides to do. */
void Class_Player(void);
void Class_Actor(void);
void Class_Rules(void);
void Class_Engine(void);
void Class_Entity(void);

View file

@ -1,6 +1,9 @@
#includelist
idEntity.qh
idEngine.qh
idActor.qh
idPlayer.qh
idRules.qh
idItem.qh
classes.qh
#endlist

3
src/system/idActor.qc Normal file
View file

@ -0,0 +1,3 @@
void idActor::idActor ( void ) {
}

3
src/system/idActor.qh Normal file
View file

@ -0,0 +1,3 @@
class idActor : idEntity {
void idActor( void );
};

View file

@ -246,7 +246,11 @@ void idEngine::MakeStatic( idEntity e ) {
}
void idEngine::ChangeLevel( string s ) {
#ifdef TARGET_HEXEN2
changelevel( s, "" );
#else
changelevel( s );
#endif
}
void idEngine::CVarSet( string variable, string val ) {

View file

@ -70,7 +70,7 @@ class idEngine {
nonvirtual void MultiCast(vector where, float set);
};
idEngine g_idEngine;
idEngine gameEngine;
#define LINK_ENTITY_TO_CLASS(cname,classa) void cname(void) { spawnfunc_##classa(); }

View file

@ -2,6 +2,17 @@
void idEntity::idEntity( void ) {
health = 0;
max_health = 100;
if (g_world_initialized == false) {
Precache();
}
Spawn();
}
void idEntity::Precache( void ) {
}
void idEntity::Spawn( void ) {
}
/* set functions */
@ -18,7 +29,7 @@ void idEntity::SetSolid( solid_t value ) {
}
void idEntity::SetOrigin( vector value ) {
g_idEngine.SetOrigin( this, value );
gameEngine.SetOrigin( this, value );
}
void idEntity::SetVelocity( vector value ) {
@ -40,7 +51,7 @@ void idEntity::SetPunchangle( vector value ) {
}
void idEntity::SetModel( string value ) {
g_idEngine.SetModel( this, value );
gameEngine.SetModel( this, value );
}
void idEntity::SetFrame( float value ) {
@ -64,7 +75,7 @@ void idEntity::ClearEffects( void ) {
}
void idEntity::SetSize( vector min, vector max ) {
g_idEngine.SetSize( this, min, max );
gameEngine.SetSize( this, min, max );
}
void idEntity::ScheduleThink( void ( void ) func, float timer ) {
@ -102,23 +113,33 @@ void idEntity::SetWeaponframe( float value ) {
}
void idEntity::SetCurrentAmmo( float value ) {
#ifndef TARGET_HEXEN2
currentammo = value;
#endif
}
void idEntity::SetAmmoType1( float value ) {
#ifndef TARGET_HEXEN2
ammo_shells = value;
#endif
}
void idEntity::SetAmmoType2( float value ) {
#ifndef TARGET_HEXEN2
ammo_nails = value;
#endif
}
void idEntity::SetAmmoType3( float value ) {
#ifndef TARGET_HEXEN2
ammo_rockets = value;
#endif
}
void idEntity::SetAmmoType4( float value ) {
#ifndef TARGET_HEXEN2
ammo_cells = value;
#endif
}
void idEntity::SetTakedamage( damage_t value ) {
@ -170,7 +191,9 @@ void idEntity::SetArmor( float value ) {
}
void idEntity::SetAimEntity( entity value ) {
#ifndef TARGET_HEXEN2
aiment = value;
#endif
}
void idEntity::SetGoalEntity( entity value ) {
@ -194,11 +217,15 @@ void idEntity::SetMovementDirection( vector value ) {
}
void idEntity::SetTriggerMessage( string value ) {
#ifndef TARGET_HEXEN2
message = value;
#endif
}
void idEntity::SetSoundStyle( float value ) {
#ifndef TARGET_HEXEN2
sounds = value;
#endif
}
void idEntity::SetNoiseValue1( string value ) {
@ -307,23 +334,33 @@ float idEntity::GetWeaponframe( void ) {
}
float idEntity::GetCurrentAmmo( void ) {
#ifndef TARGET_HEXEN2
return currentammo;
#endif
}
float idEntity::GetAmmoType1( void ) {
#ifndef TARGET_HEXEN2
return ammo_shells;
#endif
}
float idEntity::GetAmmoType2( void ) {
#ifndef TARGET_HEXEN2
return ammo_nails;
#endif
}
float idEntity::GetAmmoType3( void ) {
#ifndef TARGET_HEXEN2
return ammo_rockets;
#endif
}
float idEntity::GetAmmoType4( void ) {
#ifndef TARGET_HEXEN2
return ammo_cells;
#endif
}
bool idEntity::CanTakeDamage( void ) {
@ -363,7 +400,9 @@ float idEntity::GetArmor( void ) {
}
entity idEntity::GetAimEntity( void ) {
#ifndef TARGET_HEXEN2
return aiment;
#endif
}
entity idEntity::GetGoalEntity( void ) {
@ -387,11 +426,15 @@ vector idEntity::GetMovementDirection( void ) {
}
string idEntity::GetTriggerMessage( void ) {
#ifndef TARGET_HEXEN2
return message;
#endif
}
float idEntity::GetSoundStyle( void ) {
#ifndef TARGET_HEXEN2
return sounds;
#endif
}
string idEntity::GetNoiseValue1( void ) {
@ -411,7 +454,7 @@ string idEntity::GetNoiseValue4( void ) {
}
string idEntity::GetInfoKey( string key ) {
return g_idEngine.InfoKey(this, key);
return gameEngine.InfoKey(this, key);
}
bool idEntity::IsPlayer( void ) {
@ -440,7 +483,7 @@ void idEntity::InitTrigger( void ) {
void idEntity::Transport( vector new_pos, vector new_ang ) {
float flSpeed = vlen(this.GetVelocity());
g_idEngine.MakeVectors(new_ang);
gameEngine.MakeVectors(new_ang);
SetVelocity(v_forward * flSpeed);
SetOrigin(new_pos);
@ -449,7 +492,7 @@ void idEntity::Transport( vector new_pos, vector new_ang ) {
}
idEntity idEntity::FindFirstTarget( void ) {
return g_idEngine.Find( (idEntity) world, ::targetname, target);
return gameEngine.Find( (idEntity) world, ::targetname, target);
}
void idEntity::Death( void ) {

View file

@ -201,6 +201,12 @@ class idEntity {
nonvirtual void Transport( vector, vector );
nonvirtual idEntity FindFirstTarget( void );
/** Overridable: When the entity has initialized, it will execute this method. */
virtual void Spawn( void );
/** Overridable: When the entity spawns on level-load, execute this method. */
virtual void Precache( void );
virtual void Death( void );
virtual void Pain( void );
};
var bool g_world_initialized;

23
src/system/idItem.qc Normal file
View file

@ -0,0 +1,23 @@
void idItem::idItem(void) {
}
void idItem::SetID(float a) {
// item = a;
}
float idItem::GetID(void) {
//return item;
}
void idItem::PrimaryAttack(void) {
}
void idItem::SecondaryAttack(void) {
}
void idItem::Reload(void) {
}
void idItem::Release(void) {
}

17
src/system/idItem.qh Normal file
View file

@ -0,0 +1,17 @@
class idItem:idEntity {
void idItem(void);
/* Sets the id of an Item. */
nonvirtual void SetID(float);
/** Returns the id of an Item. */
nonvirtual float GetID(void);
/** Overridable: On +attack execution. */
virtual void PrimaryAttack(void);
/** Overridable: On +attack2 execution. */
virtual void SecondaryAttack(void);
/** Overridlable: On +reload execution. */
virtual void Reload(void);
/** Overridable: When no buttons are held. */
virtual void Release(void);
};

View file

@ -14,7 +14,12 @@ void idPlayer::ResetPlayer( void ) {
ClearFlags();
ClearEffects();
ClearFrags();
#ifdef TARGET_HEXEN2
SetModel( "models/paladin.mdl" );
#else
SetModel( "progs/player.mdl" );
#endif
SetMovetype( MOVETYPE_WALK );
SetSolid( SOLID_SLIDEBOX );
SetViewOffset( [0, 0, 24] );

View file

@ -2,15 +2,15 @@ void idRules::idRules( void ) {
}
void idRules::PlayerConnects( idPlayer pl ) {
g_idEngine.BPrint( PRINT_HIGH, "Player connected.\n" );
gameEngine.BPrint( PRINT_HIGH, "Player connected.\n" );
}
void idRules::PlayerDisconnects( idPlayer pl ) {
g_idEngine.BPrint( PRINT_HIGH, "Player disconnected.\n" );
gameEngine.BPrint( PRINT_HIGH, "Player disconnected.\n" );
}
void idRules::PlayerFinishesJoining( idPlayer player ) {
g_idEngine.BPrint( PRINT_HIGH, "Player joined the game fully.\n" );
gameEngine.BPrint( PRINT_HIGH, "Player joined the game fully.\n" );
/* reset them fully */
player.ResetPlayer();

View file

@ -1,6 +1,9 @@
#includelist
idEngine.qc
idEntity.qc
idActor.qc
idPlayer.qc
idRules.qc
idItem.qc
classes.qc
#endlist