diff --git a/.github/workflows/compile-and-release.yml b/.github/workflows/compile-and-release.yml index cb78ac2..28bc240 100644 --- a/.github/workflows/compile-and-release.yml +++ b/.github/workflows/compile-and-release.yml @@ -16,10 +16,9 @@ jobs: working-directory: ./build run: | zip -r -j pc-nzp-qc.zip pc/* - zip -r -j psp-nzp-qc.zip psp/* + zip -r -j handheld-nzp-qc.zip handheld/* 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')" @@ -42,19 +41,10 @@ jobs: This is a **bleeding edge** NZ:P QuakeC release, stability is not guarenteed and you may need to grab an updated asset release if this update depends on new models/textures/etc. To install: - - Grab the .ZIP archive for your desired platform below (*-nzp-qc.zip) + - Grab the .ZIP archive for your desired platform below (*-nzp-qc.zip, use `handheld-nzp-qc.zip` for 3DS and PSP). - 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: @@ -73,14 +63,14 @@ jobs: asset_path: ./build/pc-nzp-qc.zip asset_name: pc-nzp-qc.zip asset_content_type: application/zip - - name: Upload PSP QC + - name: Upload HANDHELD 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/psp-nzp-qc.zip - asset_name: psp-nzp-qc.zip + asset_path: ./build/handheld-nzp-qc.zip + asset_name: handheld-nzp-qc.zip asset_content_type: application/zip - name: Upload VITA QC uses: actions/upload-release-asset@v1 diff --git a/progs/fte-server.src b/progs/fte-server.src index b29b260..b2d0569 100644 --- a/progs/fte-server.src +++ b/progs/fte-server.src @@ -18,6 +18,7 @@ ../source/server/entities/sounds.qc ../source/server/entities/triggers.qc ../source/server/entities/explosive_barrel.qc +../source/server/entities/teleporter.qc ../source/server/entities/map_entities.qc ../source/server/entities/traps.qc ../source/server/entities/lights.qc diff --git a/progs/ctr.src b/progs/handheld.src similarity index 91% rename from progs/ctr.src rename to progs/handheld.src index d0ad387..f476da0 100644 --- a/progs/ctr.src +++ b/progs/handheld.src @@ -1,9 +1,8 @@ -../../build/ctr/progs.dat +../../build/handheld/progs.dat #pragma warning disable Q208 -../source/server/defs/ctr.qc -../source/server/dummies/ctr.qc +../source/server/defs/handheld.qc ../source/shared/defs/custom.qc ../source/shared/weapon_defines.qc ../source/server/defs/custom.qc @@ -23,6 +22,7 @@ ../source/server/entities/sounds.qc ../source/server/entities/triggers.qc ../source/server/entities/explosive_barrel.qc +../source/server/entities/teleporter.qc ../source/server/entities/map_entities.qc ../source/server/entities/traps.qc ../source/server/entities/lights.qc diff --git a/progs/nx.src b/progs/nx.src index 78b5f54..c42b28b 100644 --- a/progs/nx.src +++ b/progs/nx.src @@ -22,6 +22,7 @@ ../source/server/entities/sounds.qc ../source/server/entities/triggers.qc ../source/server/entities/explosive_barrel.qc +../source/server/entities/teleporter.qc ../source/server/entities/map_entities.qc ../source/server/entities/traps.qc ../source/server/entities/lights.qc diff --git a/progs/psp.src b/progs/psp.src deleted file mode 100644 index b04d1ae..0000000 --- a/progs/psp.src +++ /dev/null @@ -1,43 +0,0 @@ -../../build/psp/progs.dat - -#pragma warning disable Q208 - -../source/server/defs/psp.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/utilities/command_parser.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/progs/vita.src b/progs/vita.src index 9001a82..15a2511 100644 --- a/progs/vita.src +++ b/progs/vita.src @@ -22,6 +22,7 @@ ../source/server/entities/sounds.qc ../source/server/entities/triggers.qc ../source/server/entities/explosive_barrel.qc +../source/server/entities/teleporter.qc ../source/server/entities/map_entities.qc ../source/server/entities/traps.qc ../source/server/entities/lights.qc diff --git a/source/server/ai/ai_core.qc b/source/server/ai/ai_core.qc index 97fbc79..56c40f6 100644 --- a/source/server/ai/ai_core.qc +++ b/source/server/ai/ai_core.qc @@ -88,7 +88,7 @@ entity(entity blarg) find_new_enemy = while(targets != world) { // Don't target downed players. - if (targets.downed == true) { + if (targets.downed == true || targets.isspec == true) { targets = find(targets, classname, "player"); continue; } diff --git a/source/server/ai/crawler_core.qc b/source/server/ai/crawler_core.qc index cccf019..e7ccf9c 100644 --- a/source/server/ai/crawler_core.qc +++ b/source/server/ai/crawler_core.qc @@ -248,17 +248,23 @@ void(entity who) makeCrawler = if(who.head.deadflag) { setmodel(who.head,"models/ai/zhc^.mdl"); - //updateLimb (who, 0, world); + #ifndef PC + updateLimb (who, 0, world); + #endif } if(who.larm.deadflag) { setmodel(who.larm,"models/ai/zalc(.mdl"); - //updateLimb (who, 1, world); + #ifndef PC + updateLimb (who, 1, world); + #endif } if(who.rarm.deadflag) { setmodel(who.rarm,"models/ai/zarc(.mdl"); - //updateLimb (who, 2, world); + #ifndef PC + updateLimb (who, 2, world); + #endif } who.crawling = 1; diff --git a/source/server/clientfuncs.qc b/source/server/clientfuncs.qc index 7d83bab..9f79407 100644 --- a/source/server/clientfuncs.qc +++ b/source/server/clientfuncs.qc @@ -1,7 +1,7 @@ /* server/clientfuncs.qc - used to communicate between server and client + Used to communicate between server and client Copyright (C) 2021-2022 NZ:P Team @@ -27,9 +27,8 @@ void SetUpdate(entity client, float type, float val1, float val2, float val3) { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR if (type != 2) { @@ -54,12 +53,10 @@ void SetUpdate(entity client, float type, float val1, float val2, float val3) } #endif #endif - #endif } -#ifndef PSP +#ifndef HANDHELD #ifndef NX -#ifndef CTR void(entity to, float type, float cost, float weapon) useprint = { WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_USEPRINT); @@ -71,7 +68,6 @@ void(entity to, float type, float cost, float weapon) useprint = { } #endif #endif -#endif void(vector org) CallExplosion = { #ifndef PC @@ -91,9 +87,8 @@ void(vector org) CallExplosion = { } void NotifyNewRound(float to) { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_NEWROUND); @@ -102,13 +97,11 @@ void NotifyNewRound(float to) { #endif #endif - #endif } void SetRound(entity client, float to) { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_SETROUND); @@ -118,14 +111,12 @@ void SetRound(entity client, float to) { #endif #endif - #endif } void SetPerk(entity client, float to) { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_PERK); @@ -135,14 +126,12 @@ void SetPerk(entity client, float to) #endif #endif - #endif } void(float to) SwitchWeapon = { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_WEAPONCHANGE); @@ -155,14 +144,12 @@ void(float to) SwitchWeapon = #endif #endif - #endif } void(string to, float skin) UpdateVmodel = { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_UPDATEVMODEL); @@ -173,14 +160,12 @@ void(string to, float skin) UpdateVmodel = #endif #endif - #endif } void(string to, float skin) UpdateV2model = { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_UPDATEV2MODEL); @@ -190,14 +175,12 @@ 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 HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_BROADCAST); WriteByte(MSG_MULTICAST, broadcast_time); @@ -206,14 +189,12 @@ 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 HANDHELD #ifndef NX - #ifndef CTR if (player_count == 0) { WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_POINTUPDATE); @@ -238,13 +219,11 @@ void(float playernum, float points, float am, float kills, string name, entity p #endif #endif - #endif } void(float count) UpdatePlayerCount = { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR if (count == 0) return; else { @@ -256,14 +235,12 @@ void(float count) UpdatePlayerCount = { #endif #endif - #endif } void(float newtime, float newtype, entity change) PromptLevelChange = { - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_BLACKOUT); @@ -274,16 +251,14 @@ void(float newtime, float newtype, entity change) PromptLevelChange = #endif #endif - #endif } void(entity who) UpdatePunchangle = { // naievil -- shit logic lol...but result looks clean as fuck... - #ifndef PSP + #ifndef HANDHELD #ifndef NX - #ifndef CTR WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, EVENT_PUNCHANGLE); WriteCoord(MSG_MULTICAST, who.punchangle_x); @@ -326,12 +301,10 @@ void(entity who) UpdatePunchangle = #endif #endif - #endif } -#ifndef PSP +#ifndef HANDHELD #ifndef NX -#ifndef CTR void(string h, float h2, entity who) pushHUD = { if (player_count == 0) { WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); @@ -422,22 +395,20 @@ 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 +#ifndef PC // temp if (achievement_id > 4) return; -#endif // PSP +#endif // PC // this is an achievement specific to an individual if ((who && who != world) || player_count == 0) { if (player_count == 0) who = find(world, classname, "player"); -#ifdef PSP +#ifndef PC achievement(who, achievement_id); #else WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); @@ -445,9 +416,9 @@ void (float achievement_id, optional entity who) GiveAchievement = WriteByte(MSG_MULTICAST, achievement_id); msg_entity = who; multicast('0 0 0', MULTICAST_ONE); -#endif // PSP +#endif // PC } else { -#ifdef PSP +#ifndef PC entity players; players = find(world, classname, "player"); while(players != world) { @@ -459,21 +430,21 @@ void (float achievement_id, optional entity who) GiveAchievement = WriteByte(MSG_MULTICAST, EVENT_ACHIEVEMENT); WriteByte(MSG_MULTICAST, achievement_id); multicast('0 0 0', MULTICAST_ALL); -#endif // PSP +#endif // PC } } void (float achievement_id, float progress_value, optional entity who) UpdateAchievementProgress = { -#ifdef PSP +#ifndef PC // temp if (achievement_id > 4) return; -#endif // PSP +#endif // PC // this is a progress update specific to an individual if ((who && who != world) || player_count == 0) { if (player_count == 0) who = find(world, classname, "player"); -#ifdef PSP +#ifndef PC //achievement_progress(who, achievement_id, progress_value); #else WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); @@ -482,9 +453,9 @@ void (float achievement_id, float progress_value, optional entity who) UpdateAch WriteFloat(MSG_MULTICAST, progress_value); msg_entity = who; multicast('0 0 0', MULTICAST_ONE); -#endif // PSP +#endif // PC } else { -#ifdef PSP +#ifndef PC entity players; players = find(world, classname, "player"); while(players != world) { @@ -497,10 +468,9 @@ void (float achievement_id, float progress_value, optional entity who) UpdateAch WriteByte(MSG_MULTICAST, achievement_id); WriteFloat(MSG_MULTICAST, progress_value); multicast('0 0 0', MULTICAST_ALL); -#endif // PSP +#endif // PC } } -#endif // CTR #endif // NX // ***************************************** @@ -521,7 +491,7 @@ float(entity who, entity target) isFacing = float difference_angle = target_angle - who_angle; - #ifdef PSP + #ifdef HANDHELD if (difference_angle < -45) { difference_angle += 360; } @@ -677,4 +647,4 @@ float(float weapon) Util_WeaponFiresTraceshot = return true; return false; -} \ No newline at end of file +} diff --git a/source/server/damage.qc b/source/server/damage.qc index d5c8ef8..3fc49e0 100644 --- a/source/server/damage.qc +++ b/source/server/damage.qc @@ -176,7 +176,7 @@ void() EndGameSetup = void() rec_downed = { self.downedloop++; - if (self.downedloop == 300) { + if (self.downedloop >= 300) { startspectate(); return; } @@ -258,6 +258,7 @@ void() GetDown = Util_PlayerHasWeapon(self, W_357, true)) { float weapon_slot; float total_ammo; + total_ammo = 0; weapon_slot = Util_PlayerHasWeapon(self, W_RAY, true); if (weapon_slot == 0) weapon_slot = Util_PlayerHasWeapon(self, W_BIATCH, false); diff --git a/source/server/defs/ctr.qc b/source/server/defs/ctr.qc deleted file mode 100644 index 2537097..0000000 --- a/source/server/defs/ctr.qc +++ /dev/null @@ -1,541 +0,0 @@ -/* -+----+ -|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; -//.float scale; -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 05ccb5d..05566ad 100644 --- a/source/server/defs/custom.qc +++ b/source/server/defs/custom.qc @@ -25,13 +25,11 @@ */ -#ifndef PSP #ifndef NX -#ifndef CTR +#ifndef HANDHELD #pragma target FTE -#endif -#endif -#endif +#endif // HANDHELD +#endif // NX #define true 1 #define false 0 @@ -219,8 +217,8 @@ void() SUB_Null2 = {}; #define MAX_ZOMB 24 -#ifdef PSP -#ifdef CTR +#ifndef PC +#ifndef NX #define MAX_ZOMB 12 #endif #endif @@ -372,11 +370,11 @@ entity boxLocations[32]; float boxCount; vector boxOrigin; -#ifndef PSP +#ifndef HANDHELD //powerups .float x2_icon; .float insta_icon; -#endif +#endif // HANDHELD .string powerup_vo; float instakill_finished; float insta_blink; @@ -502,6 +500,7 @@ float sndActivCnt; .float tpTimer; .float isTimed; .entity host; +.entity entities[4]; // GIBBING #ifdef PC diff --git a/source/server/defs/psp.qc b/source/server/defs/handheld.qc similarity index 99% rename from source/server/defs/psp.qc rename to source/server/defs/handheld.qc index ed3ca0d..2368ea5 100644 --- a/source/server/defs/psp.qc +++ b/source/server/defs/handheld.qc @@ -13,7 +13,7 @@ +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ */ -#define PSP +#define HANDHELD // These lines CANNOT be altered/moved entity self; diff --git a/source/server/dummies/ctr.qc b/source/server/dummies/ctr.qc deleted file mode 100644 index f0898b9..0000000 --- a/source/server/dummies/ctr.qc +++ /dev/null @@ -1,38 +0,0 @@ -/* - 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/dummies/generic.qc b/source/server/dummies/generic.qc index 578700c..b18d107 100644 --- a/source/server/dummies/generic.qc +++ b/source/server/dummies/generic.qc @@ -77,7 +77,7 @@ void() change_frame = self.nextthink = time + 1; } -#ifdef PSP +#ifdef HANDHELD void LoadWaypointData() = {}; #endif diff --git a/source/server/entities/doors.qc b/source/server/entities/doors.qc index ab1e867..b0be49c 100644 --- a/source/server/entities/doors.qc +++ b/source/server/entities/doors.qc @@ -605,7 +605,7 @@ void() func_door = void() func_door_nzp = { - #ifdef PSP + #ifdef HANDHELD if (!self.renderamt) self.renderamt = 255; diff --git a/source/server/entities/machines.qc b/source/server/entities/machines.qc index a33c459..5c1e851 100644 --- a/source/server/entities/machines.qc +++ b/source/server/entities/machines.qc @@ -1856,7 +1856,7 @@ void PapUpgrade(entity pap, entity buyer) { //////////////////////////////////////// self.fire_delay = self.reload_delay = 4.5 + time; - sound(self,CHAN_WEAPON,"sounds/machines/papsound.wav",1,ATTN_NONE); + sound(self,CHAN_WEAPON,"sounds/machines/papsound.wav",1,ATTN_NORM); pap.weapon = self.weapon; diff --git a/source/server/entities/map_entities.qc b/source/server/entities/map_entities.qc index 26bb723..f50ccce 100644 --- a/source/server/entities/map_entities.qc +++ b/source/server/entities/map_entities.qc @@ -225,7 +225,7 @@ void() place_fire = void() place_model = { - #ifdef PSP + #ifdef HANDHELD if (self.spawnflags & 2) remove(self); #endif @@ -521,16 +521,21 @@ void() buy_weapon_link_target = void() buy_weapon = { - local string weaponname; + string weaponname; InitTrigger (); + weaponname = GetWeaponModel (self.weapon, 0); if (weaponname != "") precache_model (weaponname); - weaponname = GetWeaponModel(self.weapon, 1); + + // Use the grenade bag instead for nades + if (self.weapon == W_GRENADE) + weaponname = "models/props/grenade_bag.mdl"; + else + weaponname = GetWeaponModel(self.weapon, 1); if (weaponname != "") precache_model (weaponname); - precache_extra (self.weapon); self.touch = buy_weapon_touch; @@ -652,252 +657,6 @@ void() trigger_song = { sndTriggerCnt++; } -/* - ============ - Teleporter - ============ - - Teleporters have 3 different modes - - 0: Default Patch 1.0.4 Mode - - Interact with teleporter and go to pad (credit: Naievil and PerikiyoXD) - - 1: Linked Mode - - One-Time-Link teleporter with pad, teleport to pad - - 2: Timed Mode - - Link teleporter with pad, teleport to other destination - for a set amount of time, then return to pad. Link every time. - - TODO: - - Sounds - - Keep track of whether player is touching instead of locking movement -*/ - -void() teleporter_cooldown = -{ - self.activated = false; - - if (self.mode == 2) { - self.isLinked = false; - } - - self.cooldown = false; -} - -void() start_cooldown = -{ - self.cooldown = true; - self.think = teleporter_cooldown; - self.nextthink = time + 5; -} - -void() teleport_entity = -{ - local entity who, en; - - who = find(world, classname ,"player"); - en = find(world, targetname, self.target2); - - - SUB_UseTargets (); - - setorigin (who, who.tele_target.origin); - - if (self.isTimed || en.classname == "func_teleporter_pad") { - setorigin(who, who.origin + '0 0 40'); - } - - who.fire_delay = who.reload_delay = 3.0 + time; - who.zoom = 0; - who.weaponmodel = ""; - who.weapon2model = ""; - who.movetype = MOVETYPE_WALK; - - if (who.classname == "player") { - if (who.flags & FL_ONGROUND) - who.flags = who.flags - FL_ONGROUND; - who.velocity = v_forward * 0; - - } - - who.flags = who.flags - who.flags & FL_ONGROUND; - - if (self.mode == 0) { - self.activated = false; - } else if (self.mode == 2 && !self.isTimed) { - who.tele_target = find(world, targetname, self.target2); - - self.nextthink = time + self.tpTimer; - self.think = teleport_entity; - self.isTimed = true; - } else { - start_cooldown(); - self.isTimed = false; - } -} - -void() teleport_pad_touch = -{ - if (other.classname != "player" || self.host.isLinked) - return; - - if (!isPowerOn) { - useprint(other, 8, 0, 0); - return; - } - - if (self.host.waitLink) { - useprint(other, 19, 0, 0); - - if (other.button7) { - self.host.isLinked = true; - self.host.waitLink = false; - } - } else { - if (self.host.mode == 2) { - useprint(other, 18, 0, 0); - } - } -} - -void() teleporter_link_touch = -{ - - if (!self.waitLink) - useprint(other, 17, 0, 0); - - if (other.button7) { - local entity en; - - en = find(world, targetname, self.target2); - self.waitLink = true; - en.host = self; - } -} - -void() teleport_touch = -{ - if (self.cooldown) { - useprint(other, 16, 0, 0); - return; - } - - if (other.classname != "player" || self.activated) - return; - - if (!isPowerOn) { - useprint(other, 8, 0, 0); - return; - } - - if (self.mode != 0 && !self.isLinked) { - teleporter_link_touch(); - return; - } - - if (!self.cost) - useprint(other, 14, 0, 0); - else - useprint(other, 15, self.cost, 0); - - - if (other.button7) { - - if (other.points < self.cost) { - centerprint(other, STR_NOTENOUGHPOINTS); - return; - } - - addmoney(other, -self.cost, 0); - - SUB_UseTargets(); - other.tele_target = find(world, targetname, self.target); - - if (!other.tele_target) - objerror("Couldn't find target!"); - - self.activated = true; - - other.movetype = MOVETYPE_NONE; - - self.think = teleport_entity; - self.nextthink = time + 3; - } - - if (other.button1) { - if (self.targetname) { - if (self.nextthink < time) - return; // not fired yet - } - } -} - -void() teleport_use = -{ - self.nextthink = time + 2; - force_retouch = 2; // make sure even still objects get hit - self.think = SUB_Null; -} - -void() func_teleporter_entrance = -{ - precache_model ("models/props/teleporter.mdl"); - - self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything - self.solid = SOLID_TRIGGER; - self.classname = "func_teleporter_entrance"; - setmodel(self, "models/props/teleporter.mdl"); - setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); - - self.touch = teleport_touch; - - // find the destination - if (!self.target) - objerror("No target!"); - - if (self.mode != 0) { - if (!self.target2) - objerror("No mainframe!"); - - if (self.mode == 2) { - local entity tempe; - tempe = find(world, targetname, self.target2); - tempe.host = self; - } - } - - self.use = teleport_use; -} - -void() func_teleporter_destination = -{ - // this does nothing, just serves as a target spot - self.origin = self.origin + '0 0 40'; - self.classname = "func_teleporter_destination"; -} - -void() func_teleporter_timed = -{ - // this does nothing, just serves as a target spot - self.origin = self.origin + '0 0 40'; - self.classname = "func_teleporter_timed"; -} - - -void() func_teleporter_pad = -{ - precache_model ("models/props/mainframe_pad.mdl"); - - self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything - self.solid = SOLID_TRIGGER; - self.classname = "func_teleporter_pad"; - setmodel(self, "models/props/mainframe_pad.mdl"); - setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); - - self.touch = teleport_pad_touch; -} - /* ================ Buyable Ending ================ */ diff --git a/source/server/entities/powerups.qc b/source/server/entities/powerups.qc index 094eb3d..f72750e 100644 --- a/source/server/entities/powerups.qc +++ b/source/server/entities/powerups.qc @@ -419,7 +419,7 @@ void() PU_MaxAmmo = #ifdef PC ScrollText("MAX AMMO!", tempe); #endif - #ifdef PSP + #ifdef HANDHELD nzp_maxammo(); #endif tempe = find(tempe, classname, "player"); diff --git a/source/server/entities/sounds.qc b/source/server/entities/sounds.qc index 89b7f14..053a955 100644 --- a/source/server/entities/sounds.qc +++ b/source/server/entities/sounds.qc @@ -69,7 +69,7 @@ void () ambient_generic = { local string link; - // moto - FIXME: typically this is set to upper-case but NX and PSP lack strtoupper(); assume lower-case! + // moto - FIXME: typically this is set to upper-case but NX and HANDHELD lack strtoupper(); assume lower-case! link = self.message; if (link == "nolink") { diff --git a/source/server/entities/teleporter.qc b/source/server/entities/teleporter.qc new file mode 100644 index 0000000..26d6584 --- /dev/null +++ b/source/server/entities/teleporter.qc @@ -0,0 +1,407 @@ +/* + server/entities/teleporter.qc + + all logic for teleporters of every form. + + Copyright (C) 2021-2022 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 +*/ + +/* + ============ + Teleporter + ============ + + Teleporters have 3 different modes + + 0: Default Patch 1.0.4 Mode + - Interact with teleporter and go to pad (credit: Naievil and PerikiyoXD) + + 1: Linked Mode + - One-Time-Link teleporter with pad, teleport to pad + + 2: Timed Mode + - Link teleporter with pad, teleport to other destination + for a set amount of time, then return to pad. Link every time. + + TODO: + - Sounds + - Keep track of whether player is touching instead of locking movement +*/ + +void() teleporter_cooldown = +{ + self.activated = false; + + if (self.mode == 2) { + self.isLinked = false; + } + + self.cooldown = false; +} + +void() start_cooldown = +{ + self.cooldown = true; + self.think = teleporter_cooldown; + self.nextthink = time + 5; +} + +void() teleport_entities_back = +{ + entity en, player; + en = find(world, targetname, self.target2); + + SUB_UseTargets(); + self.iszomb = 0; + + bprint(PRINT_HIGH, "returning\n"); + + for(float i = 0; i < 4; i++) { + if (self.entities[i].classname == "player") { + player = self.entities[i]; + + setorigin(player, en.origin); + + if (self.isTimed || en.classname == "func_teleporter_pad") { + setorigin(player, player.origin + '0 0 40'); + } + + switch(self.iszomb) { + case 0: + player.origin += '20 0 0'; + break; + case 1: + player.origin -= '20 0 0'; + break; + case 2: + player.origin += '0 20 0'; + break; + case 3: + player.origin -= '0 20 0'; + break; + default: + break; + } + + player.fire_delay = player.fire_delay2 = + player.reload_delay = player.reload_delay2 = + 3.0 + time; + + player.zoom = 0; + player.weaponmodel = player.weapon2model = ""; + player.movetype = MOVETYPE_WALK; + + if (player.flags & FL_ONGROUND) { + player.flags -= FL_ONGROUND; + player.velocity = v_forward * 0; + } + + player.flags -= (player.flags & FL_ONGROUND); + + if (self.mode == 0) + self.activated = false; + + self.iszomb++; + } + } + + self.iszomb = 0; + start_cooldown(); + self.isTimed = false; +} + +void(entity who) teleport_entity = +{ + entity en; + en = find(world, targetname, self.target2); + + + SUB_UseTargets (); + + setorigin (who, who.tele_target.origin); + + if (self.isTimed || en.classname == "func_teleporter_pad") { + setorigin(who, who.origin + '0 0 40'); + } + + switch(self.iszomb) { + case 0: + who.origin += '20 0 0'; + break; + case 1: + who.origin -= '20 0 0'; + break; + case 2: + who.origin += '0 20 0'; + break; + case 3: + who.origin -= '0 20 0'; + break; + default: + bprint(PRINT_HIGH, "cheater!!\n"); + break; + } + + who.fire_delay = who.fire_delay2 = who.reload_delay = who.reload_delay2 = 3.0 + time; + who.zoom = 0; + who.weaponmodel = ""; + who.weapon2model = ""; + who.movetype = MOVETYPE_WALK; + + if (who.flags & FL_ONGROUND) { + who.flags = who.flags - FL_ONGROUND; + who.velocity = v_forward * 0; + } + + who.flags = who.flags - who.flags & FL_ONGROUND; +} + +void() teleport_entities = +{ + // Store all of the players + entity people = findradius(self.origin, self.stance); + float i = 0; + + self.entities[0] = world; + self.entities[1] = world; + self.entities[2] = world; + self.entities[3] = world; + + while(people != world) { + if (people.classname == "player") { + self.entities[i] = people; + i++; + teleport_entity(people); + self.iszomb++; + } + people = people.chain; + } + self.iszomb = 0; + + if (self.mode == 0) { + self.activated = false; + } else if (self.mode == 2 && !self.isTimed) { + self.nextthink = time + self.tpTimer; + self.think = teleport_entities_back; + self.isTimed = true; + } else { + start_cooldown(); + self.isTimed = false; + } +} + +void() teleport_pad_touch = +{ + if (other.classname != "player" || self.host.isLinked) + return; + + if (!isPowerOn) { + useprint(other, 8, 0, 0); + return; + } + + if (self.host.waitLink) { + useprint(other, 19, 0, 0); + + if (other.button7) { + self.host.isLinked = true; + self.host.waitLink = false; + } + } else { + if (self.host.mode == 2) { + useprint(other, 18, 0, 0); + } + } +} + +void() teleporter_link_touch = +{ + + if (!self.waitLink) + useprint(other, 17, 0, 0); + + if (other.button7) { + local entity en; + + en = find(world, targetname, self.target2); + self.waitLink = true; + en.host = self; + } +} + +void() teleport_touch = +{ + if (self.cooldown) { + useprint(other, 16, 0, 0); + return; + } + + if (other.classname != "player" || self.activated) + return; + + if (!isPowerOn) { + useprint(other, 8, 0, 0); + return; + } + + if (self.mode != 0 && !self.isLinked) { + teleporter_link_touch(); + return; + } + + if (!self.cost) + useprint(other, 14, 0, 0); + else + useprint(other, 15, self.cost, 0); + + + if (other.button7) { + + if (other.points < self.cost) { + centerprint(other, STR_NOTENOUGHPOINTS); + return; + } + + addmoney(other, -self.cost, 0); + + SUB_UseTargets(); + + self.activated = true; + + entity people = findradius(self.origin, self.stance); + while (people != world) { + if (people.classname == "player") { + people.tele_target = find(world, targetname, self.target); + people.movetype = MOVETYPE_NONE; + } + people = people.chain; + } + + if (!other.tele_target) + objerror("Couldn't find target!"); + + self.think = teleport_entities; + self.nextthink = time + 3; + } + + if (other.button1) { + if (self.targetname) { + if (self.nextthink < time) + return; // not fired yet + } + } +} + +void() teleport_use = +{ + self.nextthink = time + 2; + force_retouch = 2; // make sure even still objects get hit + self.think = SUB_Null; +} + +// +// func_teleporter_entrance() +// Spawn function for the main teleporter. +// +void() func_teleporter_entrance = +{ + // + // Set Default Stats for Compatibility + // + + // Model + if (!self.model) { + self.model = "models/props/teleporter.mdl"; + } + + // Radius + if (!self.stance) { + self.stance = 75; + } + + precache_model(self.model); + + self.movetype = MOVETYPE_NONE; + self.solid = SOLID_TRIGGER; + self.classname = "func_teleporter_entrance"; + setmodel(self, self.model); + setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); + + self.touch = teleport_touch; + + // Verify the User has teleporter targets set. + if (!self.target) + objerror("No target!"); + + if (self.mode != 0) { + if (!self.target2) + objerror("No mainframe!"); + + if (self.mode == 2) { + entity tempe; + tempe = find(world, targetname, self.target2); + tempe.host = self; + } + } + + self.use = teleport_use; +} + +// +// func_teleporter_destination() +// Empty Entity to use as a destination for standard +// teleporter modes. +// +void() func_teleporter_destination = +{ + // this does nothing, just serves as a target spot + self.origin = self.origin + '0 0 40'; + self.classname = "func_teleporter_destination"; +} + +// +// func_teleporter_timed() +// Empty Entity to use as a destination for time-based +// teleporter modes. +// +void() func_teleporter_timed = +{ + self.origin = self.origin + '0 0 40'; + self.classname = "func_teleporter_timed"; +} + +// +// func_teleporter_pad() +// Teleporter Pad that's often used as a Link Point +// or Return Point. +// +void() func_teleporter_pad = +{ + precache_model ("models/props/mainframe_pad.mdl"); + + self.movetype = MOVETYPE_NONE; + self.solid = SOLID_TRIGGER; + self.classname = "func_teleporter_pad"; + setmodel(self, "models/props/mainframe_pad.mdl"); + setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); + + self.touch = teleport_pad_touch; +} diff --git a/source/server/entities/traps.qc b/source/server/entities/traps.qc index 02ff5a8..590d173 100644 --- a/source/server/entities/traps.qc +++ b/source/server/entities/traps.qc @@ -122,7 +122,7 @@ void zapper_play () { #ifdef PC te_lightning2(self, self.origin, zents.origin); #endif - #ifdef PSP + #ifdef HANDHELD WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, TE_LIGHTNING2); WriteEntity (MSG_BROADCAST, self); diff --git a/source/server/entities/triggers.qc b/source/server/entities/triggers.qc index 6ea721d..8137db9 100644 --- a/source/server/entities/triggers.qc +++ b/source/server/entities/triggers.qc @@ -133,8 +133,7 @@ void() InitTrigger = self.model = ""; }; -#ifndef PSP -#ifndef CTR +#ifndef HANDHELD entity last_act_trigger; void() trigger_activator_touch = { @@ -242,7 +241,6 @@ void() trigger_activator = self.touch = trigger_activator_touch; } #endif -#endif void() use_wall_weapon = { @@ -256,7 +254,10 @@ void() use_wall_weapon = newent.solid=SOLID_NOT; newent.classname = "wall_weapon"; setorigin(newent, self.origin); - setmodel (newent, GetWeaponModel(self.sequence + 1, 1)); + if (self.sequence + 1 != 26) + setmodel (newent, GetWeaponModel(self.sequence + 1, 1)); + else + setmodel(newent, "models/props/grenade_bag.mdl"); setsize (newent, VEC_HULL2_MIN, VEC_HULL2_MAX); newent.angles = self.angles; @@ -274,6 +275,7 @@ void() weapon_wall = self.frame = self.sequence; self.use = use_wall_weapon; self.classname = "weapon_wall"; + self.effects = EF_FULLBRIGHT; //self.effects = EF_WEPLIGHT; } diff --git a/source/server/entities/window.qc b/source/server/entities/window.qc index 045bdaf..2c44d65 100644 --- a/source/server/entities/window.qc +++ b/source/server/entities/window.qc @@ -50,7 +50,7 @@ void() screen_shake = else zoom_factor = 1; - #ifdef PSP + #ifdef HANDHELD self.enemy.punchangle_y = r * 8 * zoom_factor; self.enemy.punchangle_x = (4 + (s * 4)) * zoom_factor; #else diff --git a/source/server/main.qc b/source/server/main.qc index ec20693..6b97d62 100644 --- a/source/server/main.qc +++ b/source/server/main.qc @@ -128,7 +128,7 @@ void() precaches = { precache_model ("models/player.mdl"); - #ifndef PSP + #ifndef HANDHELD #ifndef NX if (world.song != "") precache_sound (world.song); diff --git a/source/server/player.qc b/source/server/player.qc index 72ef6e9..2e18fb5 100644 --- a/source/server/player.qc +++ b/source/server/player.qc @@ -523,10 +523,6 @@ void() PlayerSpawn = self.movetype = MOVETYPE_WALK; self.max_health = self.health = 100; - //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); - entity who = find(world,classname,"player"); while(who != self && !self.playernum) { @@ -625,9 +621,6 @@ void() PlayerSpawn = rounds = G_STARTROUND - 1; } - #ifndef PSP - //pushHUD(G_HUD, G_HUDHOR, self); //FIXME - breaks mp! - #endif }; void() SpectatorSpawn = diff --git a/source/server/rounds.qc b/source/server/rounds.qc index d9aebc0..c9e0cb4 100644 --- a/source/server/rounds.qc +++ b/source/server/rounds.qc @@ -119,8 +119,21 @@ void() updateDogRound = } } +void() PlayerSpawn; + void() EndRound = { + entity who = find(world,classname,"spectator"); + while(who != world) + { + if(who.isspec) + { + self = who; + PlayerSpawn(); + } + who = find(who, classname, "spectator"); + } + rounds_change = 4; SetUpdate(self, UT_ROUNDS_CHANGE, rounds_change, 0, 0); if (gotdog && rounds == dogRound) { @@ -149,22 +162,8 @@ void() EndRound = } } -void() PlayerSpawn; - void() NewRound = { - entity who = find(world,classname,"spectator"); - while(who != world) - { - if(who.isspec) - { - self = who; - PlayerSpawn(); - break; - } - - } - entity tempe; round_changetime = 0; spawn_time = time + 5; @@ -233,7 +232,7 @@ void() NewRound = roundtype = 1; if (world.fog) { - #ifdef PSP + #ifdef HANDHELD localcmd(strcat("fog ", world.fog)); #else #ifdef PC diff --git a/source/server/weapons/weapon_core.qc b/source/server/weapons/weapon_core.qc index af26380..e62c141 100644 --- a/source/server/weapons/weapon_core.qc +++ b/source/server/weapons/weapon_core.qc @@ -726,7 +726,7 @@ void Parse_Damage () = // DO NOT TOUCH body_ent.usedent = self; body_ent.bleedingtime = time + 2; - #ifndef NX + #ifdef HANDHELD updateLimb (body_ent.head.owner, 0, world); #endif } @@ -750,7 +750,7 @@ void Parse_Damage () = // DO NOT TOUCH body_ent.larm.solid = SOLID_NOT; setmodel(body_ent.larm,""); body_ent.larm.frame = 0; - #ifndef NX + #ifdef HANDHELD updateLimb (body_ent.larm.owner, 1, world); #endif } @@ -772,7 +772,7 @@ void Parse_Damage () = // DO NOT TOUCH body_ent.rarm.solid = SOLID_NOT; setmodel(body_ent.rarm,""); body_ent.rarm.frame = 0; - #ifndef NX + #ifdef HANDHELD updateLimb (body_ent.rarm.owner, 2, world); #endif } @@ -1086,7 +1086,7 @@ void() RayBulletExplode = te_smallflash(self.origin); #else WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - #ifdef PSP + #ifdef HANDHELD if (self.effects & EF_RAYGREEN) WriteByte (MSG_BROADCAST, TE_RAYSPLASHGREEN); else @@ -1146,13 +1146,13 @@ void() W_FireRay = if (self.weapon == W_PORTER) { - #ifdef PSP + #ifdef HANDHELD porter.effects = EF_RAYRED; #else porter.effects = EF_RED; #endif } else { - #ifdef PSP + #ifdef HANDHELD porter.effects = EF_RAYGREEN; #else porter.effects = EF_GREEN; @@ -1270,7 +1270,7 @@ void() W_FireTesla = #ifdef PC te_lightning2(self, source, trace_endpos); #endif - #ifdef PSP + #ifdef HANDHELD WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, TE_LIGHTNING2); WriteEntity (MSG_BROADCAST, self); @@ -1902,11 +1902,7 @@ void() W_ThrowGrenade = makevectors (self.v_angle); - #ifndef PSP - nade.velocity = v_forward*500; - #else - nade.velocity = v_forward*800; // on PSP, we need more OOMFPH - #endif + nade.velocity = v_forward*800; nade.avelocity = '400 -400 400'; @@ -2145,7 +2141,7 @@ void () Impulse_Functions = W_SprintStop(); break; case 25: - #if defined (PSP) || defined (CTR) + #ifdef HANDHELD switch_nade(); #else W_Betty(); @@ -2394,7 +2390,7 @@ void () Weapon_Logic = Impulse_Functions(); #ifndef PC - // For PSP only to tell our engine to display the scope + // For HANDHELD only to tell our engine to display the scope if ((self.scopetime < time) && self.scopetime) { self.scopetime = 0; self.zoom = 2; @@ -2552,7 +2548,7 @@ void () Weapon_Logic = if (self.button6 && !self.semiknife) { - #if defined (PSP) || defined (CTR) + #ifdef HANDHELD if (self.sprinting) { dolphin_dive(); return; diff --git a/source/shared/defs/custom.qc b/source/shared/defs/custom.qc index d533e3b..97c58ea 100644 --- a/source/shared/defs/custom.qc +++ b/source/shared/defs/custom.qc @@ -53,12 +53,10 @@ const float EVENT_ACHIEVEMENTPROGRESS = 36; // Define our PC version if we don't have NX or PSP #ifndef NX -#ifndef PSP -#ifndef CTR +#ifndef HANDHELD #define PC #endif #endif -#endif // Weapon Firetype definitions #define FIRETYPE_FULLAUTO 0 diff --git a/source/shared/weapon_defines.qc b/source/shared/weapon_defines.qc index 44fcf7e..abcaa7f 100644 --- a/source/shared/weapon_defines.qc +++ b/source/shared/weapon_defines.qc @@ -1352,7 +1352,7 @@ vector GetWeaponADSPos(float wep) { return [-0.6, 2.7, 1.94]; case W_MP40: case W_AFTERBURNER: - return [-3.79, 6.1, 4.04]; + return [-3.79, 5.74, 3.25]; case W_MG: case W_BARRACUDA: return [-3.9, 3.5, 1.84]; @@ -1435,7 +1435,7 @@ vector GetWeaponADSOfs_PSP(float wep) = return [-7500, 3000, 0]; case W_MP40: case W_AFTERBURNER: - return [-12320, 7600, 0]; + return [-11400, 6700, 0]; case W_TYPE: case W_SAMURAI: return [-400, -200, 0]; @@ -1966,29 +1966,29 @@ float(float wep, float frametype, optional float z) GetFrame = case FIRE_START: return 1; case FIRE_END: - return 2; + return 4; case RELOAD_START: - return 3; - case RELOAD_END: - return 21; - case SPRINT_IN_START: - return 37; - case SPRINT_IN_END: - return 38; - case SPRINT_OUT_START: - return 39; - case SPRINT_OUT_END: - return 40; - case TAKE_OUT_START: - return 32; - case TAKE_OUT_END: - return 35; - case PUT_OUT_START: return 30; + case RELOAD_END: + return 60; + case SPRINT_IN_START: + return 72; + case SPRINT_IN_END: + return 76; + case SPRINT_OUT_START: + return 77; + case SPRINT_OUT_END: + return 83; + case TAKE_OUT_START: + return 65; + case TAKE_OUT_END: + return 71; + case PUT_OUT_START: + return 61; case PUT_OUT_END: - return 32; + return 65; case RELOAD_CANCEL: - return 16; + return 45; } break; case W_MG: @@ -2442,9 +2442,20 @@ string(float wep, float gorvmodel) GetWeaponModel = else return ("models/weapons/type/v_type.mdl"); case W_GRENADE: - return ("models/weapons/grenade/g_grenade.mdl"); + if (gorvmodel) + return ("models/weapons/grenade/g_grenade.mdl"); + else + return ("models/weapons/grenade/v_grenade.mdl"); case W_BETTY: - return ("models/weapons/grenade/g_betty.mdl"); + if (gorvmodel) + return ("models/weapons/grenade/g_betty.mdl"); + else + return ("models/weapons/grenade/v_betty.mdl"); + case W_BOWIE: + if (gorvmodel) + return ("models/weapons/knife/g_bowie.mdl"); + else + return ("models/weapons/knife/v_bowie.mdl"); case W_DG3: case W_TESLA: if (gorvmodel) @@ -2964,10 +2975,12 @@ void (float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap break; case W_MP40: case W_AFTERBURNER: - if (curweaponframe == 10) { + if (curweaponframe == 33) { sound (self ,5, "sounds/weapons/mp40/magout.wav", 1, ATTN_NORM); - } else if (curweaponframe == 17) { + } else if (curweaponframe == 43) { sound (self ,5, "sounds/weapons/mp40/magin.wav", 1, ATTN_NORM); + } else if (curweaponframe == 52) { + sound (self ,5, "sounds/weapons/mp40/boltback.wav", 1, ATTN_NORM); } break; case W_PANZER: @@ -3195,6 +3208,7 @@ void(float weptype) precache_extra = precache_sound ("sounds/weapons/mp40/shoot.wav"); precache_sound ("sounds/weapons/mp40/magout.wav"); precache_sound ("sounds/weapons/mp40/magin.wav"); + precache_sound ("sounds/weapons/mp40/boltback.wav"); break; case W_MG: case W_BARRACUDA: @@ -3929,7 +3943,7 @@ vector (float wep) GetWeaponFlash_Offset = return [11100, -9000, 86300]; case W_MP40: case W_AFTERBURNER: - return [11300, -11300, 80000]; + return [11300, -11300, 85000]; case W_STG: case W_SPATZ: return [14300, -16230, 100000]; diff --git a/tools/qc-compiler-lin.sh b/tools/qc-compiler-lin.sh index a2f5b2f..c554ba3 100755 --- a/tools/qc-compiler-lin.sh +++ b/tools/qc-compiler-lin.sh @@ -2,41 +2,35 @@ cd ../ # create build directories -mkdir -p build/{pc,psp,nx,vita,ctr} +mkdir -p build/{pc,handheld,nx,vita} cd bin/ echo "" -echo "====================" -echo " compiling FTE CCQC " -echo "====================" +echo "========================" +echo " compiling FTE CCQC " +echo "========================" echo "" ./fteqcc-cli-lin -srcfile ../progs/fte-client.src echo "" -echo "====================" -echo " compiling FTE SSQC " -echo "====================" +echo "========================" +echo " compiling FTE SSQC " +echo "========================" echo "" ./fteqcc-cli-lin -srcfile ../progs/fte-server.src echo "" -echo "====================" -echo " compiling PSP QC " -echo "====================" +echo "========================" +echo " compiling PSP & 3DS QC " +echo "========================" echo "" -./fteqcc-cli-lin -srcfile ../progs/psp.src +./fteqcc-cli-lin -srcfile ../progs/handheld.src echo "" -echo "====================" -echo " compiling NX-QS QC " -echo "====================" +echo "========================" +echo " compiling NX-QS QC " +echo "========================" echo "" ./fteqcc-cli-lin -srcfile ../progs/nx.src echo "" -echo "====================" -echo " compiling VITA QC " -echo "====================" +echo "========================" +echo " compiling VITA QC " +echo "========================" echo "" -./fteqcc-cli-lin -srcfile ../progs/vita.src -echo "" -echo "====================" -echo " compiling 3DS QC " -echo "====================" -echo "" -./fteqcc-cli-lin -srcfile ../progs/ctr.src +./fteqcc-cli-lin -srcfile ../progs/vita.src \ No newline at end of file diff --git a/tools/qc-compiler-win.bat b/tools/qc-compiler-win.bat index 4e836dc..d88befb 100644 --- a/tools/qc-compiler-win.bat +++ b/tools/qc-compiler-win.bat @@ -2,45 +2,38 @@ CD ../ REM ****** create build directories ****** MKDIR build\pc\ 2>nul -MKDIR build\psp\ 2>nul +MKDIR build\handheld\ 2>nul MKDIR build\nx\ 2>nul MKDIR build\vita\ 2>nul -MKDIR build\ctr\ 2>nul CD bin/ echo. -echo ==================== -echo compiling FTE CCQC -echo ==================== +echo ======================== +echo compiling FTE CCQC +echo ======================== echo. fteqcc-cli-win.exe -srcfile ../progs/fte-client.src echo. -echo ==================== -echo compiling FTE SSQC -echo ==================== +echo ======================== +echo compiling FTE SSQC +echo ======================== echo. fteqcc-cli-win.exe -srcfile ../progs/fte-server.src echo. -echo ==================== -echo compiling PSP QC -echo ==================== +echo ======================== +echo compiling PSP & 3DS QC +echo ======================== echo. -fteqcc-cli-win.exe -srcfile ../progs/psp.src +fteqcc-cli-win.exe -srcfile ../progs/handheld.src echo. -echo ==================== -echo compiling NX-QS QC -echo ==================== +echo ======================== +echo compiling NX-QS QC +echo ======================== echo. fteqcc-cli-win.exe -srcfile ../progs/nx.src echo. -echo ==================== -echo compiling VITA QC -echo ==================== +echo ======================== +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