From 328f1f8ee187967c59c1b923cfbf01b43f1d40b0 Mon Sep 17 00:00:00 2001 From: Ian Date: Fri, 2 Sep 2022 20:19:25 -0400 Subject: [PATCH] Add CTR QuakeC --- .github/workflows/compile-and-release.yml | 10 + progs/ctr.src | 43 ++ source/server/clientfuncs.qc | 39 +- source/server/damage.qc | 4 +- source/server/defs/ctr.qc | 540 ++++++++++++++++++++++ source/server/defs/custom.qc | 10 +- source/server/dummies/ctr.qc | 38 ++ source/server/entities/doors.qc | 2 +- source/server/entities/triggers.qc | 2 + source/server/main.qc | 60 +-- source/server/player.qc | 4 +- source/server/psp_specifics.qc | 8 +- source/server/rounds.qc | 20 +- source/server/weapons/weapon_core.qc | 9 +- source/shared/defs/custom.qc | 2 + source/shared/weapon_defines.qc | 18 + tools/qc-compiler-lin.sh | 10 +- tools/qc-compiler-win.bat | 7 + 18 files changed, 766 insertions(+), 60 deletions(-) create mode 100644 progs/ctr.src create mode 100644 source/server/defs/ctr.qc create mode 100644 source/server/dummies/ctr.qc diff --git a/.github/workflows/compile-and-release.yml b/.github/workflows/compile-and-release.yml index 4e071cb..c1cb844 100644 --- a/.github/workflows/compile-and-release.yml +++ b/.github/workflows/compile-and-release.yml @@ -19,6 +19,7 @@ jobs: zip -r -j psp-nzp-qc.zip psp/* zip -r -j nx-nzp-qc.zip nx/* zip -r -j vita-nzp-qc.zip vita/* + zip -r -j ctr-nzp-qc.zip ctr/* - name: Generate Build Date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M-%S')" @@ -45,6 +46,15 @@ jobs: - Extract the contents of the .ZIP archive to your nzp folder (Example: copy `progs.dat` and `progs.lno` to `PSP/GAME/nzportable/nzp`). draft: true prerelease: false + - name: Upload CTR QC + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/ctr-nzp-qc.zip + asset_name: ctr-nzp-qc.zip + asset_content_type: application/zip - name: Upload NX QC uses: actions/upload-release-asset@v1 env: diff --git a/progs/ctr.src b/progs/ctr.src new file mode 100644 index 0000000..90d6a30 --- /dev/null +++ b/progs/ctr.src @@ -0,0 +1,43 @@ +../../build/ctr/progs.dat + +#pragma warning disable Q208 + +../source/server/defs/ctr.qc +../source/server/dummies/ctr.qc +../source/shared/defs/custom.qc +../source/shared/weapon_defines.qc +../source/server/defs/custom.qc +../source/server/clientfuncs.qc + +../source/server/psp_specifics.qc + +../source/server/dummies/generic.qc +../source/server/rounds.qc +../source/server/nzdparser.qc +../source/server/main.qc +../source/server/player.qc +../source/server/damage.qc + +../source/server/entities/sub_functions.qc +../source/server/entities/sounds.qc +../source/server/entities/triggers.qc +../source/server/entities/explosive_barrel.qc +../source/server/entities/map_entities.qc +../source/server/entities/traps.qc +../source/server/entities/lights.qc +../source/server/entities/doors.qc +../source/server/entities/window.qc +../source/server/entities/machines.qc + +../source/server/weapons/frames_core.qc +../source/server/weapons/weapon_core.qc +../source/server/entities/powerups.qc + +../source/server/ai/ai_core.qc +../source/server/ai/standard/waypoints_func.qc +../source/server/ai/standard/waypoints_core.qc +../source/server/ai/zombie_core.qc +../source/server/ai/crawler_core.qc +../source/server/ai/dog_core.qc + +../source/server/items.qc diff --git a/source/server/clientfuncs.qc b/source/server/clientfuncs.qc index 97ca7eb..a7fc61d 100644 --- a/source/server/clientfuncs.qc +++ b/source/server/clientfuncs.qc @@ -29,6 +29,7 @@ void SetUpdate(entity client, float type, float val1, float val2, float val3) { #ifndef PSP #ifndef NX + #ifndef CTR if (type != 2) { @@ -53,10 +54,12 @@ void SetUpdate(entity client, float type, float val1, float val2, float val3) } #endif #endif + #endif } #ifndef PSP #ifndef NX +#ifndef CTR void(entity to, float type, float cost, float weapon) useprint = { WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_USEPRINT); @@ -68,6 +71,7 @@ void(entity to, float type, float cost, float weapon) useprint = { } #endif #endif +#endif void(vector org) CallExplosion = { #ifndef PC @@ -89,7 +93,8 @@ void(vector org) CallExplosion = { void NotifyNewRound(float to) { #ifndef PSP #ifndef NX - + #ifndef CTR + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_NEWROUND); WriteByte(MSG_MULTICAST, to); @@ -97,12 +102,14 @@ void NotifyNewRound(float to) { #endif #endif + #endif } void SetRound(entity client, float to) { #ifndef PSP #ifndef NX - + #ifndef CTR + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_SETROUND); WriteByte(MSG_MULTICAST, to); @@ -111,12 +118,14 @@ void SetRound(entity client, float to) { #endif #endif + #endif } void SetPerk(entity client, float to) { #ifndef PSP #ifndef NX + #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_PERK); @@ -126,12 +135,14 @@ void SetPerk(entity client, float to) #endif #endif + #endif } void(float to) SwitchWeapon = { #ifndef PSP #ifndef NX + #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_WEAPONCHANGE); @@ -144,13 +155,15 @@ void(float to) SwitchWeapon = #endif #endif + #endif } void(string to, float skin) UpdateVmodel = { #ifndef PSP #ifndef NX - + #ifndef CTR + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_UPDATEVMODEL); WriteString(MSG_MULTICAST, to); @@ -160,12 +173,15 @@ void(string to, float skin) UpdateVmodel = #endif #endif + #endif } void(string to, float skin) UpdateV2model = { #ifndef PSP #ifndef NX + #ifndef CTR + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_UPDATEV2MODEL); WriteString(MSG_MULTICAST, to); @@ -174,12 +190,14 @@ void(string to, float skin) UpdateV2model = multicast('0 0 0', MULTICAST_ONE); #endif #endif + #endif } void(float broadcast_time, float type) BroadcastMessage = { #ifndef PSP #ifndef NX + #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_BROADCAST); WriteByte(MSG_MULTICAST, broadcast_time); @@ -188,12 +206,14 @@ void(float broadcast_time, float type) BroadcastMessage = #endif #endif + #endif } void(float playernum, float points, float am, float kills, string name, entity person) UpdatePlayerPoints = { #ifndef PSP #ifndef NX + #ifndef CTR if (player_count == 0) { WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_POINTUPDATE); @@ -218,11 +238,13 @@ void(float playernum, float points, float am, float kills, string name, entity p #endif #endif + #endif } void(float count) UpdatePlayerCount = { #ifndef PSP #ifndef NX + #ifndef CTR if (count == 0) return; else { @@ -234,13 +256,15 @@ void(float count) UpdatePlayerCount = { #endif #endif + #endif } void(float newtime, float newtype, entity change) PromptLevelChange = { #ifndef PSP #ifndef NX - + #ifndef CTR + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_BLACKOUT); WriteByte(MSG_MULTICAST, newtime); @@ -250,6 +274,7 @@ void(float newtime, float newtype, entity change) PromptLevelChange = #endif #endif + #endif } void(entity who) UpdatePunchangle = @@ -258,6 +283,7 @@ void(entity who) UpdatePunchangle = // naievil -- shit logic lol...but result looks clean as fuck... #ifndef PSP #ifndef NX + #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_PUNCHANGLE); WriteCoord(MSG_MULTICAST, who.punchangle_x); @@ -300,10 +326,12 @@ void(entity who) UpdatePunchangle = #endif #endif + #endif } #ifndef PSP #ifndef NX +#ifndef CTR void(string h, float h2, entity who) pushHUD = { if (player_count == 0) { WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); @@ -394,8 +422,10 @@ void(string chaptertitle, string location, string date, string person, entity wh } #endif #endif +#endif #ifndef NX +#ifndef CTR void (float achievement_id, optional entity who) GiveAchievement = { #ifdef PSP @@ -470,6 +500,7 @@ void (float achievement_id, float progress_value, optional entity who) UpdateAch #endif // PSP } } +#endif // CTR #endif // NX // ***************************************** diff --git a/source/server/damage.qc b/source/server/damage.qc index c3ba2da..13c5656 100644 --- a/source/server/damage.qc +++ b/source/server/damage.qc @@ -170,7 +170,7 @@ void() EndGameSetup = } // rec_downed is used as a recursive loop where we consistently check to see if ALL players are downed -// if they aren't dead, we keep looping until our OWN death (30 seconds, so 300 loops) +// if they aren't dead, we keep looping until our OWN death (45 seconds, so 300 loops) void() rec_downed = { self.downedloop++; @@ -566,4 +566,4 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra } ent = ent.chain; } -}; +}; \ No newline at end of file diff --git a/source/server/defs/ctr.qc b/source/server/defs/ctr.qc new file mode 100644 index 0000000..dc49153 --- /dev/null +++ b/source/server/defs/ctr.qc @@ -0,0 +1,540 @@ +/* ++----+ +|Defs| ++----+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ +| Scratch Http://www.admdev.com/scratch | ++=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ +| This contains necessary definitions from the original V1.06 defs.qc file. | +| This includes some basic constants, the built in function definitions, and | +| some variable's used by the Quake Engine internally. | +| Certain lines in this file are hardcoded into Quake engine, and -must- be | +| present and unchanged, in the order they are shown. Otherwise Quake will | +| refuse to run. | ++=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ +*/ + +#define CTR + +// These lines CANNOT be altered/moved +entity self; +entity other; +entity world; +float time; +float frametime; +float force_retouch; // force all entities to touch triggers +string mapname; +float deathmatch; +float coop; +float teamplay; +float serverflags; +float rounds; +float rounds_change; +float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16; +vector v_forward, v_up, v_right; // set by makevectors() +float trace_allsolid; +float trace_startsolid; +float trace_fraction; +vector trace_endpos; +vector trace_plane_normal; +float trace_plane_dist; +entity trace_ent; +float trace_inopen; +float trace_inwater; + +entity msg_entity; // destination of single entity writes +void() main; // only for testing +void() StartFrame; +void() EndFrame; +void() PlayerPreThink; +void() PlayerPostThink; +void() ClientKill; +void() ClientConnect; +void() PutClientInServer; // call after setting the parm1... parms +void() ClientDisconnect; +void() SetNewParms; // called when a client first connects to +void() SetChangeParms; // call to set parms for self so they can +void() ParseClientCommand; // special command calls +string CMD_STRING; +void() Soft_Restart; +void end_sys_globals; // flag for structure dumping + +.float modelindex; // *** model index in the precached list +.vector absmin, absmax; // *** origin + mins / maxs +.float ltime; // local time for entity +.float movetype; +.float solid; +.vector origin; // *** +.vector oldorigin; // *** +.vector velocity; +.vector angles; +.vector avelocity; +.vector punchangle; // temp angle adjust from damage or recoil +.string classname; // spawn function +.string model; +.float frame; +.float skin; +.float effects; +.vector mins, maxs; // bounding box extents reletive to origin +.vector size; // maxs - mins +.void() touch; +.void() use; +.void() think; +.void() blocked; // for doors or plats, called when can't push other +.float nextthink; +.entity groundentity; +.float health; +.float points; +.float kills; +.float weapon; // one of the W_COLT, etc flags +.string weaponmodel; +.string weapon2model; +.float weaponframe; +.float weapon2frame; +.float currentammo; +.float currentmag; +.float zoom; +.float weaponskin; +.float weapon2skin; +.float primary_grenades; +.float secondary_grenades; +.float grenades; +.float perks; // bit flags +.float takedamage; +.entity chain; +.float deadflag; +.vector view_ofs; // add to origin to get eye point +.float button0; // +.float button1; // +.float button2; // +.float button3; // +.float button4; // +.float button5; // +.float button6; // +.float button7; // +.float button8; // +.float impulse; // weapon changes +.float fixangle; +.vector v_angle; // view / targeting angle for players +.float idealpitch; // calculated pitch angle for lookup up slopes +.string netname; +.entity enemy; +.float flags; +.float colormap; +.float team; +.float max_health; // players maximum health is stored here +.float teleport_time; // don't back up +.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes +.float watertype; // a contents value +.float ideal_yaw; +.float yaw_speed; +.entity aiment; +.entity head; +.entity larm; +.entity rarm; +.entity goalentity; // a movetarget or an enemy +//.entity goalorigin; // a movetarget location +.float spawnflags; +.string target; +.string targetname; +.float bleed_out; +.float progress_bar; +.entity dmg_inflictor; +.entity owner; // who launched a missile +.vector movedir; // mostly for doors, but also used for waterjump +.string message; // trigger messages +.float sounds; // either a cd track number or sound number +.string noise, noise1, noise2, noise3; // contains names of wavs to play +.float x2_icon; // double points icon +.float insta_icon; +.vector ADS_Offset; +.vector Flash_Offset; +.float Flash_Size; +.string Weapon_Name; +.string Weapon_Name_Touch; +.float currentmag2; +.float maxspeed; +.float facingenemy; +void end_sys_fields; // flag for structure dumping +// End. Lines below this MAY be altered, to some extent + +// Built In functions +void(vector ang) makevectors = #1; // sets v_forward, etc globals +void(entity e, vector o) setorigin = #2; +void(entity e, string m) setmodel = #3; // set movetype and solid first +void(entity e, vector min, vector max) setsize = #4; +void() break = #6; +float() random = #7; // returns 0 - 1 +void(entity e, float chan, string samp, float vol, float atten) sound = #8; +vector(vector v) normalize = #9; +void(string e) error = #10; +void(string e) objerror = #11; +float(vector v) vlen = #12; +float(vector v) vectoyaw = #13; +entity() spawn = #14; +void(entity e) remove = #15; +void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16; +entity() checkclient = #17; // returns a client to look for +entity(entity start, .string fld, string match) find = #18; +string(string s) precache_sound = #19; +string(string s) precache_model = #20; +void(entity client, string s)stuffcmd = #21; +entity(vector org, float rad) findradius = #22; +void(string s) dprint = #25; +string(float f) ftos = #26; +string(vector v) vtos = #27; +void() coredump = #28; // prints all edicts +void() traceon = #29; // turns statment trace on +void() traceoff = #30; +void(entity e) eprint = #31; // prints an entire edict +float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE +float(entity zombie, float which, entity limb) updateLimb = #33; +float(float yaw, float dist) droptofloor = #34; // TRUE if landed on floor +void(float style, string value) lightstyle = #35; +float(float v) rint = #36; // round to nearest int +float(float v) floor = #37; // largest integer <= v +float(float v) ceil = #38; // smallest integer >= v +float(entity e) checkbottom = #40; // true if self is on ground +float(vector v) pointcontents = #41; // returns a CONTENT_* +float(float f) fabs = #43; +vector(entity e, float speed) aim = #44; // returns the shooting vector +float(string s) cvar = #45; // return cvar.value +void(string s) localcmd = #46; // put string into local que +entity(entity e) nextent = #47; // for looping through all ents +void() ChangeYaw = #49; // turn towards self.ideal_yaw +float(string name) getSoundLen = #50; +vector(vector v) vectoangles = #51; +void(float to, float f) WriteByte = #52; +void(float to, float f) WriteChar = #53; +void(float to, float f) WriteShort = #54; +void(float to, float f) WriteLong = #55; +void(float to, float f) WriteCoord = #56; +void(float to, float f) WriteAngle = #57; +void(float to, string s) WriteString = #58; +void(float to, entity s) WriteEntity = #59; +string(entity s) etos = #65; +void(float step) movetogoal = #67; +string(string s) precache_file = #68; // no effect except for -copy +void(entity e) makestatic = #69; +void(string s) changelevel = #70; +void(float step, vector origin) movetoorigin = #71; +void(string var, string val) cvar_set = #72; // sets cvar.value +void(entity client, string s) centerprint = #73; // sprint, but in middle +void(entity client, string s, string s) centerprint2 = #73; +void(entity client, string s, string s, string s) centerprint3 = #73; +void(entity client, string s, string s, string s, string s) centerprint4 = #73; +void(entity client, string s, string s, string s, string s, string s) centerprint5 = #73; +void(entity client, string s, string s, string s, string s, string s, string s) centerprint6 = #73; +void(entity client, string s, string s, string s, string s, string s, string s, string s) centerprint7 = #73; +void(vector pos, string samp, float vol, float atten) ambientsound = #74; +string(string s) precache_model2 = #75; // registered version only +string(string s) precache_sound2 = #76; // registered version only +string(string s) precache_file2 = #77; // registered version only +void(entity e) setspawnparms = #78; // set parm1... to the +void(vector start, vector min, vector max, vector end, float nomonsters, entity forent) tracebox = #90; +float(vector start, vector min, vector max, vector end, float nomonsters, entity forent) tracemove = #99; +entity (entity start, .float field, float match) findfloat = #98; +float(string s) stof = #81; // 2001-09-20 QuakeC string manipulation by FrikaC +vector(entity what) Get_Waypoint_Near = #83; +float(entity zombie, entity target) Do_Pathfind_psp = #84; +void(string s) Open_Waypoint = #85; +vector(entity zombie,vector start,vector min, vector max) Get_Next_Waypoint = #86; +void(entity client, float type, float cost, float weapon) useprint = #87; +vector(entity zombie,vector start,vector min, vector max) Get_First_Waypoint = #88; +void(string s) Close_Waypoint = #89; + +void(entity plr, float achievement) achievement = #79; + +void(string trackname) songegg = #500; +void() nzp_maxammo = #501; +/* +type 0 = clear +type 1 = buy door +type 2 = buy debris +type 3 = Buy ammo +type 4 = buy weapon +type 5 = repair window +type 6 = use box +type 7 = use trap +type 8 = require power +*/ + + +// 2001-09-20 QuakeC file access by FrikaC start +float(string filename, float mode) fopen = #110; +void(float fhandle) fclose = #111; +string(float fhandle) fgets = #112; +void(float fhandle, string s) fputs = #113; +// 2001-09-20 QuakeC file access by FrikaC end + +// 2001-09-20 QuakeC string manipulation by FrikaC start +float(string s) strlen = #114; +string(string s1, string s2) strcat = #115; +string(string s, float start, float length) substring = #116; +vector(string s) stov = #117; +string(string s) strzone = #118; +string(string s) strunzone = #119; +string(string s) strtrim = #120; +// 2001-09-20 QuakeC string manipulation by FrikaC end + +// 2001-11-15 DarkPlaces general builtin functions by Lord Havoc start +float(string s) tokenize = #441; +string(float num) argv = #442; +// 2001-11-15 DarkPlaces general builtin functions by Lord Havoc end + +// +// constants +// + +#define FALSE 0 +#define TRUE 1 + +// edict.flags +#define FL_FLY 1 +#define FL_SWIM 2 +#define FL_CLIENT 8 // set for all client edicts +#define FL_INWATER 16 // for enter / leave water splash +#define FL_MONSTER 32 +#define FL_GODMODE 64 // player cheat +#define FL_NOTARGET 128 // player cheat +#define FL_ITEM 256 // extra wide size for bonus items +#define FL_ONGROUND 512 // standing on something +#define FL_PARTIALGROUND 1024 // not all corners are valid +#define FL_WATERJUMP 2048 // player jumping out of water +//#define FL_JUMPRELEASED 4096 // for jump debouncing + +// edict.movetype values +#define MOVETYPE_NONE 0 // never moves +#define MOVETYPE_ANGLENOCLIP 1 +#define MOVETYPE_ANGLECLIP 2 +#define MOVETYPE_WALK 3 // players only +#define MOVETYPE_STEP 4 // discrete, not real time unless fall +#define MOVETYPE_FLY 5 +#define MOVETYPE_TOSS 6 // gravity +#define MOVETYPE_PUSH 7 // no clip to world, push and crush +#define MOVETYPE_NOCLIP 8 +#define MOVETYPE_FLYMISSILE 9 // fly with extra size against monsters +#define MOVETYPE_BOUNCE 10 +#define MOVETYPE_BOUNCEMISSILE 11 // bounce with extra size +#define MOVETYPE_FOLLOW 12 + +// edict.solid values +#define SOLID_NOT 0 // no interaction with other objects +#define SOLID_TRIGGER 1 // touch on edge, but not blocking +#define SOLID_BBOX 2 // touch on edge, block +#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground +#define SOLID_BSP 4 // bsp clip, touch on edge, block +#define SOLID_CORPSE 5 // bsp clip, touch on edge, block + +// range values +#define RANGE_MELEE 0 +#define RANGE_NEAR 1 +#define RANGE_MID 2 +#define RANGE_FAR 3 + +// deadflag values + +#define DEAD_NO 0 +#define DEAD_DYING 1 +#define DEAD_DEAD 2 +#define DEAD_RESPAWNABLE 3 + +// takedamage values + +#define DAMAGE_NO 0 +#define DAMAGE_YES 1 +#define DAMAGE_AIM 2 +#define DAMAGE_NOMARKER 3 + +/*.void() th_stand; +.void() th_walk; +.void() th_run; +.void(entity attacker, float damage) th_pain;*/ +.void() th_die; +//.void() th_missile; +.void() th_melee; + +// point content values + +#define CONTENT_EMPTY -1 +#define CONTENT_SOLID -2 +#define CONTENT_WATER -3 +#define CONTENT_SLIME -4 +#define CONTENT_LAVA -5 +#define CONTENT_SKY -6 + + +#define VEC_ORIGIN '0 0 0' + +//Standard Quake View Offset +//vector VEC_VIEW_OFS = '0 0 22'; + +//Half Life View Offset is 64 +//64 units above ground, for our purposes it's, 64 - (how low bounding box goes) +vector VEC_VIEW_OFS = '0 0 32'; + +//Standard Quake Hull +//vector VEC_HULL_MIN = '-16 -16 -24'; +//vector VEC_HULL_MAX = '16 16 32'; + +//Half Life 1 Hull Sizes ADDED BY BLUBS, COMMENTED ORIGINAL QUAKE BBOX SIZS OUT +#define VEC_HULL_MIN '-16 -16 -32' +#define VEC_HULL_MAX '16 16 40' + +#define VEC_HULL2_MIN '-32 -32 -24' +#define VEC_HULL2_MAX '32 32 64' + +// protocol bytes +#define SVC_BAD 0 +#define SVC_NOP 1 +#define SVC_DISCONNECT 2 +#define SVC_UPDATESTAT 3 +#define SVC_VERSION 4 +#define SVC_SETVIEW 5 +#define SVC_SOUND 6 +#define SVC_TIME 7 +#define SVC_PRINT 8 +#define SVC_STUFFTEXT 9 +#define SVC_SETANGLE 10 +#define SVC_SERVERINFO 11 +#define SVC_LIGHTSTYLE 12 +#define SVC_UPDATENAME 13 +#define SVC_UPDATEPOINTS 14 +#define SVC_CLIENTDATA 15 +#define SVC_STOPSOUND 16 +#define SVC_PARTICLE 18 +#define SVC_DAMAGE 19 +#define SVC_SPAWNSTATIC 20 +#define SVC_SPAWNBINARY 21 +#define SVC_SPAWNBASELINE 22 +#define SVC_TEMPENTITY 23 +#define SVC_SETPAUSE 24 +#define SVC_SIGNONNUM 25 +#define SVC_CENTERPRINT 26 +#define SVC_SPAWNSTATICSOUND 29 // 1998-08-08 Complete SVC list by Zhenga +#define SVC_INTERMISSION 30 +#define SVC_FINALE 31 +#define SVC_CDTRACK 32 +#define SVC_SELLSCREEN 33 +#define SVC_CUTSCENE 34 // 1998-08-08 Complete SVC list by Zhenga +#define SVC_WEAPONFIRE 35 +#define SVC_HITMARK 36 +#define SVC_USEPRINT 38 + +#define TE_SPIKE 0 +#define TE_SUPERSPIKE 1 +#define TE_GUNSHOT 2 +#define TE_EXPLOSION 3 +#define TE_TAREXPLOSION 4 +#define TE_LIGHTNING1 5 +#define TE_LIGHTNING2 6 +#define TE_WIZSPIKE 7 +#define TE_KNIGHTSPIKE 8 +#define TE_LIGHTNING3 9 +#define TE_LAVASPLASH 10 +#define TE_TELEPORT 11 +#define TE_RAYSPLASHGREEN 14 +#define TE_RAYSPLASHRED 15 + +// sound channels +// channel 0 never willingly overrides +// other channels (1-7) allways override a playing sound on that channel +#define CHAN_AUTO 0 +#define CHAN_WEAPON 1 +#define CHAN_VOICE 2 +#define CHAN_ITEM 3 +#define CHAN_BODY 4 +//Player uses channel 5 for all weapon reload sfx + +#define ATTN_NONE 0 +#define ATTN_NORM 1 +#define ATTN_IDLE 2 +#define ATTN_STATIC 3 + +// update types + +#define UPDATE_GENERAL 0 +#define UPDATE_STATIC 1 +#define UPDATE_BINARY 2 +#define UPDATE_TEMP 3 + +// entity effects + +#define EF_BLUE 1 +#define EF_MUZZLEFLASH 2 +#define EF_BRIGHTLIGHT 4 +#define EF_RED 8 +#define EF_ORANGELIGHT 16 +#define EF_GREEN 32 +#define EF_LIGHT 64 +#define EF_NODRAW 128 +#define EF_BRIGHTFIELD 256 +#define EF_FULLBRIGHT 512 +#define EF_DARKLIGHT 1024 +#define EF_DARKFIELD 2048 +#define EF_PURPLELIGHT 4096 +#define EF_RAYRED 8196 +#define EF_RAYGREEN 16384 + +// messages +#define MSG_BROADCAST 0 // unreliable to all +#define MSG_ONE 1 // reliable to one (msg_entity) +#define MSG_ALL 2 // reliable to all +#define MSG_INIT 3 // write to the init string + +#define AS_STRAIGHT 1 +#define AS_SLIDING 2 +#define AS_MELEE 3 +#define AS_MISSILE 4 + +// Quake assumes these are defined. + +//.string wad, map; +.float /*worldtype,*/ delay, wait, lip, /*light_lev,*/ speed, style/*, skill*/; +.string killtarget; +.void() think1; +.vector finaldest; +.vector pos1, pos2/*, mangle*/; + +void(vector o, vector d, float color, float count) particle = #48;// start a particle effect +void(string s) bprint_psp = #23; +void(entity client, string s) sprint_psp = #24; +// End + +void(string s) println = {bprint_psp(s);} //just when brain decided to think this is c +void(float ignore, string s) bprint = {bprint_psp(s);}; +void(entity client, float type, string s) sprint = {sprint_psp(client, s);}; +void(string s) print = {bprint_psp(s);}; + +//doors +.float state; +#define STATE_TOP 0 +#define STATE_BOTTOM 1 +#define STATE_UP 2 +#define STATE_DOWN 3 + +string mappath; +#define PRINT_HIGH 0 + +.float isspec; + +#define FILE_READ 0 +#define FILE_APPEND 1 +#define FILE_WRITE 2 + +#define MOVE_HITMODEL 0 // must be different for this engine! + +.float recoil_delay; +.float gravity; + +.float renderamt; +.float rendermode; +.vector rendercolor; +.string mapversion; +.float ammo; + +void(string com) SV_ParseClientCommand; + +.float currentHitBoxSetup; +.vector bbmins, bbmaxs; // Used for zombie hitboxes + +.float achievements; diff --git a/source/server/defs/custom.qc b/source/server/defs/custom.qc index 7104614..05ccb5d 100644 --- a/source/server/defs/custom.qc +++ b/source/server/defs/custom.qc @@ -27,8 +27,10 @@ #ifndef PSP #ifndef NX +#ifndef CTR #pragma target FTE #endif +#endif #endif #define true 1 @@ -215,10 +217,12 @@ void() SUB_Null2 = {}; #define VEC_VIEW_OFS '0 0 32' +#define MAX_ZOMB 24 + #ifdef PSP -#define MAX_ZOMB 12 -#else -#define MAX_ZOMB 24 +#ifdef CTR +#define MAX_ZOMB 12 +#endif #endif vector trace_plane_normal; diff --git a/source/server/dummies/ctr.qc b/source/server/dummies/ctr.qc new file mode 100644 index 0000000..f0898b9 --- /dev/null +++ b/source/server/dummies/ctr.qc @@ -0,0 +1,38 @@ +/* + server/dummies/generic.qc + + generic (all platform) dummys + + Copyright (C) 2021 NZ:P Team + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + +*/ + +void LoadWaypointData() = {}; + +// Old Demo defs +.float fogdogs; +.float MaxRange; +float gotdog; + +void(string chaptertitle, string location, string date, string person, entity who) WorldText = {}; + +void GiveAchievement(float achievement_id, optional entity who) = {}; + diff --git a/source/server/entities/doors.qc b/source/server/entities/doors.qc index d8bf37f..ab1e867 100644 --- a/source/server/entities/doors.qc +++ b/source/server/entities/doors.qc @@ -701,4 +701,4 @@ void() func_door_nzp = #ifdef PC HalfLife_DoRender(); #endif -}; +}; \ No newline at end of file diff --git a/source/server/entities/triggers.qc b/source/server/entities/triggers.qc index 7c5835f..6ea721d 100644 --- a/source/server/entities/triggers.qc +++ b/source/server/entities/triggers.qc @@ -134,6 +134,7 @@ void() InitTrigger = }; #ifndef PSP +#ifndef CTR entity last_act_trigger; void() trigger_activator_touch = { @@ -241,6 +242,7 @@ void() trigger_activator = self.touch = trigger_activator_touch; } #endif +#endif void() use_wall_weapon = { diff --git a/source/server/main.qc b/source/server/main.qc index 6acca8e..a96a68f 100644 --- a/source/server/main.qc +++ b/source/server/main.qc @@ -1,7 +1,7 @@ /* server/main.qc - mostly functions that will be called from the engine and are + mostly functions that will be called from the engine and are expected to exist Copyright (C) 2021 NZ:P Team @@ -97,8 +97,8 @@ void() StartFrame = } return; } - - + + if (roundinit) { Round_Core(); @@ -109,14 +109,14 @@ void() StartFrame = } else { entity SpawnedIn; SpawnedIn = find(world, classname, "player"); - + if (SpawnedIn) { entity getdog = find(world, classname, "spawn_dog"); if (getdog) gotdog = 1; - else + else gotdog = 0; - + updateDogRound(); InitRounds(); } @@ -124,10 +124,10 @@ void() StartFrame = } string(string s) precache_model = #20; -void() precaches = +void() precaches = { precache_model ("models/player.mdl"); - + #ifndef PSP #ifndef NX if (world.song != "") @@ -152,14 +152,14 @@ void() precaches = precache_model ("models/way/normal_way_door.spr"); precache_model ("models/way/way_jump.spr"); precache_model ("models/way/way_land.spr"); - + // zombie precache_model ("models/ai/zfull.mdl"); precache_model ("models/ai/zlarm.mdl"); precache_model ("models/ai/zrarm.mdl"); precache_model ("models/ai/zbod.mdl"); precache_model ("models/ai/zhead.mdl"); - + // zombie crawler precache_model ("models/ai/zcfull.mdl"); precache_model ("models/ai/zcbod.mdl"); @@ -177,14 +177,14 @@ void() precaches = precache_model ("models/weapons/knife/v_knife.mdl"); precache_model ("models/weapons/grenade/v_grenade.mdl"); precache_model ("models/weapons/grenade/g_grenade.mdl"); - precache_model ("models/weapons/grenade/g_betty.mdl"); + precache_model ("models/weapons/grenade/g_betty.mdl"); precache_model ("models/weapons/grenade/v_betty.mdl"); precache_model ("models/weapons/morphine/v_morphine.mdl"); // // Sounds // - + // player-made #ifdef PC precache_sound("sounds/player/footstep1.wav"); @@ -192,10 +192,10 @@ void() precaches = precache_sound("sounds/player/footstep3.wav"); precache_sound("sounds/player/footstep4.wav"); precache_sound("sounds/player/footstep5.wav"); -#endif // PC precache_sound("sounds/player/jump.wav"); precache_sound("sounds/player/land.wav"); precache_sound("sounds/player/pain4.wav"); +#endif // PC // weapons precache_sound("sounds/weapons/colt/magin.wav"); @@ -203,17 +203,17 @@ void() precaches = precache_sound("sounds/weapons/colt/shoot.wav"); precache_sound("sounds/weapons/colt/slide.wav"); precache_sound("sounds/weapons/papfire.wav"); - + // grenade precache_sound("sounds/weapons/grenade/prime.wav"); precache_sound("sounds/weapons/grenade/throw.wav"); precache_sound("sounds/weapons/grenade/explode.wav"); - + // melee precache_sound("sounds/weapons/knife/knife_hitbod.wav"); precache_sound("sounds/weapons/knife/knife.wav"); precache_sound("sounds/weapons/knife/knife_hit.wav"); - + // tunes precache_sound("sounds/rounds/eround.wav"); precache_sound("sounds/rounds/nround.wav"); @@ -225,7 +225,7 @@ void() precaches = precache_sound("sounds/misc/wood_door.wav"); precache_sound("sounds/misc/debris.wav"); precache_sound("sounds/misc/denybuy.wav"); - precache_sound("sounds/misc/what.wav"); + precache_sound("sounds/misc/what.wav"); // power-ups precache_sound ("sounds/pu/pickup.wav"); @@ -330,12 +330,12 @@ void() worldspawn = clientstat(STAT_FACINGENEMY, EV_FLOAT, facingenemy); clientstat(STAT_VIEWZOOM, EV_FLOAT, viewzoom); #endif - + mappath = strcat("maps/", mapname); mappath = strzone(mappath); LoadWaypointData(); - + //set game elements G_STARTPOINTS = 500; G_STARTROUND = 1; @@ -347,7 +347,7 @@ void() worldspawn = G_PERKS = 0; G_PERKPOWER = 0; load_nzd(); - + } void() SpectatorConnect = @@ -370,9 +370,9 @@ void() RelinkZombies = { if(ent.currentHitBoxSetup == 0)//empty bbox, we don't care to update continue; - + makevectors (ent.angles); - + for(i = 0; i < 3; i++) { if(i == 0) @@ -381,28 +381,28 @@ void() RelinkZombies = ent2 = ent.larm; if(i == 2) ent2 = ent.rarm; - - + + if (ent2) { //setorigin (ent.head, ent.origin + v_right * ent.head.view_ofs_x + v_forward * ent.head.view_ofs_y + v_up * ent.head.view_ofs_z); setorigin (ent2, ent.origin); //fixme, move angles set and frame set to below the continue, we only want to update origin (maybe angles too?) ent2.angles = ent.angles; - + if(ent2.deadflag) - ent2.frame = ent.frame; - + ent2.frame = ent.frame; + //if(OnlyOrigin) // continue; - + min = ent2.bbmins + (v_right * ent2.view_ofs_x) + (v_forward * ent2.view_ofs_y) + (v_up * ent2.view_ofs_z); max = ent2.bbmaxs + (v_right * ent2.view_ofs_x) + (v_forward * ent2.view_ofs_y) + (v_up * ent2.view_ofs_z); - + if(min_x > max_x) { min_x += max_x; max_x = min_x - max_x; min_x -= max_x; } if(min_y > max_y) { min_y += max_y; max_y = min_y - max_y; min_y -= max_y; } if(min_z > max_z) { min_z += max_z; max_z = min_z - max_z; min_z -= max_z; } - + setsize(ent2,min,max); } diff --git a/source/server/player.qc b/source/server/player.qc index d93aa3e..ce598dd 100644 --- a/source/server/player.qc +++ b/source/server/player.qc @@ -123,6 +123,7 @@ void() playgetup10 =[ 11, playgetup10 ] {self.frame = 48;} #define left 2 #define right 3 #define all_move -1 + float(float dir) checkMovement = { makevectors(self.movement); @@ -212,6 +213,7 @@ void(float override) JumpCheck = self.flags = self.flags | FL_JUMPRELEASED; } + void() PlayerPreThink = { if (self.downed) { @@ -520,8 +522,6 @@ void() PlayerSpawn = //custom weapon stuff (we want to put this here so we can send the info to the client with an entity) // DISGUSTING. //nzd_defineweapon(self); - - //centerprint(self, CustomWeapons[0].vmodel); entity who = find(world,classname,"player"); while(who != self && !self.playernum) diff --git a/source/server/psp_specifics.qc b/source/server/psp_specifics.qc index 1059f53..1e478e6 100644 --- a/source/server/psp_specifics.qc +++ b/source/server/psp_specifics.qc @@ -168,8 +168,6 @@ void() Soft_Restart = { power.frame = 0; } - - self = oldself; self.downed = 0; game_over = false; @@ -177,6 +175,12 @@ void() Soft_Restart = { self.score = 0; self.points = 0; self.secondaryweapon = 0; + + // naievil -- clear betty + self.secondary_grenades = 0; + self.grenades = 1; + self.pri_grenade_state = 0; + InitRounds(); self.isspec = false; PutClientInServer(); diff --git a/source/server/rounds.qc b/source/server/rounds.qc index 508c2e4..d9aebc0 100644 --- a/source/server/rounds.qc +++ b/source/server/rounds.qc @@ -28,7 +28,7 @@ float() spawn_a_dogA; void() zapper_cooldown; -void() Spawn_Enemy = +void() Spawn_Enemy = { // temporarily prevent spawning if (nuke_powerup_spawndelay > time) @@ -69,7 +69,7 @@ float() getZombieTotal = { multiplier *= rounds * 0.15; if (plrcnt == 1) - count += rint((0.5 * 6) * multiplier); + count += rint((0.5 * 6) * multiplier); else count += rint((plrcnt * 6) * multiplier); @@ -135,7 +135,7 @@ void() EndRound = if (rounds >= 10) { entity players; players = find(world, classname, "player"); - + while(players != world) { if (players.ach_tracker_npnp == 0) { GiveAchievement(5, players); @@ -152,7 +152,7 @@ void() EndRound = void() PlayerSpawn; void() NewRound = -{ +{ entity who = find(world,classname,"spectator"); while(who != world) { @@ -162,7 +162,7 @@ void() NewRound = PlayerSpawn(); break; } - + } entity tempe; @@ -216,7 +216,7 @@ void() NewRound = } set_z_health(); - + maxreward = 50 * rounds; if (maxreward > 500) maxreward = 500; @@ -225,13 +225,13 @@ void() NewRound = Current_Zombies = 0; spawn_delay = 0; totalpowerups = 0; - + if (rounds == dogRound && gotdog) { roundtype = 2; - localcmd("fog 0.25\n"); + localcmd("fog 0.25\n"); } else { roundtype = 1; - + if (world.fog) { #ifdef PSP localcmd(strcat("fog ", world.fog)); @@ -332,7 +332,7 @@ void() Round_Core = } void() InitRounds = -{ +{ roundtype = 1; delay_at_round = 2/0.95; totalpowerups = 0; diff --git a/source/server/weapons/weapon_core.qc b/source/server/weapons/weapon_core.qc index b4a6bb1..f02859f 100644 --- a/source/server/weapons/weapon_core.qc +++ b/source/server/weapons/weapon_core.qc @@ -590,9 +590,10 @@ void () W_LoadAmmo = } if (delay) { + if (self.perks & P_DOUBLE) delay *= 0.66; - + Set_W_Frame (startframe, endframe, delay, reloadcancelframe, FIRE, W_LoadAmmoDone, modelname, false, S_RIGHT); self.fire_delay = delay + time; } @@ -1038,7 +1039,7 @@ void(float side) W_FireGrenade = nade.velocity = v_forward*1000; nade.avelocity = '50 -50 50'; - centerprint(self, vtos(nade.angles)); + //centerprint(self, vtos(nade.angles)); nade.touch = GrenadeExplode; setsize(nade, '0 0 0', '0 0 0'); @@ -2109,7 +2110,7 @@ void () Impulse_Functions = W_SprintStop(); break; case 25: - #ifdef PSP + #if defined (PSP) || defined (CTR) switch_nade(); #else W_Betty(); @@ -2518,7 +2519,7 @@ void () Weapon_Logic = if (self.button6 && !self.semiknife) { - #ifdef PSP + #if defined (PSP) || defined (CTR) if (self.sprinting) { dolphin_dive(); return; diff --git a/source/shared/defs/custom.qc b/source/shared/defs/custom.qc index c2598cf..2307cf3 100644 --- a/source/shared/defs/custom.qc +++ b/source/shared/defs/custom.qc @@ -54,9 +54,11 @@ const float EVENT_ACHIEVEMENTPROGRESS = 36; // Define our PC version if we don't have NX or PSP #ifndef NX #ifndef PSP +#ifndef CTR #define PC #endif #endif +#endif //nzp weapon defines //id list diff --git a/source/shared/weapon_defines.qc b/source/shared/weapon_defines.qc index 6e95ca3..c482e1c 100644 --- a/source/shared/weapon_defines.qc +++ b/source/shared/weapon_defines.qc @@ -66,6 +66,7 @@ var struct { string(float wep) GetWeaponName = { + switch (wep) { case W_COLT: @@ -204,6 +205,7 @@ string(float perk) GetPerkName = float(float wep) GetFiretype = { + switch (wep) { case W_COLT: @@ -518,6 +520,7 @@ float(float wep, float type) getWeaponMultiplier = float(float wep) getWeaponMag = { + switch (wep) { case W_COLT: @@ -619,6 +622,7 @@ float(float wep) getWeaponMag = float(float wep) getWeaponAmmo = { + switch (wep) { case W_COLT: @@ -722,6 +726,7 @@ float(float wep) getWeaponAmmo = float(float wep) getWeaponDamage = { + switch (wep) { case W_COLT: @@ -819,6 +824,7 @@ float(float wep) getWeaponDamage = float(float wep) GetWeaponShotcount = { + switch(wep) { case W_DB: @@ -953,6 +959,7 @@ float(float wep, float penetration_times) getWeaponPenetration = float(float wep) GetWeaponSpread = { + switch (wep) { case W_COLT: @@ -1056,6 +1063,7 @@ float(float wep) GetWeaponSpread = float(float wep, float delaytype) getWeaponDelay = { + switch (wep) { case W_COLT: @@ -2443,6 +2451,7 @@ string(float wep, float gorvmodel) GetWeaponModel = string(float wep) GetWeapon2Model = { + switch (wep) { case W_BIATCH: @@ -2461,6 +2470,7 @@ string(float wep) GetWeapon2Model = string(float wep) GetWeaponSound = { + switch (wep) { case W_BIATCH: @@ -2540,6 +2550,7 @@ string(float wep) GetWeaponSound = } float(float wep) IsDualWeapon = { + switch(wep) { case W_BIATCH: return 1; @@ -2551,6 +2562,7 @@ float(float wep) IsDualWeapon = { } string(float wep) GetLeftWeaponModel = { + switch(wep) { case W_BIATCH: return "models/weapons/m1911/v_biatch_left.mdl"; @@ -2562,6 +2574,7 @@ string(float wep) GetLeftWeaponModel = { } float(float wep) IsPapWeapon = { + switch(wep) { case W_BIATCH: case W_ARMAGEDDON: @@ -2593,6 +2606,7 @@ float(float wep) IsPapWeapon = { } float(float wep) GetWepSkin = { + switch(wep) { case W_BIATCH: return 0; @@ -2610,6 +2624,7 @@ float(float wep) GetWepSkin = { float(float wep) EqualNonPapWeapon = { + switch (wep) { case W_BIATCH: return W_COLT; @@ -2673,6 +2688,7 @@ float(float wep) EqualNonPapWeapon = } float(float wep) EqualPapWeapon = { + switch (wep) { case W_COLT: return W_BIATCH; @@ -3051,6 +3067,7 @@ void (float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap void(float weptype) precache_extra = { + switch (weptype) { case W_COLT: case W_BIATCH: @@ -3242,6 +3259,7 @@ void(float weptype) precache_extra = float(float wep) getWeaponRecoilReturn = { + switch (wep) { case W_COLT: diff --git a/tools/qc-compiler-lin.sh b/tools/qc-compiler-lin.sh index 4570ab8..a2f5b2f 100755 --- a/tools/qc-compiler-lin.sh +++ b/tools/qc-compiler-lin.sh @@ -2,7 +2,7 @@ cd ../ # create build directories -mkdir -p build/{pc,psp,nx,vita} +mkdir -p build/{pc,psp,nx,vita,ctr} cd bin/ echo "" echo "====================" @@ -33,4 +33,10 @@ echo "====================" echo " compiling VITA QC " echo "====================" echo "" -./fteqcc-cli-lin -srcfile ../progs/vita.src \ No newline at end of file +./fteqcc-cli-lin -srcfile ../progs/vita.src +echo "" +echo "====================" +echo " compiling 3DS QC " +echo "====================" +echo "" +./fteqcc-cli-lin -srcfile ../progs/ctr.src diff --git a/tools/qc-compiler-win.bat b/tools/qc-compiler-win.bat index 8ae6eef..4e836dc 100644 --- a/tools/qc-compiler-win.bat +++ b/tools/qc-compiler-win.bat @@ -5,6 +5,7 @@ MKDIR build\pc\ 2>nul MKDIR build\psp\ 2>nul MKDIR build\nx\ 2>nul MKDIR build\vita\ 2>nul +MKDIR build\ctr\ 2>nul CD bin/ echo. echo ==================== @@ -36,4 +37,10 @@ echo compiling VITA QC echo ==================== echo. fteqcc-cli-win.exe -srcfile ../progs/vita.src +echo. +echo ==================== +echo compiling 3DS QC +echo ==================== +echo. +fteqcc-cli-win.exe -srcfile ../progs/ctr.src pause