├── .clang-format ├── .gitattributes ├── .github └── workflows │ └── cmake.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── README.md ├── Tools ├── Tools ├── io_mesh_qfmd.zip ├── nac.fgd └── sp2maker.7z ├── VC └── inc │ ├── AL │ ├── al.h │ ├── alc.h │ ├── efx-presets.h │ └── efx.h │ └── GL │ ├── glext.h │ └── wglext.h ├── bin └── basepoly │ ├── default.cfg │ └── polyconfig.cfg ├── build.yaml ├── build_materials.py ├── cmake └── compileShaders.cmake ├── compile_shaders.bat ├── doc └── screenshots │ ├── ingame0.png │ ├── ingame1.png │ └── mainmenu.png ├── license.txt ├── notice.txt ├── src ├── CMakeLists.txt ├── Client │ ├── ASCII.cpp │ ├── CMakeLists.txt │ ├── CRC.cpp │ ├── Cinematic.cpp │ ├── Client.h │ ├── ClientGame.cpp │ ├── Console.cpp │ ├── Demo.cpp │ ├── Download.cpp │ ├── Entities.cpp │ ├── Entities.h │ ├── Entities │ │ ├── LocalEntities.cpp │ │ ├── LocalEntities.h │ │ ├── PacketEntities.cpp │ │ └── PacketEntities.h │ ├── GameModule.h │ ├── HTTP.cpp │ ├── Input.cpp │ ├── Input.h │ ├── Keys.cpp │ ├── Keys.h │ ├── Main.cpp │ ├── Models.cpp │ ├── Models.h │ ├── Null.cpp │ ├── NullGL.cpp │ ├── Parse.cpp │ ├── Precache.cpp │ ├── Predict.cpp │ ├── Refresh.cpp │ ├── RmlUI │ │ ├── Interfaces │ │ │ ├── FileInterface.cpp │ │ │ ├── FileInterface.h │ │ │ ├── RenderInterface.cpp │ │ │ ├── RenderInterface.h │ │ │ ├── RenderInterfaceOpenGL.cpp │ │ │ ├── RenderInterfaceOpenGL.h │ │ │ ├── SystemInterface.cpp │ │ │ └── SystemInterface.h │ │ ├── LibRmlUI.h │ │ ├── RmlUI.cpp │ │ ├── RmlUI.h │ │ └── RmlUINull.cpp │ ├── Screen.cpp │ ├── Sound │ │ ├── DirectMemoryAccess.cpp │ │ ├── DirectMemoryAccess.h │ │ ├── Main.cpp │ │ ├── Memory.cpp │ │ ├── Mix.cpp │ │ ├── Ogg.cpp │ │ ├── OpenAL.cpp │ │ ├── QAL │ │ │ ├── AL │ │ │ │ ├── al.h │ │ │ │ ├── alc.h │ │ │ │ ├── efx-presets.h │ │ │ │ └── efx.h │ │ │ ├── Dynamic.cpp │ │ │ ├── Dynamic.h │ │ │ ├── Fixed.c │ │ │ └── Fixed.h │ │ ├── Sound.h │ │ └── Vorbis.h │ ├── Traces.cpp │ ├── Traces.h │ ├── UI.h │ ├── UI │ │ ├── Demos.cpp │ │ ├── Menu.cpp │ │ ├── PlayerConfig.cpp │ │ ├── PlayerModels.cpp │ │ ├── Script.cpp │ │ ├── Servers.cpp │ │ ├── UI.cpp │ │ ├── UI.h │ │ └── polyhedron.menu │ ├── Video.h │ ├── View.cpp │ ├── World.cpp │ └── World.h ├── Common │ ├── Bsp.cpp │ ├── Bsp.h │ ├── CVar.cpp │ ├── CVar.h │ ├── Cmd.cpp │ ├── Cmd.h │ ├── CollisionModel.cpp │ ├── CollisionModel.h │ ├── Common.cpp │ ├── Common.h │ ├── EntitySkeleton.cpp │ ├── EntitySkeleton.h │ ├── Error.cpp │ ├── Error.h │ ├── Field.cpp │ ├── Field.h │ ├── Fifo.cpp │ ├── Fifo.h │ ├── Files.cpp │ ├── Files.h │ ├── HalfFloat.h │ ├── Hashes │ │ ├── Crc32.cpp │ │ └── Crc32.h │ ├── Huffman.cpp │ ├── Huffman.h │ ├── MDFour.cpp │ ├── MDFour.h │ ├── Messaging.cpp │ ├── Messaging.h │ ├── Messaging │ │ ├── MessageReadWrite.cpp │ │ ├── ParseDeltaClientMoveCommand.cpp │ │ ├── ParseDeltaEntityState.cpp │ │ ├── ParseDeltaPlayerState.cpp │ │ ├── WriteDeltaClientMoveCommand.cpp │ │ ├── WriteDeltaEntityState.cpp │ │ └── WriteDeltaPlayerState.cpp │ ├── Models │ │ └── Iqm.cpp │ ├── Net │ │ ├── ChanOld.cpp │ │ ├── INetNToP.h │ │ ├── INetPToN.h │ │ ├── Net.cpp │ │ ├── Net.h │ │ ├── NetChan.cpp │ │ ├── NetChan.h │ │ ├── Unix.h │ │ ├── Win.h │ │ ├── _NetChan.cpp │ │ └── _NetChan.h │ ├── PlayerMove.h │ ├── Prompt.cpp │ ├── Prompt.h │ ├── Protocol.h │ ├── SizeBuffer.cpp │ ├── SizeBuffer.h │ ├── SkeletalModelData.cpp │ ├── SkeletalModelData.h │ ├── TemporaryBoneCache.cpp │ ├── TemporaryBoneCache.h │ ├── Tests.cpp │ ├── Tests.h │ ├── Utilities.cpp │ ├── Utilities.h │ ├── Zone.cpp │ └── Zone.h ├── Game │ ├── Client │ │ ├── CMakeLists.txt │ │ ├── ClientGameExports.cpp │ │ ├── ClientGameExports.h │ │ ├── ClientGameImports.cpp │ │ ├── ClientGameImports.h │ │ ├── ClientGameLocals.cpp │ │ ├── ClientGameLocals.h │ │ ├── Debug.cpp │ │ ├── Debug.h │ │ ├── Effects │ │ │ ├── DynamicLights.cpp │ │ │ ├── DynamicLights.h │ │ │ ├── LightStyles.cpp │ │ │ ├── LightStyles.h │ │ │ ├── MuzzleFlashEffects.cpp │ │ │ ├── MuzzleFlashEffects.h │ │ │ ├── ParticleEffects.h │ │ │ ├── Particles.cpp │ │ │ ├── Particles.h │ │ │ └── Particles │ │ │ │ ├── BloodSplatters.cpp │ │ │ │ ├── BubbleTrailA.cpp │ │ │ │ ├── BubbleTrailB.cpp │ │ │ │ ├── DiminishingTrail.cpp │ │ │ │ ├── DirtAndSparks.cpp │ │ │ │ ├── ExplosionSparks.cpp │ │ │ │ ├── ForceWall.cpp │ │ │ │ ├── HeatBeam.cpp │ │ │ │ ├── ItemRespawn.cpp │ │ │ │ ├── LogoutEffect.cpp │ │ │ │ ├── MonsterPlasmaShell.cpp │ │ │ │ ├── SteamPuffs.cpp │ │ │ │ ├── Teleporter.cpp │ │ │ │ └── WaterSplash.cpp │ │ ├── Entities │ │ │ ├── Base │ │ │ │ ├── CLGBaseLocalEntity.cpp │ │ │ │ ├── CLGBaseLocalEntity.h │ │ │ │ ├── CLGBaseMover.cpp │ │ │ │ ├── CLGBaseMover.h │ │ │ │ ├── CLGBasePacketEntity.cpp │ │ │ │ ├── CLGBasePacketEntity.h │ │ │ │ ├── CLGBasePlayer.cpp │ │ │ │ ├── CLGBasePlayer.h │ │ │ │ ├── CLGBaseTrigger.cpp │ │ │ │ └── CLGBaseTrigger.h │ │ │ ├── DebrisEntity.cpp │ │ │ ├── DebrisEntity.h │ │ │ ├── Func │ │ │ │ ├── FuncDoor.cpp │ │ │ │ ├── FuncDoor.h │ │ │ │ ├── FuncDoorRotating.cpp │ │ │ │ ├── FuncDoorRotating.h │ │ │ │ ├── FuncPlat.cpp │ │ │ │ ├── FuncPlat.h │ │ │ │ ├── FuncRotating.cpp │ │ │ │ └── FuncRotating.h │ │ │ ├── GibEntity.cpp │ │ │ ├── GibEntity.h │ │ │ ├── IClientGameEntity.cpp │ │ │ ├── IClientGameEntity.h │ │ │ ├── Misc │ │ │ │ ├── MiscClientExplosionBox.cpp │ │ │ │ ├── MiscClientExplosionBox.h │ │ │ │ ├── MiscClientModel.cpp │ │ │ │ ├── MiscClientModel.h │ │ │ │ ├── MiscExplosionBox.cpp │ │ │ │ └── MiscExplosionBox.h │ │ │ ├── Monsters │ │ │ │ ├── MonsterTestDummy.cpp │ │ │ │ └── MonsterTestDummy.h │ │ │ ├── Worldspawn.cpp │ │ │ └── Worldspawn.h │ │ ├── Exports │ │ │ ├── Core.cpp │ │ │ ├── Core.h │ │ │ ├── Entities.cpp │ │ │ ├── Entities.h │ │ │ ├── Media.cpp │ │ │ ├── Media.h │ │ │ ├── Movement.cpp │ │ │ ├── Movement.h │ │ │ ├── Prediction.cpp │ │ │ ├── Prediction.h │ │ │ ├── Screen.cpp │ │ │ ├── Screen.h │ │ │ ├── ServerMessage.cpp │ │ │ ├── ServerMessage.h │ │ │ ├── View.cpp │ │ │ └── View.h │ │ ├── HUD │ │ │ ├── ChatHUD.cpp │ │ │ ├── ChatHUD.h │ │ │ ├── NumberHUD.cpp │ │ │ └── NumberHUD.h │ │ ├── Input │ │ │ ├── KeyBinding.cpp │ │ │ └── KeyBinding.h │ │ ├── Main.cpp │ │ ├── Main.h │ │ ├── TemporaryEntities.cpp │ │ ├── TemporaryEntities.h │ │ ├── Utilities │ │ │ ├── CLGTraceResult.cpp │ │ │ └── CLGTraceResult.h │ │ ├── View │ │ │ ├── ViewCamera.cpp │ │ │ └── ViewCamera.h │ │ ├── World │ │ │ ├── ClientGameWorld.cpp │ │ │ └── ClientGameWorld.h │ │ └── clgame.def │ ├── Server │ │ ├── AI │ │ │ ├── MonsterAI.cpp │ │ │ └── MonsterAI.h │ │ ├── Ballistics.cpp │ │ ├── Ballistics.h │ │ ├── CMakeLists.txt │ │ ├── ChaseCamera.cpp │ │ ├── ChaseCamera.h │ │ ├── Commands.cpp │ │ ├── Effects.cpp │ │ ├── Effects.h │ │ ├── Entities.cpp │ │ ├── Entities.h │ │ ├── Entities │ │ │ ├── Base │ │ │ │ ├── BodyCorpse.cpp │ │ │ │ ├── BodyCorpse.h │ │ │ │ ├── DebrisEntity.cpp │ │ │ │ ├── DebrisEntity.h │ │ │ │ ├── GibEntity.cpp │ │ │ │ ├── GibEntity.h │ │ │ │ ├── SVGBaseEntity.cpp │ │ │ │ ├── SVGBaseEntity.h │ │ │ │ ├── SVGBaseItem.cpp │ │ │ │ ├── SVGBaseItem.h │ │ │ │ ├── SVGBaseItemAmmo.cpp │ │ │ │ ├── SVGBaseItemAmmo.h │ │ │ │ ├── SVGBaseItemWeapon.cpp │ │ │ │ ├── SVGBaseItemWeapon.h │ │ │ │ ├── SVGBaseMover.cpp │ │ │ │ ├── SVGBaseMover.h │ │ │ │ ├── SVGBasePlayer.cpp │ │ │ │ ├── SVGBasePlayer.h │ │ │ │ ├── SVGBaseRootMotionMonster.cpp │ │ │ │ ├── SVGBaseRootMotionMonster.h │ │ │ │ ├── SVGBaseSkeletalAnimator.cpp │ │ │ │ ├── SVGBaseSkeletalAnimator.h │ │ │ │ ├── SVGBaseStepMonster.cpp │ │ │ │ ├── SVGBaseStepMonster.h │ │ │ │ ├── SVGBaseTrigger.cpp │ │ │ │ └── SVGBaseTrigger.h │ │ │ ├── Func │ │ │ │ ├── FuncAreaportal.cpp │ │ │ │ ├── FuncAreaportal.h │ │ │ │ ├── FuncButton.cpp │ │ │ │ ├── FuncButton.h │ │ │ │ ├── FuncDoor.cpp │ │ │ │ ├── FuncDoor.h │ │ │ │ ├── FuncDoorRotating.cpp │ │ │ │ ├── FuncDoorRotating.h │ │ │ │ ├── FuncExplosive.cpp │ │ │ │ ├── FuncExplosive.h │ │ │ │ ├── FuncPlat.cpp │ │ │ │ ├── FuncPlat.h │ │ │ │ ├── FuncRotating.cpp │ │ │ │ ├── FuncRotating.h │ │ │ │ ├── FuncTimer.cpp │ │ │ │ ├── FuncTimer.h │ │ │ │ ├── FuncTrain.cpp │ │ │ │ ├── FuncTrain.h │ │ │ │ ├── FuncWall.cpp │ │ │ │ └── FuncWall.h │ │ │ ├── IServerGameEntity.h │ │ │ ├── Info │ │ │ │ ├── InfoNotNull.cpp │ │ │ │ ├── InfoNotNull.h │ │ │ │ ├── InfoNull.cpp │ │ │ │ ├── InfoPlayerCoop.cpp │ │ │ │ ├── InfoPlayerCoop.h │ │ │ │ ├── InfoPlayerDeathmatch.cpp │ │ │ │ ├── InfoPlayerDeathmatch.h │ │ │ │ ├── InfoPlayerIntermission.cpp │ │ │ │ ├── InfoPlayerIntermission.h │ │ │ │ ├── InfoPlayerStart.cpp │ │ │ │ └── InfoPlayerStart.h │ │ │ ├── Items │ │ │ │ ├── ItemAmmo9mm.cpp │ │ │ │ ├── ItemAmmo9mm.h │ │ │ │ ├── ItemHealthMega.cpp │ │ │ │ ├── ItemHealthMega.h │ │ │ │ ├── ItemWeaponBeretta.cpp │ │ │ │ ├── ItemWeaponBeretta.h │ │ │ │ ├── ItemWeaponKnife.cpp │ │ │ │ ├── ItemWeaponKnife.h │ │ │ │ ├── ItemWeaponNone.cpp │ │ │ │ ├── ItemWeaponNone.h │ │ │ │ ├── ItemWeaponSMG.cpp │ │ │ │ └── ItemWeaponSMG.h │ │ │ ├── Light.cpp │ │ │ ├── Light.h │ │ │ ├── Misc │ │ │ │ ├── MiscExplosionBox.cpp │ │ │ │ ├── MiscExplosionBox.h │ │ │ │ ├── MiscServerModel.cpp │ │ │ │ └── MiscServerModel.h │ │ │ ├── Monsters │ │ │ │ ├── MonsterStepDummy.cpp │ │ │ │ ├── MonsterStepDummy.h │ │ │ │ ├── MonsterTestDummy.cpp │ │ │ │ └── MonsterTestDummy.h │ │ │ ├── Path │ │ │ │ ├── PathCorner.cpp │ │ │ │ ├── PathCorner.h │ │ │ │ ├── PathMonsterGoal.cpp │ │ │ │ └── PathMonsterGoal.h │ │ │ ├── Target │ │ │ │ ├── TargetEarthquake.cpp │ │ │ │ ├── TargetEarthquake.h │ │ │ │ ├── TargetExplosion.cpp │ │ │ │ ├── TargetExplosion.h │ │ │ │ ├── TargetSpeaker.cpp │ │ │ │ ├── TargetSpeaker.h │ │ │ │ ├── TargetTempEntity.cpp │ │ │ │ └── TargetTempEntity.h │ │ │ ├── Trigger │ │ │ │ ├── TriggerAlways.cpp │ │ │ │ ├── TriggerAlways.h │ │ │ │ ├── TriggerAutoDoor.cpp │ │ │ │ ├── TriggerAutoDoor.h │ │ │ │ ├── TriggerAutoPlatform.cpp │ │ │ │ ├── TriggerAutoPlatform.h │ │ │ │ ├── TriggerCounter.cpp │ │ │ │ ├── TriggerCounter.h │ │ │ │ ├── TriggerDelayedUse.cpp │ │ │ │ ├── TriggerDelayedUse.h │ │ │ │ ├── TriggerGravity.cpp │ │ │ │ ├── TriggerGravity.h │ │ │ │ ├── TriggerHurt.cpp │ │ │ │ ├── TriggerHurt.h │ │ │ │ ├── TriggerMultiple.cpp │ │ │ │ ├── TriggerMultiple.h │ │ │ │ ├── TriggerOnce.cpp │ │ │ │ ├── TriggerOnce.h │ │ │ │ ├── TriggerPush.cpp │ │ │ │ ├── TriggerPush.h │ │ │ │ ├── TriggerRelay.cpp │ │ │ │ └── TriggerRelay.h │ │ │ ├── Weaponry │ │ │ │ ├── BlasterBolt.cpp │ │ │ │ └── BlasterBolt.h │ │ │ ├── Worldspawn.cpp │ │ │ └── Worldspawn.h │ │ ├── Exports │ │ │ ├── Client.cpp │ │ │ ├── Client.h │ │ │ ├── Core.cpp │ │ │ ├── Core.h │ │ │ ├── Entities.cpp │ │ │ ├── Entities.h │ │ │ ├── GameState.cpp │ │ │ ├── GameState.h │ │ │ ├── LevelState.cpp │ │ │ └── LevelState.h │ │ ├── Gamemodes │ │ │ ├── CoopGamemode.cpp │ │ │ ├── CoopGamemode.h │ │ │ ├── DeathMatchGamemode.cpp │ │ │ ├── DeathMatchGamemode.h │ │ │ ├── DefaultGamemode.cpp │ │ │ ├── DefaultGamemode.h │ │ │ └── IGamemode.h │ │ ├── ImportsWrapper.cpp │ │ ├── Main.cpp │ │ ├── Monsters │ │ │ ├── MonsterTest.cpp │ │ │ ├── MonsterTest.h │ │ │ ├── monster_test.cpp │ │ │ └── monster_test.h │ │ ├── Physics │ │ │ ├── Physics.cpp │ │ │ ├── StepMove.cpp │ │ │ └── StepMove.h │ │ ├── Player │ │ │ ├── Animations.h │ │ │ ├── Client.cpp │ │ │ ├── Client.h │ │ │ ├── Hud.cpp │ │ │ ├── Hud.h │ │ │ └── Weapons.h │ │ ├── SVCommands.cpp │ │ ├── SVGame.def │ │ ├── Save.cpp │ │ ├── ServerGameExports.h │ │ ├── ServerGameLocals.cpp │ │ ├── ServerGameLocals.h │ │ ├── TypeInfo.h │ │ ├── Utilities.cpp │ │ ├── Utilities.h │ │ ├── Utilities │ │ │ ├── SVGTraceResult.cpp │ │ │ └── SVGTraceResult.h │ │ ├── Weapons.cpp │ │ └── World │ │ │ ├── ServerGameWorld.cpp │ │ │ └── ServerGameWorld.h │ └── Shared │ │ ├── ButtonBits.h │ │ ├── CMakeLists.txt │ │ ├── Entities.h │ │ ├── Entities │ │ ├── ISharedGameEntity.h │ │ ├── SGBaseItem.cpp │ │ ├── SGBaseItem.h │ │ ├── SGEntityHandle.cpp │ │ ├── SGEntityHandle.h │ │ └── TypeInfo.h │ │ ├── EntityEffectTypes.h │ │ ├── EntityFlags.h │ │ ├── GameModeFlags.h │ │ ├── ItemIDs.h │ │ ├── MoveTypes.h │ │ ├── MuzzleFlashTypes.h │ │ ├── Physics │ │ ├── MoveTypes │ │ │ ├── MoveTypeLinearProjectile.cpp │ │ │ ├── MoveTypeNoClip.cpp │ │ │ ├── MoveTypeNone.cpp │ │ │ ├── MoveTypePusher.cpp │ │ │ ├── MoveTypeRootMotionMove.cpp │ │ │ ├── MoveTypeToss.cpp │ │ │ └── MoveTypeTossSlide.cpp │ │ ├── Physics.cpp │ │ ├── Physics.h │ │ ├── RootMotionMove.cpp │ │ ├── RootMotionMove.h │ │ ├── StepMove.cpp │ │ └── StepMove.h │ │ ├── PlayerMove.cpp │ │ ├── PlayerMove.h │ │ ├── Protocol.h │ │ ├── RenderDrawFlags.h │ │ ├── SharedGame.h │ │ ├── SkeletalAnimation.cpp │ │ ├── SkeletalAnimation.h │ │ ├── TempEntityEvents.h │ │ ├── Time.h │ │ ├── Tracing.cpp │ │ ├── Tracing.h │ │ ├── Utilities.h │ │ ├── WaterLevels.h │ │ ├── WeaponStates.h │ │ └── World │ │ ├── IGameWorld.cpp │ │ └── IGameWorld.h ├── Refresh │ ├── Images.h │ ├── Models.h │ ├── Refresh.h │ ├── gl │ │ ├── arbfp.h │ │ ├── draw.cpp │ │ ├── gl.h │ │ ├── hq2x.cpp │ │ ├── images.cpp │ │ ├── main.cpp │ │ ├── mesh.cpp │ │ ├── models.cpp │ │ ├── qgl │ │ │ ├── dynamic.cpp │ │ │ ├── dynamic.h │ │ │ ├── fixed.c │ │ │ └── fixed.h │ │ ├── sky.cpp │ │ ├── state.cpp │ │ ├── surf.cpp │ │ ├── tess.cpp │ │ └── world.cpp │ ├── images.cpp │ ├── models.cpp │ ├── stb │ │ └── stb.cpp │ └── vkpt │ │ ├── asvgf.cpp │ │ ├── bloom.cpp │ │ ├── bsp_mesh.cpp │ │ ├── buddy_allocator.cpp │ │ ├── buddy_allocator.h │ │ ├── cameras.cpp │ │ ├── cameras.h │ │ ├── conversion.cpp │ │ ├── conversion.h │ │ ├── dds.h │ │ ├── device_memory_allocator.cpp │ │ ├── device_memory_allocator.h │ │ ├── draw.cpp │ │ ├── fog.cpp │ │ ├── fog.h │ │ ├── freecam.cpp │ │ ├── fsr.cpp │ │ ├── fsr │ │ ├── ffx_a.h │ │ └── ffx_fsr1.h │ │ ├── god_rays.cpp │ │ ├── main.cpp │ │ ├── material.cpp │ │ ├── material.h │ │ ├── matrix.cpp │ │ ├── mgpu.cpp │ │ ├── models.cpp │ │ ├── path_tracer.cpp │ │ ├── physical_sky.cpp │ │ ├── physical_sky.h │ │ ├── precomputed_sky.cpp │ │ ├── precomputed_sky.h │ │ ├── profiler.cpp │ │ ├── shader │ │ ├── animate_materials.comp │ │ ├── asvgf.glsl │ │ ├── asvgf_atrous.comp │ │ ├── asvgf_gradient_atrous.comp │ │ ├── asvgf_gradient_img.comp │ │ ├── asvgf_gradient_reproject.comp │ │ ├── asvgf_lf.comp │ │ ├── asvgf_taau.comp │ │ ├── asvgf_temporal.comp │ │ ├── bloom_blur.comp │ │ ├── bloom_composite.comp │ │ ├── bloom_downscale.comp │ │ ├── brdf.glsl │ │ ├── checkerboard_interleave.comp │ │ ├── compositing.comp │ │ ├── constants.h │ │ ├── direct_lighting.rgen │ │ ├── final_blit.vert │ │ ├── final_blit_lanczos.frag │ │ ├── fsr_easu.glsl │ │ ├── fsr_easu_fp16.comp │ │ ├── fsr_easu_fp32.comp │ │ ├── fsr_rcas.glsl │ │ ├── fsr_rcas_fp16.comp │ │ ├── fsr_rcas_fp32.comp │ │ ├── fsr_utils.glsl │ │ ├── global_textures.h │ │ ├── global_ubo.h │ │ ├── god_rays.comp │ │ ├── god_rays_filter.comp │ │ ├── god_rays_shared.h │ │ ├── indirect_lighting.rgen │ │ ├── instance_geometry.comp │ │ ├── light_lists.h │ │ ├── normalize_normal_map.comp │ │ ├── path_tracer.h │ │ ├── path_tracer.rchit │ │ ├── path_tracer.rmiss │ │ ├── path_tracer_beam.rahit │ │ ├── path_tracer_beam.rint │ │ ├── path_tracer_explosion.rahit │ │ ├── path_tracer_hit_shaders.h │ │ ├── path_tracer_masked.rahit │ │ ├── path_tracer_particle.rahit │ │ ├── path_tracer_rgen.h │ │ ├── path_tracer_sprite.rahit │ │ ├── path_tracer_transparency.glsl │ │ ├── physical_sky.comp │ │ ├── physical_sky_space.comp │ │ ├── precomputed_sky.glsl │ │ ├── precomputed_sky_params.h │ │ ├── primary_rays.rgen │ │ ├── projection.glsl │ │ ├── read_visbuf.glsl │ │ ├── reflect_refract.rgen │ │ ├── shader_structs.h │ │ ├── shadow_map.vert │ │ ├── sky.h │ │ ├── sky_buffer_resolve.comp │ │ ├── stretch_pic.frag │ │ ├── stretch_pic.vert │ │ ├── tiny_encryption_algorithm.h │ │ ├── tone_mapping_apply.comp │ │ ├── tone_mapping_curve.comp │ │ ├── tone_mapping_histogram.comp │ │ ├── tone_mapping_utils.glsl │ │ ├── utils.glsl │ │ ├── vertex_buffer.h │ │ └── water.glsl │ │ ├── shadow_map.cpp │ │ ├── textures.cpp │ │ ├── tone_mapping.cpp │ │ ├── transparency.cpp │ │ ├── uniform_buffer.cpp │ │ ├── vertex_buffer.cpp │ │ ├── vk_util.cpp │ │ ├── vk_util.h │ │ └── vkpt.h ├── Server │ ├── Commands.cpp │ ├── Entities.cpp │ ├── Init.cpp │ ├── Main.cpp │ ├── Models.cpp │ ├── Models.h │ ├── SVGame.cpp │ ├── Save.cpp │ ├── Send.cpp │ ├── Send_Old.cpp │ ├── Server.h │ ├── User.cpp │ └── World.cpp ├── Shared │ ├── CLGame.h │ ├── CLTypes.h │ ├── CollisionModel.h │ ├── Common.h │ ├── Config.h │ ├── Endian.h │ ├── Entities.h │ ├── EntitySkeleton.h │ ├── Formats │ │ ├── Bsp.h │ │ ├── Iqm.h │ │ ├── Md2.h │ │ ├── Md3.h │ │ ├── Pak.h │ │ ├── Pcx.h │ │ ├── Sp2.h │ │ └── Wal.h │ ├── Interfaces │ │ ├── IClientGameExports.h │ │ ├── IClientGameImports.h │ │ ├── IServerGameExports.h │ │ └── IServerGameImports.h │ ├── KeyValue.h │ ├── Keys.h │ ├── List.h │ ├── Math.cpp │ ├── Math.h │ ├── Math │ │ ├── Color.h │ │ ├── DualQuaternion.h │ │ ├── Matrix3x3.h │ │ ├── Matrix4x4.h │ │ ├── Plane.cpp │ │ ├── Plane.h │ │ ├── Quaternion.h │ │ ├── Rectangle.h │ │ ├── Utilities.h │ │ ├── Vector2.h │ │ ├── Vector3.cpp │ │ ├── Vector3.h │ │ ├── Vector4.h │ │ └── Vector5.h │ ├── Messaging.h │ ├── Platform.h │ ├── PlayerMove.h │ ├── QString.h │ ├── Refresh.h │ ├── SVGame.h │ ├── Shared.cpp │ ├── Shared.h │ ├── SkeletalModelData.h │ ├── Sound.h │ ├── Strings.h │ ├── TickRate.h │ └── UI.h └── System │ ├── Hunk.h │ ├── Lirc.h │ ├── Resources │ ├── RCa13344 │ ├── RCb13344 │ ├── RCc13344 │ ├── RCd13344 │ ├── basepoly_cl.rc │ ├── basepoly_sv.rc │ ├── polyhedron.ico │ ├── polyhedron.rc │ ├── polyhedron.xbm │ ├── polyhedron.xpm │ ├── polyhedron_dedicated.rc │ ├── q2pro.default │ ├── q2pro.desktop │ ├── q2pro.xbm │ └── q2pro.xpm │ ├── SDL2 │ ├── Sound.cpp │ ├── Time.cpp │ └── Video.cpp │ ├── System.h │ ├── Unix │ ├── EVDev.cpp │ ├── Hunk.cpp │ ├── Lirc.cpp │ ├── OSS.cpp │ ├── System.cpp │ ├── TTY.cpp │ └── TTY.h │ └── Windows │ ├── Ascii.cpp │ ├── Debug.cpp │ ├── GLImp.cpp │ ├── GLImp.h │ ├── Hunk.cpp │ ├── Sound.cpp │ ├── System.cpp │ ├── Threads │ ├── Threads.cpp │ └── Threads.h │ ├── Video.cpp │ ├── WGL.cpp │ ├── WGL.h │ ├── Wave.cpp │ ├── WinClient.cpp │ └── WinClient.h ├── trenchbroom └── Polyhedron │ ├── GameConfig.cfg │ ├── Icon.png │ ├── assets │ ├── __tb_info_player_start.png │ ├── pics │ │ └── colormap.pcx │ └── textures │ │ ├── __tb_empty.jpg │ │ └── default.jpg │ ├── polyhedron.fgd │ ├── template1.map │ └── template2.map └── vulkan-1.lib /.clang-format: -------------------------------------------------------------------------------- 1 | # Format Style Options - Created with Clang Power Tools 2 | --- 3 | AlignConsecutiveDeclarations: Consecutive 4 | AlignTrailingComments: true 5 | AllowAllArgumentsOnNextLine: true 6 | AllowShortEnumsOnASingleLine: true 7 | BasedOnStyle: WebKit 8 | BreakBeforeBinaryOperators: None 9 | BreakBeforeBraces: Attach 10 | BreakConstructorInitializers: BeforeColon 11 | ColumnLimit: 250 12 | EmptyLineBeforeAccessModifier: Leave 13 | IndentCaseLabels: true 14 | MaxEmptyLinesToKeep: 2 15 | ReflowComments: false 16 | SortIncludes: false 17 | SpaceAfterTemplateKeyword: false 18 | SpacesBeforeTrailingComments: 2 19 | SpacesInConditionalStatement: false 20 | UseTab: Always 21 | ... 22 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Make 100% sure that .cpp and .h files are C++ 2 | *.cpp linguist-language=C++ 3 | *.hpp linguist-langauge=C++ 4 | *.h linguist-language=C++ 5 | 6 | # Don't count 3rd-party libraries 7 | extern/* linguist_vendored 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .config* 2 | .basepoly/ 3 | .vs/ 4 | 5 | *.swp 6 | *.exe 7 | *.ilk 8 | *.pdb 9 | *.obj 10 | *.dll 11 | *.so 12 | 13 | shader_vkpt 14 | 15 | build/ 16 | 17 | 18 | bin/* 19 | bin/basepoly/ 20 | bin/basepoly/ 21 | bin/basepoly/* 22 | bin/basepoly/*.dll 23 | bin/basepoly/*.so 24 | bin/basepoly/*.pkz 25 | music/ 26 | 27 | bin/basepoly/maps/* 28 | 29 | CMakeFiles 30 | CMakeCache.txt 31 | CMakeSettings.json 32 | cmake_install.cmake 33 | 34 | src/CMakeSettings.json 35 | 36 | bin/Polyhedron 37 | bin/Polyhedron_Dedicated 38 | 39 | out 40 | out/ 41 | out/* 42 | 43 | 44 | bin/basepoly/game* 45 | bin/basepoly/env/* 46 | bin/basepoly/ext_data/* 47 | bin/basepoly/models/* 48 | bin/basepoly/overrides/* 49 | bin/basepoly/pics/* 50 | bin/basepoly/players/* 51 | bin/basepoly/sound/* 52 | bin/basepoly/sprites/* 53 | bin/basepoly/textures/* 54 | 55 | !bin/basepoly/ 56 | !bin/basepoly/default.cfg 57 | !bin/basepoly/polyconfig.cfg -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "nac-extern"] 2 | path = extern 3 | url = https://github.com/WatIsDeze/nac-extern 4 | -------------------------------------------------------------------------------- /Tools/Tools: -------------------------------------------------------------------------------- 1 | SP2Maker - created by Jonathan "Paril" Barkley 2 | - Drag and drop text file onto exe to create sprite (sp2). See in the included example for formatting 3 | 4 | Blender MD3 Exporter (io_mesh_qfmd.zip) - created by Jonathan "Paril" Barkley 5 | - Installs like any other Blender addon. Supports MDL/MD2/MD3. Allows for multiple skins in MD3. To add multiple skins to a model, simply add multiple blender materials. 6 | 7 | Nail & Crescent Entity Definitions for map editors (nac.fdg) 8 | Currently only 100% compatible with Trenchbroom. Other editors may work, or work partially. Need more testing. 9 | -------------------------------------------------------------------------------- /Tools/io_mesh_qfmd.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/Tools/io_mesh_qfmd.zip -------------------------------------------------------------------------------- /Tools/sp2maker.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/Tools/sp2maker.7z -------------------------------------------------------------------------------- /compile_shaders.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | IF "%BUILD_DIRECTORY%" == "" SET BUILD_DIRECTORY=build 4 | 5 | IF NOT EXIST %BUILD_DIRECTORY% ( 6 | echo build directory not found 7 | exit /b 1 8 | ) 9 | 10 | cd %BUILD_DIRECTORY% 11 | 12 | IF EXIST *.sln ( 13 | set "EXTRA_FLAGS=-- /nologo /verbosity:minimal" 14 | ) 15 | 16 | cmake --build . --target shaders %EXTRA_FLAGS% 17 | cd .. 18 | 19 | -------------------------------------------------------------------------------- /doc/screenshots/ingame0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/doc/screenshots/ingame0.png -------------------------------------------------------------------------------- /doc/screenshots/ingame1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/doc/screenshots/ingame1.png -------------------------------------------------------------------------------- /doc/screenshots/mainmenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/doc/screenshots/mainmenu.png -------------------------------------------------------------------------------- /notice.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/notice.txt -------------------------------------------------------------------------------- /src/Client/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Client/CMakeLists.txt -------------------------------------------------------------------------------- /src/Client/Entities.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Entities and Etities Frame Processing. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | -------------------------------------------------------------------------------- /src/Client/Entities/LocalEntities.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * 'Non-Wired' Local Entities Frame Processing. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | /** 13 | * @brief Updates the entity belonging to the entity state. If it doesn't 14 | * exist yet, it'll create it. 15 | **/ 16 | void LocalEntity_Update(const EntityState *state); 17 | 18 | /** 19 | * @brief Notifies the client game about an entity event to execute. 20 | **/ 21 | void LocalEntity_FireEvent(EntityState *state); 22 | 23 | /** 24 | * @brief Ensures its hashedClassname is updated accordingly to that which matches the Game Entity. 25 | **/ 26 | void LocalEntity_SetHashedClassname(PODEntity* podEntity, EntityState* state); -------------------------------------------------------------------------------- /src/Client/Entities/PacketEntities.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * 'Wired' Packet Entities Frame Parsing and Processing. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | /** 13 | * @brief Updates the entity belonging to the entity state. If it doesn't 14 | * exist yet, it'll create it. 15 | **/ 16 | void PacketEntity_UpdateState(const EntityState *state); 17 | 18 | /** 19 | * @brief Notifies the client game about an entity event to execute. 20 | **/ 21 | void PacketEntity_FireEvent(int32_t number); 22 | 23 | /** 24 | * @brief Ensures its hashedClassname is updated accordingly to that which matches the Game Entity. 25 | **/ 26 | void PacketEntity_SetHashedClassname(PODEntity* podEntity, EntityState* state); -------------------------------------------------------------------------------- /src/Client/Input.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef INPUT_H 20 | #define INPUT_H 21 | 22 | // 23 | // input.h -- external (non-keyboard) input devices 24 | // 25 | 26 | typedef struct inputAPI_s { 27 | qboolean (*Init)(void); 28 | void (*Shutdown)(void); 29 | void (*Grab)(qboolean grab); 30 | void (*Warp)(int x, int y); 31 | void (*GetEvents)(void); 32 | qboolean (*GetMotion)(int *dx, int *dy); 33 | } inputAPI_t; 34 | 35 | void VID_FillInputAPI(inputAPI_t *api); 36 | 37 | const inputAPI_t* IN_GetAPI(); 38 | 39 | void IN_Frame(void); 40 | void IN_Activate(void); 41 | void IN_WarpMouse(int x, int y); 42 | 43 | #endif // INPUT_H 44 | -------------------------------------------------------------------------------- /src/Client/Keys.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef KEYS_H 20 | #define KEYS_H 21 | 22 | void Key_Init(void); 23 | 24 | void Key_Event(unsigned key, qboolean down, unsigned time); 25 | void Key_CharEvent(int key); 26 | 27 | qboolean Key_GetOverstrikeMode(void); 28 | void Key_SetOverstrikeMode(qboolean overstrike); 29 | keydest_t Key_GetDest(void); 30 | void Key_SetDest(keydest_t dest); 31 | 32 | int Key_IsDown(int key); 33 | int Key_AnyKeyDown(void); 34 | void Key_ClearStates(void); 35 | 36 | const char *Key_KeynumToString(int keynum); 37 | int Key_StringToKeynum(const char *str); 38 | void Key_SetBinding(int keynum, const char *binding); 39 | const char *Key_GetBinding(const char *binding); 40 | const char *Key_GetBindingForKey(int keynum); 41 | int Key_EnumBindings(int key, const char *binding); 42 | void Key_WriteBindings(qhandle_t f); 43 | 44 | void Key_WaitKey(keywaitcb_t wait, void *arg); 45 | 46 | #endif // KEYS_H 47 | -------------------------------------------------------------------------------- /src/Client/Null.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | // cl_null.c -- this file can stub out the entire client system 20 | // for pure dedicated servers 21 | 22 | #include "../Shared/Shared.h" 23 | #include "../Common/CVar.h" 24 | #include "../Common/Bsp.h" 25 | #include "Client/Client.h" 26 | 27 | static void Key_Bind_Null_f(void) 28 | { 29 | } 30 | 31 | void Key_Init(void) 32 | { 33 | Cmd_AddCommand("bind", Key_Bind_Null_f); 34 | Cmd_AddCommand("unbind", Key_Bind_Null_f); 35 | Cmd_AddCommand("unbindall", Key_Bind_Null_f); 36 | } 37 | 38 | void bsp_add_entlights(const bsp_t* bsp) 39 | { 40 | 41 | } 42 | 43 | void initlight_changed(cvar_t *self) 44 | { 45 | 46 | } 47 | void initlightbind_changed(cvar_t *self) 48 | { 49 | } 50 | 51 | int num_entlights; 52 | 53 | cvar_t *initlight; 54 | cvar_t *initlightbind; 55 | 56 | cvar_t *inittargetlightLSbind; 57 | cvar_t *inittargetlightbind; 58 | void inittargetlightLSbind_changed(cvar_t *self) 59 | { 60 | 61 | } 62 | void inittargetlightbind_changed(cvar_t *self) 63 | { 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/Client/NullGL.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #include "../Shared/Shared.h" 20 | #include "../Common/CVar.h" 21 | #include "../Common/Bsp.h" 22 | #include "Client/Client.h" 23 | 24 | // This varialbe is actually defined in /src/refresh/vkpt/transperancy.c 25 | // However since we aren't compiling this file, unless we build without VK 26 | // it is save to define it here. 27 | cvar_t* cvar_pt_beam_lights = NULL; 28 | -------------------------------------------------------------------------------- /src/Client/RmlUI/Interfaces/FileInterface.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // client/rmlui/Interfaces/FileInterface.h 5 | // 6 | // 7 | // RmlUI Polyhedron File Interface implementation. 8 | // 9 | #ifndef __CLIENT_RMLUI_INTERFACES_FILEINTERFACE_H__ 10 | #define __CLIENT_RMLUI_INTERFACES_FILEINTERFACE_H__ 11 | 12 | // Required include here to prevent collisions. 13 | #include 14 | #include "../../../Shared/Shared.h" 15 | 16 | // 17 | // Simple Polyhedron System Interface to Rml 18 | // 19 | class RmlUIFileInterface : public Rml::FileInterface 20 | { 21 | public: 22 | // File 23 | typedef std::map fileSizeMap_t; 24 | private: 25 | // Contains the file size, based on file ID in the map. 26 | fileSizeMap_t fileSizeMap; 27 | 28 | public: 29 | // Opens a file. 30 | virtual Rml::FileHandle Open(const Rml::String& path); 31 | 32 | // Closes a previously opened file. 33 | virtual void Close(Rml::FileHandle file); 34 | 35 | // Reads data from a previously opened file. 36 | virtual size_t Read(void* buffer, size_t size, Rml::FileHandle file); 37 | 38 | // Seeks to a point in a previously opened file. 39 | virtual bool Seek(Rml::FileHandle file, long offset, int origin); 40 | 41 | // Returns the current position of the file pointer. 42 | virtual size_t Tell(Rml::FileHandle file); 43 | 44 | /// Returns the length of the file. 45 | /// The default implementation uses Seek & Tell. 46 | /// @param file The handle of the file to be queried. 47 | /// @return The length of the file in bytes. 48 | virtual size_t Length(Rml::FileHandle file); 49 | }; 50 | 51 | #endif // __CLIENT_RMLUI_INTERFACES_FILEINTERFACE_H__ 52 | -------------------------------------------------------------------------------- /src/Client/RmlUI/Interfaces/SystemInterface.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // client/rmlui/Interfaces/SystemInterface.h 5 | // 6 | // 7 | // RmlUI Polyhedron System Interface implementation. 8 | // 9 | #ifndef __CLIENT_RMLUI_INTERFACES_SYSTEMINTERFACE_H__ 10 | #define __CLIENT_RMLUI_INTERFACES_SYSTEMINTERFACE_H__ 11 | 12 | // Required include. 13 | #include 14 | 15 | // 16 | // Simple Polyhedron System Interface to Rml 17 | // 18 | class RmlUISystemInterface : public Rml::SystemInterface 19 | { 20 | public: 21 | /// Get the number of seconds elapsed since the start of the application 22 | /// @returns Seconds elapsed 23 | double GetElapsedTime() override; 24 | 25 | /// Set mouse cursor. 26 | void SetMouseCursor(const Rml::String& cursor_name) override; 27 | 28 | /// Set clipboard text. 29 | void SetClipboardText(const Rml::String& text) override; 30 | 31 | /// Get clipboard text. 32 | void GetClipboardText(Rml::String& text) override; 33 | 34 | //// Translate the input string into the translated string. 35 | //virtual int TranslateString(Rml::String& translated, const Rml::String& input); 36 | 37 | //// Log the specified message. 38 | virtual bool LogMessage(Rml::Log::Type type, const Rml::String& message); 39 | 40 | // Translate key. 41 | Rml::Input::KeyIdentifier TranslateKey(SDL_Keycode sdlkey); 42 | 43 | // Translate mouse button. 44 | int TranslateMouseButton(uint8_t button); 45 | 46 | // Get key modifiers. 47 | static int GetKeyModifiers(); 48 | }; 49 | 50 | #endif // __CLIENT_RMLUI_INTERFACES_SHELLSYSTEMINTERFACE_H__ 51 | -------------------------------------------------------------------------------- /src/Client/RmlUI/LibRmlUI.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // client/rmlui/RmlUI 5 | // 6 | // 7 | // RmlUI client includes. Handles save including of the RmlUi library headers. 8 | // 9 | #ifndef __CLIENT_RMLUI_X_RMLUI_H__ 10 | #define __CLIENT_RMLUI_X_RMLUI_H__ 11 | 12 | //#define RMLUI_STATIC_LIB 13 | 14 | // RmlUI. 15 | #include "RmlUi/Core/Core.h" 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | // RmlUI Engine GLUE Interfaces. 27 | #include "Interfaces/FileInterface.h" 28 | #include "Interfaces/RenderInterface.h" 29 | #include "Interfaces/SystemInterface.h" 30 | 31 | #endif // __CLIENT_RMLUI_X_RMLUI_H__ 32 | -------------------------------------------------------------------------------- /src/Client/RmlUI/RmlUI.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // client/rmlui/RmlUI 5 | // 6 | // 7 | // RmlUI implementation. 8 | // 9 | #ifndef __CLIENT_RMLUI_RMLUI_H__ 10 | #define __CLIENT_RMLUI_RMLUI_H__ 11 | 12 | // Required include. 13 | #include 14 | 15 | // Include shared headers. 16 | #include "../../Shared/Shared.h" 17 | 18 | // Initializes RMLUI. 19 | void RMLUI_Init(void); 20 | 21 | // Process keyboard events. 22 | bool RMLUI_ProcessKeyDown(SDL_Keycode key); 23 | bool RMLUI_ProcessKeyUp(SDL_Keycode key); 24 | 25 | // Process text events. 26 | bool RMLUI_ProcessTextInput(const char* text); 27 | 28 | // Process mouse events 29 | bool RMLUI_ProcessMouseMove(int x, int y); 30 | bool RMLUI_ProcessMouseWheel(float delta); 31 | bool RMLUI_ProcessMouseButtonUp(int button); 32 | bool RMLUI_ProcessMouseButtonDown(int button); 33 | 34 | // Update RMLUI 35 | void RMLUI_UpdateFrame(void); 36 | 37 | // Render RMLUI 38 | void RMLUI_RenderFrame(void); 39 | 40 | // Shutdowns RMLUI. 41 | void RMLUI_Shutdown(void); 42 | #endif // __CLIENT_RMLUI_RMLUI_H__ 43 | -------------------------------------------------------------------------------- /src/Client/Sound/DirectMemoryAccess.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef DMA_H 20 | #define DMA_H 21 | 22 | typedef struct dma_s { 23 | int channels; 24 | int samples; // mono samples in buffer 25 | int submission_chunk; // don't mix less than this # 26 | int samplepos; // in mono samples 27 | int samplebits; 28 | int speed; 29 | byte *buffer; 30 | } dma_t; 31 | 32 | typedef enum { 33 | SIS_SUCCESS, 34 | SIS_FAILURE, 35 | SIS_NOTAVAIL 36 | } sndinitstat_t; 37 | 38 | typedef struct snddmaAPI_s { 39 | sndinitstat_t (*Init)(void); 40 | void (*Shutdown)(void); 41 | void (*BeginPainting)(void); 42 | void (*Submit)(void); 43 | void (*Activate)(qboolean active); 44 | } snddmaAPI_t; 45 | 46 | void WAVE_FillAPI(snddmaAPI_t *api); 47 | 48 | #if USE_DSOUND 49 | void DS_FillAPI(snddmaAPI_t *api); 50 | #endif 51 | 52 | extern dma_t dma; 53 | extern int paintedtime; 54 | 55 | extern cvar_t *s_khz; 56 | extern cvar_t *s_testsound; 57 | 58 | #endif // DMA_H 59 | -------------------------------------------------------------------------------- /src/Client/Sound/Vorbis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This program is free software; you can redistribute it and/or modify 3 | * it under the terms of the GNU General Public License as published by 4 | * the Free Software Foundation; either version 2 of the License, or (at 5 | * your option) any later version. 6 | * 7 | * This program is distributed in the hope that it will be useful, but 8 | * WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 16 | * USA. 17 | * 18 | * ======================================================================= 19 | * 20 | * The header file for the OGG/Vorbis playback 21 | * 22 | * ======================================================================= 23 | */ 24 | 25 | 26 | // This file has been adapted from Yamagi Quake 2: 27 | // https://github.com/yquake2/yquake2/blob/master/src/client/sound/header/vorbis.h 28 | 29 | #ifndef CL_SOUND_VORBIS_H 30 | #define CL_SOUND_VORBIS_H 31 | 32 | typedef enum 33 | { 34 | PLAY, 35 | PAUSE, 36 | STOP 37 | } ogg_status_t; 38 | 39 | void OGG_InitTrackList(void); 40 | void OGG_Init(void); 41 | void OGG_PlayTrack(int track); 42 | void OGG_RecoverState(void); 43 | void OGG_SaveState(void); 44 | void OGG_Shutdown(void); 45 | void OGG_Stop(void); 46 | void OGG_Stream(void); 47 | void OGG_TogglePlayback(void); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/Client/Traces.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client Tracing implementations, for Box and Octagon -hulls. 8 | * Tracing against entities is optional. 9 | * 10 | ***/ 11 | #pragma once 12 | 13 | 14 | /** 15 | * 16 | **/ 17 | void CL_LinkEntity(PODEntity *entity); 18 | void CL_UnlinkEntity(PODEntity *entity); 19 | 20 | int32_t CL_PointContents(const vec3_t &point); 21 | 22 | /** 23 | * @return Returns a headNode that can be used for testing or clipping an 24 | * entity's BoundingBox or OctagonBox of mins/maxs size. 25 | **/ 26 | mnode_t *CL_HullForEntity(PODEntity *podEntity); 27 | 28 | /** 29 | * @brief Looks up all areas residing in the mins/maxs box of said areaType (solid, or triggers). 30 | * @return Number of entities found and stored in the list. 31 | **/ 32 | int32_t CL_AreaEntities(const vec3_t &mins, const vec3_t &maxs, PODEntity **list, int32_t maxcount, int32_t areatype); 33 | 34 | const TraceResult CL_Trace(const vec3_t& start, const vec3_t& mins, const vec3_t& maxs, const vec3_t& end, PODEntity* skipEntity, const int32_t contentMask); -------------------------------------------------------------------------------- /src/Client/World.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client World header. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | /*** 13 | * 14 | * License here. 15 | * 16 | * @file 17 | * 18 | * Client 'World' management. Similar to the server World.cpp file. 19 | * 20 | ***/ 21 | #include "Client.h" 22 | #include "GameModule.h" 23 | #include "World.h" 24 | 25 | /** 26 | * @brief Removes the entity for collision testing. 27 | **/ 28 | void CL_World_UnlinkEntity(Entity *ent); 29 | /** 30 | * @brief General purpose routine shared between game DLL and MVD code. 31 | * Links entity to PVS leafs. 32 | **/ 33 | void CL_PF_World_LinkEntity(Entity *ent); 34 | 35 | /** 36 | * @brief Looks up all areas residing in the mins/maxs box of said areaType (solid, or triggers). 37 | * @return Number of entities found and stored in the list. 38 | **/ 39 | int32_t CL_World_AreaEntities(const vec3_t &mins, const vec3_t &maxs, PODEntity **list, int32_t maxcount, int32_t areatype); 40 | /** 41 | * @brief Specialized server implementation of PointContents function. 42 | **/ 43 | int32_t CL_World_PointContents(const vec3_t &point); 44 | /** 45 | * @brief Moves the given mins/maxs volume through the world from start to end. This is used for local entities. 46 | * Passedict and edicts owned by passedict are explicitly skipped from being checked. 47 | **/ 48 | const TraceResult CL_World_Trace(const vec3_t &start, const vec3_t &mins, const vec3_t &maxs, const vec3_t &end, PODEntity *passedict, int32_t contentMask); 49 | -------------------------------------------------------------------------------- /src/Common/Field.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2003-2006 Andrey Nazarov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef FIELD_H 20 | #define FIELD_H 21 | 22 | // 23 | // field.h -- line editing 24 | // 25 | 26 | #define MAX_FIELD_TEXT 256 27 | 28 | typedef struct inputField_s { 29 | char text[MAX_FIELD_TEXT]; 30 | size_t maxChars; 31 | size_t visibleChars; 32 | size_t cursorPos; 33 | } inputField_t; 34 | 35 | qboolean IF_KeyEvent(inputField_t *field, int key); 36 | qboolean IF_CharEvent(inputField_t *field, int key); 37 | void IF_Init(inputField_t *field, size_t visibleChars, size_t maxChars); 38 | void IF_Clear(inputField_t *field); 39 | void IF_Replace(inputField_t *field, const char *text); 40 | int IF_Draw(inputField_t *field, int x, int y, int flags, qhandle_t font); 41 | 42 | #endif // FIELD_H 43 | -------------------------------------------------------------------------------- /src/Common/Huffman.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Huffman Coding: 8 | * 9 | * Handles lossless compression and decompression of data using Huffman coding. 10 | * Used for network packets and demo files. 11 | * 12 | ***/ 13 | #pragma once 14 | 15 | /** 16 | * @brief Initializes the Huffman compressor / decompressor. 17 | **/ 18 | void Huff_Init (void); 19 | 20 | /** 21 | * @brief Compresses the given data. 22 | **/ 23 | int32_t Huff_Compress (const byte *in, byte *out, int32_t size); 24 | 25 | /** 26 | * @brief Decompresses the given data. 27 | **/ 28 | int32_t Huff_Decompress (const byte *in, byte *out, int32_t size); -------------------------------------------------------------------------------- /src/Common/MDFour.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-1998 Andrew Tridgell 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef MDFOUR_H 20 | #define MDFOUR_H 21 | 22 | typedef struct mdfour { 23 | uint32_t A, B, C, D; 24 | uint32_t totalN; 25 | } mdfour_t; 26 | 27 | void mdfour_begin(struct mdfour *md); 28 | void mdfour_update(struct mdfour *md, uint8_t *in, size_t n); 29 | void mdfour_result(struct mdfour *md, uint8_t *out); 30 | 31 | uint32_t Com_BlockChecksum(void *buffer, size_t len); 32 | 33 | #endif // MDFOUR_H 34 | -------------------------------------------------------------------------------- /src/Common/PlayerMove.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef PMOVE_H 20 | #define PMOVE_H 21 | 22 | /* 23 | ============================================================== 24 | 25 | PLAYER MOVEMENT CODE 26 | 27 | Common between server and client so prediction matches 28 | 29 | ============================================================== 30 | */ 31 | 32 | void PMove(PlayerMove *pmove); 33 | 34 | #endif // PMOVE_H 35 | -------------------------------------------------------------------------------- /src/Common/SkeletalModelData.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Common Skeletal Model Functionality. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | /** 13 | * @return Game compatible skeletal model data including: animation name, 14 | * and frame data, bounding box data(per frame), and joints(name, index, parentindex) 15 | **/ 16 | void SKM_GenerateModelData(model_t* model); 17 | 18 | /** 19 | * @brief Loads up a skeletal model configuration file and passes its buffer over 20 | * to the parsing process. The process tokenizes the data and generates game 21 | * code friendly POD to work with. 22 | **/ 23 | bool SKM_LoadAndParseConfiguration( model_t *model, const std::string &filePath ); -------------------------------------------------------------------------------- /src/Common/Tests.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011-2012 Andrey Nazarov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef TESTS_H 20 | #define TESTS_H 21 | 22 | #if USE_TESTS 23 | void TST_Init(void); 24 | #else 25 | #define TST_Init() (void)0 26 | #endif 27 | 28 | #endif // TESTS_H 29 | -------------------------------------------------------------------------------- /src/Game/Client/ClientGameImports.cpp: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // clg_main.c 5 | // 6 | // 7 | // Handles the main initialisation of the client game dll. 8 | // 9 | #include "ClientGameLocals.h" 10 | 11 | #include "TemporaryEntities.h" 12 | 13 | #include "ClientGameImports.h" 14 | 15 | 16 | // 17 | //============================================================================= 18 | // 19 | // ClientGameImports Interface Implementation. 20 | // 21 | //============================================================================= 22 | // 23 | -------------------------------------------------------------------------------- /src/Game/Client/Debug.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // License here. 3 | //----------------------------------------------------------------------------- 4 | // Debug.h 5 | //----------------------------------------------------------------------------- 6 | // 7 | // Header for debug rendering client game data. 8 | // 9 | //----------------------------------------------------------------------------- 10 | #pragma once 11 | 12 | // Default color used for drawing debug lines. 13 | static const vec4_t debugLineColor = vec4_t { 23.f, 233.f, 164.f, 255.f }; 14 | 15 | // Draws a debug line. 16 | void CLG_DrawDebugLine(const vec3_t &start, const vec3_t &end, const vec4_t &color = debugLineColor); 17 | 18 | // Draws a debug bounding box. 19 | void CLG_DrawDebugBoundingBox(const vec3_t& origin, const vec3_t& mins, const vec3_t& maxs, const vec4_t& color = debugLineColor); 20 | -------------------------------------------------------------------------------- /src/Game/Client/Effects/DynamicLights.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client Game Dynamic Lights. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class DynamicLights { 13 | public: 14 | /** 15 | * 16 | * Dynamic Light Management. 17 | * 18 | **/ 19 | /** 20 | * @brief Clears out the dynamic light array for this frame. 21 | **/ 22 | static void Clear(); 23 | 24 | /** 25 | * @brief Looks for a free slot to use in the dynamic lights array. 26 | * @return A pointer to one of the slots in the dynamic light array on success. nullptr otherwise. 27 | **/ 28 | static cdlight_t *GetDynamicLight(int32_t key); 29 | 30 | /** 31 | * @brief Run each dynamic light for a frame. (Unless sv_paused is set.) 32 | **/ 33 | static void RunFrame(); 34 | 35 | /** 36 | * @brief Adds the dynamic lights to the scene view. 37 | **/ 38 | static void AddDynamicLightsToView(); 39 | 40 | private: 41 | static cdlight_t lights[MAX_DLIGHTS]; 42 | }; 43 | -------------------------------------------------------------------------------- /src/Game/Client/Effects/LightStyles.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client Game Light Styles. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class LightStyles { 13 | public: 14 | /** 15 | * 16 | * Light Styles Management. 17 | * 18 | **/ 19 | static void Clear(); 20 | static void RunFrame(); 21 | static void Set(int32_t index, const char* style); 22 | 23 | /** 24 | * @brief Adds the light styles to the scene view. 25 | **/ 26 | static void AddLightStylesToView(); 27 | 28 | private: 29 | struct StyleEntry { 30 | list_t entry = {}; 31 | int length = 0; 32 | vec4_t value = vec4_zero(); 33 | float map[MAX_QPATH] = {}; 34 | }; 35 | 36 | static StyleEntry styles[MAX_LIGHTSTYLES]; 37 | static list_t lightList; 38 | static int32_t lastOfs; 39 | }; 40 | -------------------------------------------------------------------------------- /src/Game/Client/Effects/MuzzleFlashEffects.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client Game MuzzleFlash Effects. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class MuzzleFlashEffects { 13 | public: 14 | /** 15 | * 16 | * MuzzleFlash Effects. 17 | * 18 | **/ 19 | /** 20 | * @brief Client Entity Muzzleflash Effects. 21 | **/ 22 | static void ClientMuzzleFlash(); 23 | 24 | /** 25 | * @brief Regular Entity Muzzleflash Effects. 26 | **/ 27 | static void EntityMuzzleFlash(); 28 | 29 | }; 30 | -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/BubbleTrailA.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Bubble Trail A particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | 16 | /** 17 | * @brief 'Bubble Trail A' like particle effect. 18 | **/ 19 | void ParticleEffects::BubbleTrailA(const vec3_t &start, const vec3_t &end) { 20 | vec3_t move = start; 21 | vec3_t vec = end - start; 22 | float len = VectorNormalize(vec); 23 | 24 | float dec = 32.f; 25 | vec = vec3_scale(vec, dec); 26 | 27 | for (int32_t i = 0; i < len; i += dec) { 28 | cparticle_t* trailParticle = Particles::GetFreeParticle(); 29 | if (!trailParticle) { 30 | return; 31 | } 32 | 33 | trailParticle->acceleration = vec3_zero(); 34 | trailParticle->time = cl->time; 35 | 36 | trailParticle->alpha = 1.0; 37 | trailParticle->alphavel = -1.0 / (1 + frand() * 0.2); 38 | 39 | trailParticle->color = 4 + (rand() & 7); 40 | trailParticle->brightness = 1.0f; 41 | 42 | for (int32_t j = 0; j < 3; j++) { 43 | trailParticle->org[j] = move[j] + crand() * 2; 44 | trailParticle->vel[j] = crand() * 5; 45 | } 46 | trailParticle->vel[2] += 6; 47 | 48 | move += vec; 49 | } 50 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/BubbleTrailB.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Bubble Trail B particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | 16 | /** 17 | * @brief 'Bubble Trail B' like particle effect. 18 | **/ 19 | void ParticleEffects::BubbleTrailB(const vec3_t &start, const vec3_t &end, int32_t distance) { 20 | vec3_t move = start; 21 | vec3_t vec = end - start; 22 | float len = VectorNormalize(vec); 23 | 24 | float dec = distance; 25 | VectorScale(vec, dec, vec); 26 | 27 | for (int32_t i = 0; i < len; i += dec) { 28 | cparticle_t *trailParticle = Particles::GetFreeParticle(); 29 | if (!trailParticle) { 30 | return; 31 | } 32 | 33 | trailParticle->acceleration = vec3_zero(); 34 | trailParticle->time = cl->time; 35 | 36 | trailParticle->alpha = 1.0; 37 | trailParticle->alphavel = -1.0 / (1 + frand() * 0.1); 38 | trailParticle->color = 4 + (rand() & 7); 39 | for (int32_t j = 0; j < 3; j++) { 40 | trailParticle->org[j] = move[j] + crand() * 2; 41 | trailParticle->vel[j] = crand() * 10; 42 | } 43 | trailParticle->org[2] -= 4; 44 | trailParticle->vel[2] += 20; 45 | 46 | move += vec; 47 | } 48 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/ExplosionSparks.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Explosion Sparks particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | /** 16 | * @brief 'Explosion Sparks' like particle effect. 17 | **/ 18 | void ParticleEffects::ExplosionSparks(const vec3_t& origin) { 19 | const int count = 256 * Particles::GetParticleNumberFactor(); 20 | 21 | for (int32_t i = 0; i < count; i++) { 22 | cparticle_t *sparkParticle = Particles::GetFreeParticle(); 23 | if (!sparkParticle) { 24 | return; 25 | } 26 | 27 | sparkParticle->time = cl->time; 28 | 29 | sparkParticle->color = 0xe0 + (rand() & 7); 30 | sparkParticle->brightness = Particles::GetParticleEmissiveFactor(); 31 | 32 | for (int32_t j = 0; j < 3; j++) { 33 | sparkParticle->org[j] = origin[j] + ((int)(rand() % 32) - 16); 34 | sparkParticle->vel[j] = (int)(rand() % 384) - 192; 35 | } 36 | 37 | sparkParticle->acceleration[0] = sparkParticle->acceleration[1] = 0; 38 | sparkParticle->acceleration[2] = -ParticleEffects::ParticleGravity; 39 | sparkParticle->alpha = 1.0; 40 | 41 | sparkParticle->alphavel = -0.8 / (0.5 + frand() * 0.3); 42 | } 43 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/ForceWall.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Force Wall particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | /** 16 | * @brief 'Force Wall' particle effect. 17 | **/ 18 | void ParticleEffects::ForceWall(const vec3_t &start, const vec3_t &end, int32_t color) { 19 | vec3_t move = start; 20 | vec3_t vec = end - start; 21 | float len = VectorNormalize(vec); 22 | 23 | vec = vec3_scale(vec, 4.f); 24 | 25 | // FIXME: this is a really silly way to have a loop 26 | while (len > 0) { 27 | len -= 4; 28 | 29 | if (frand() > 0.3) { 30 | cparticle_t *particle = Particles::GetFreeParticle(); 31 | if (!particle) { 32 | return; 33 | } 34 | 35 | particle->acceleration = vec3_zero(); 36 | 37 | particle->time = cl->time; 38 | 39 | particle->alpha = 1.0; 40 | particle->alphavel = -1.0 / (3.0 + frand() * 0.5); 41 | particle->color = color; 42 | for (int32_t j = 0; j < 3; j++) { 43 | particle->org[j] = move[j] + crand() * 3; 44 | particle->acceleration[j] = 0; 45 | } 46 | particle->vel.x = 0; 47 | particle->vel.y = 0; 48 | particle->vel.z = -40 - (crand() * 10); 49 | } 50 | 51 | move += vec; 52 | } 53 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/ItemRespawn.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Item Respawn particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | /** 16 | * @brief 'ItemRespawn' like particle effect. 17 | **/ 18 | void ParticleEffects::ItemRespawn(const vec3_t& origin) { 19 | const int count = 64 * Particles::GetParticleNumberFactor(); 20 | 21 | for (int32_t i = 0; i < count; i++) { 22 | cparticle_t *particle = Particles::GetFreeParticle(); 23 | if (!particle) { 24 | return; 25 | } 26 | 27 | particle->time = cl->time; 28 | 29 | particle->color = 0xd4 + (rand() & 3); // green 30 | particle->brightness = 1.0f; 31 | 32 | particle->org.x = origin.x + crand() * 8; 33 | particle->org.y = origin.y + crand() * 8; 34 | particle->org.z = origin.z + crand() * 8; 35 | 36 | for (int32_t j = 0; j < 3; j++) { 37 | particle->vel[j] = crand() * 8; 38 | } 39 | 40 | particle->acceleration.x = particle->acceleration.y = 0; 41 | particle->acceleration.z = -ParticleEffects::ParticleGravity * 0.2; 42 | particle->alpha = 1.0; 43 | 44 | particle->alphavel = -1.0 / (1.0 + frand() * 0.3); 45 | } 46 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/LogoutEffect.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Logout particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | /** 16 | * @brief 'Logout' like particle effect. 17 | **/ 18 | void ParticleEffects::Logout(const vec3_t& origin, int32_t type) { 19 | for (int32_t i = 0; i < 500; i++) { 20 | cparticle_t *particle = Particles::GetFreeParticle(); 21 | if (!particle) { 22 | return; 23 | } 24 | 25 | particle->time = cl->time; 26 | 27 | int32_t color = 0xe0 + (rand() & 7); // yellow 28 | if (type == MuzzleFlashType::Login) { 29 | color = 0xd0 + (rand() & 7); // green 30 | } else if (type == MuzzleFlashType::Logout) { 31 | color = 0x40 + (rand() & 7); // red 32 | } 33 | 34 | 35 | particle->color = color; 36 | particle->brightness = 1.0f; 37 | 38 | particle->org.x = origin.x - 16 + frand() * 32; 39 | particle->org.y = origin.y - 16 + frand() * 32; 40 | particle->org.z = origin.z - 24 + frand() * 56; 41 | 42 | for (int32_t j = 0; j < 3; j++) { 43 | particle->vel[j] = crand() * 20; 44 | } 45 | 46 | particle->acceleration.x = particle->acceleration.y = 0; 47 | particle->acceleration.z = -ParticleEffects::ParticleGravity; 48 | particle->alpha = 1.0; 49 | 50 | particle->alphavel = -1.0 / (1.0 + frand() * 0.3); 51 | } 52 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/MonsterPlasmaShell.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Monster Plasma Shell particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | /** 16 | * @brief 'Monster Plasma Shell' like particle effect. 17 | **/ 18 | void ParticleEffects::MonsterPlasmaShell(const vec3_t& origin) { 19 | vec3_t direction = vec3_zero(); 20 | 21 | for (int32_t i = 0; i < 40; i++) { 22 | cparticle_t *particle = Particles::GetFreeParticle(); 23 | if (!particle) { 24 | return; 25 | } 26 | 27 | particle->acceleration = vec3_zero(); 28 | particle->time = cl->time; 29 | particle->alpha = 1.0; 30 | particle->alphavel = ParticleEffects::InstantParticle; 31 | particle->color = 0xe0; 32 | particle->org = vec3_fmaf(origin, 10, vec3_t { 33 | static_cast(crand()), 34 | static_cast(crand()), 35 | static_cast(crand()) 36 | }); 37 | } 38 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/SteamPuffs.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Item Respawn particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | /** 16 | * @brief 'ItemRespawn' like particle effect. 17 | **/ 18 | void ParticleEffects::SteamPuffs(const vec3_t &origin, const vec3_t &direction, int32_t color, int32_t count, int32_t magnitude) { 19 | vec3_t right, up; 20 | 21 | // Used for normal vectors, this code is a cheap move over anyway. 22 | vec3_t dir = direction; 23 | MakeNormalVectors(dir, right, up); 24 | 25 | for (int32_t i = 0; i < count; i++) { 26 | cparticle_t *particle = Particles::GetFreeParticle(); 27 | if (!particle) { 28 | return; 29 | } 30 | 31 | particle->time = cl->time; 32 | particle->color = color + (rand() & 7); 33 | 34 | for (int32_t j = 0; j < 3; j++) { 35 | particle->org[j] = origin[j] + magnitude * 0.1 * crand(); 36 | } 37 | particle->vel = vec3_scale(dir, magnitude); 38 | float distance = crand() * magnitude / 3; 39 | particle->vel = vec3_fmaf(particle->vel, distance, right); 40 | distance = crand() * magnitude / 3; 41 | particle->vel = vec3_fmaf(particle->vel, distance, up); 42 | 43 | particle->acceleration.x = particle->acceleration.y = 0; 44 | particle->acceleration.z = -ParticleEffects::ParticleGravity / 2; 45 | particle->alpha = 1.0; 46 | 47 | particle->alphavel = -1.0 / (0.5 + frand() * 0.3); 48 | } 49 | } -------------------------------------------------------------------------------- /src/Game/Client/Effects/Particles/Teleporter.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Teleporter particle effect implementation. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" 11 | 12 | #include "../Particles.h" 13 | #include "../ParticleEffects.h" 14 | 15 | /** 16 | * @brief 'Teleporter' like particle effect. 17 | **/ 18 | void ParticleEffects::Teleporter(const vec3_t& origin) { 19 | const int count = 8 * Particles::GetParticleNumberFactor(); 20 | 21 | for (int32_t i = 0; i < count; i++) { 22 | cparticle_t *particle = Particles::GetFreeParticle(); 23 | if (!particle ) { 24 | return; 25 | } 26 | 27 | particle ->time = cl->time; 28 | 29 | particle ->color = 0xdb; 30 | particle ->brightness = 1.0f; 31 | 32 | for (int32_t j = 0; j < 2; j++) { 33 | particle ->org[j] = origin[j] - 16 + (rand() & 31); 34 | particle ->vel[j] = crand() * 14; 35 | } 36 | 37 | particle ->org.z = origin.z - 8 + (rand() & 7); 38 | particle ->vel.z = 80 + (rand() & 7); 39 | 40 | particle ->acceleration.x = particle ->acceleration.y = 0; 41 | particle ->acceleration.z = -ParticleEffects::ParticleGravity; 42 | particle ->alpha = 1.0; 43 | 44 | particle ->alphavel = -0.5; 45 | } 46 | } -------------------------------------------------------------------------------- /src/Game/Client/Entities/Base/CLGBaseTrigger.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * ClientGame BaseTrigger Entity. 8 | * 9 | ***/ 10 | #include "../../ClientGameLocals.h" // SVGame. 11 | 12 | // Class Entities. 13 | #include "CLGBasePacketEntity.h" 14 | #include "CLGBaseTrigger.h" 15 | 16 | // Included for delayed use. 17 | //#include "../Trigger/TriggerDelayedUse.h" 18 | 19 | // Constructor/Deconstructor. 20 | CLGBaseTrigger::CLGBaseTrigger(PODEntity *clEntity) : Base(clEntity) {} 21 | 22 | // Interface functions. 23 | // 24 | // 25 | 26 | /** 27 | * 28 | **/ 29 | void CLGBaseTrigger::InitBrushTrigger() { 30 | SetModel(GetModel()); 31 | SetMoveType(MoveType::None); 32 | SetSolid(Solid::Trigger); 33 | 34 | SetServerFlags(EntityServerFlags::NoClient); 35 | } 36 | 37 | /** 38 | * 39 | **/ 40 | void CLGBaseTrigger::InitPointTrigger() { 41 | const vec3_t HULL_MINS = { -16.f, -16.f, -36.f }; 42 | const vec3_t HULL_MAXS = { 16.f, 16.f, 36.f }; 43 | 44 | SetSize(HULL_MINS + HULL_MAXS); 45 | SetMoveType(MoveType::None); 46 | SetSolid(Solid::Trigger); 47 | 48 | // Ensure we got the proper no client flags. 49 | SetServerFlags(EntityServerFlags::NoClient); 50 | } 51 | 52 | /** 53 | * 54 | **/ 55 | void CLGBaseTrigger::SpawnKey(const std::string& key, const std::string& value) { 56 | // Wait. 57 | if (key == "wait") { 58 | // Parse. 59 | ParseKeyValue(key, value, waitTime); 60 | } 61 | // Parent class spawnkey. 62 | else { 63 | Base::SpawnKey(key, value); 64 | } 65 | } -------------------------------------------------------------------------------- /src/Game/Client/Entities/Base/CLGBaseTrigger.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * ClientGame BaseTrigger Entity. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | // Client Game GameEntity Interface. 13 | #include "CLGBasePacketEntity.h" 14 | 15 | 16 | class CLGBaseTrigger : public CLGBasePacketEntity { 17 | public: 18 | // 19 | // Constructor/Deconstructor. 20 | // 21 | CLGBaseTrigger(PODEntity *clEntity); 22 | virtual ~CLGBaseTrigger() = default; 23 | 24 | DefineAbstractClass( CLGBaseTrigger, CLGBasePacketEntity ); 25 | 26 | // 27 | // Interface functions. 28 | // 29 | virtual void SpawnKey(const std::string& key, const std::string& value) override; 30 | 31 | protected: 32 | virtual void InitBrushTrigger(); 33 | virtual void InitPointTrigger(); 34 | }; -------------------------------------------------------------------------------- /src/Game/Client/Entities/DebrisEntity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Debris entity, spawned only by using its static create method. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class CLGBaseLocalEntity; 13 | 14 | class DebrisEntity : public CLGBaseLocalEntity { 15 | public: 16 | /** 17 | * @brief Used by game modes to spawn server side gibs. 18 | * @param debrisser The entity that is about to spawn debris. 19 | **/ 20 | static DebrisEntity* Create(GameEntity* debrisser, const std::string& debrisModel, const vec3_t &origin, float speed); 21 | 22 | private: 23 | DebrisEntity(PODEntity *svEntity); 24 | virtual ~DebrisEntity() = default; 25 | 26 | public: 27 | DefineClass(DebrisEntity, CLGBaseLocalEntity); 28 | 29 | /** 30 | * 31 | * 32 | * Callback functions. 33 | * 34 | * 35 | **/ 36 | /** 37 | * @brief Die callback. 38 | **/ 39 | void DebrisEntityDie(GameEntity* inflictor, GameEntity* attacker, int32_t damage, const vec3_t& point); 40 | }; -------------------------------------------------------------------------------- /src/Game/Client/Entities/Func/FuncDoorRotating.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | class SVGBaseMover; 5 | class FuncDoor; 6 | 7 | class FuncDoorRotating : public FuncDoor { 8 | public: 9 | FuncDoorRotating( Entity* entity ); 10 | virtual ~FuncDoorRotating() = default; 11 | 12 | DefineMapClass( "func_door_rotating", FuncDoorRotating, FuncDoor ); 13 | 14 | void Spawn() override; 15 | void SpawnKey( const std::string& key, const std::string& value ) override; 16 | 17 | /** 18 | * @brief Implements triggering door state, effectively allowing a slight client-side prediction. 19 | **/ 20 | virtual void OnEventID(uint32_t eventID) override; 21 | 22 | protected: 23 | void DoGoUp() override; 24 | void DoGoDown() override; 25 | 26 | protected: 27 | float distance = 0.f; 28 | }; 29 | -------------------------------------------------------------------------------- /src/Game/Client/Entities/Func/FuncRotating.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client-Side FuncPlat Entity Support. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class CLGBaseEntity; 13 | class CLGBaseMover; 14 | 15 | class FuncRotating : public CLGBaseMover { 16 | public: 17 | FuncRotating( Entity* entity ); 18 | virtual ~FuncRotating() = default; 19 | 20 | DefineMapClass( "xfunc_rotating", FuncRotating, CLGBaseMover ); 21 | 22 | // Spawn flags 23 | static constexpr int32_t SF_StartOn = 1;//1 << 0; 24 | static constexpr int32_t SF_Reverse = 2;//1 << 1; 25 | static constexpr int32_t SF_XAxis = 4;//1 << 3; 26 | static constexpr int32_t SF_YAxis = 8;//1 << 2; 27 | static constexpr int32_t SF_HurtTouch = 16;//1 << 4; 28 | static constexpr int32_t SF_StopOnBlock = 32;//1 << 5; 29 | static constexpr int32_t SF_Animated = 64;//1 << 6; 30 | static constexpr int32_t SF_AnimatedFast = 128;//1 << 7; 31 | 32 | void Spawn() override; 33 | 34 | void SpawnKey(const std::string& key, const std::string& value) override; 35 | 36 | void RotatorBlocked( GameEntity* other ); 37 | void RotatorHurtTouch( GameEntity* self, GameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 38 | void RotatorUse( GameEntity* other, GameEntity* activator ); 39 | }; 40 | -------------------------------------------------------------------------------- /src/Game/Client/Entities/IClientGameEntity.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Client/Entities/IClientGameEntity.cpp -------------------------------------------------------------------------------- /src/Game/Client/Exports/Core.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client Game Core Interface Implementation. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | //--------------------------------------------------------------------- 13 | // Client Game Core IMPLEMENTATION. 14 | //--------------------------------------------------------------------- 15 | class ClientGameCore : public IClientGameExportCore { 16 | public: 17 | //! Destructor. 18 | virtual ~ClientGameCore() = default; 19 | 20 | /** 21 | * @brief Initializes the client game. 22 | **/ 23 | void Initialize() final; 24 | 25 | /** 26 | * @brief Shuts down the client game. 27 | **/ 28 | void Shutdown() final; 29 | 30 | private: 31 | 32 | }; 33 | 34 | -------------------------------------------------------------------------------- /src/Game/Client/HUD/ChatHUD.h: -------------------------------------------------------------------------------- 1 | // Something with license here, fucking tired of adding that, we all know its GPL shit. 2 | #pragma once 3 | 4 | class ClientGameScreen; 5 | 6 | /** 7 | * @brief Small utility class for the HUD's chat display functionality. 8 | **/ 9 | class ChatHUD { 10 | public: 11 | //! Constructor/Destructor. 12 | ChatHUD(ClientGameScreen *clgScreen); 13 | ~ChatHUD() = default; 14 | 15 | /** 16 | * @brief Clears the ChatHUD. 17 | **/ 18 | void Clear(); 19 | 20 | /** 21 | * @brief Draws the ChatHUD at given position. 22 | **/ 23 | void Draw(); 24 | 25 | /** 26 | * @brief Adds a new line of text to the queue. 27 | **/ 28 | void AddText(const std::string &str); 29 | 30 | private: 31 | //! Configures the maximum amount of characters allowed to display per line. 32 | static constexpr uint32_t MaxCharsPerLine = 150; 33 | static constexpr uint32_t MaxLines = 32; 34 | static constexpr uint32_t ChatLineMask = MaxLines - 1; 35 | 36 | //! Private struct used for the chatline queue. 37 | struct ChatLine { 38 | std::string text = ""; 39 | uint32_t timeStamp = 0; 40 | } chatLines[MaxLines]; 41 | 42 | //! Current chat headline. 43 | uint32_t chatHeadline = 0; 44 | 45 | //! Chatline Queue. 46 | //ChatLine chatLines[MaxLines]; 47 | 48 | //! Pointer to client game screen object. 49 | ClientGameScreen *screen; 50 | }; 51 | -------------------------------------------------------------------------------- /src/Game/Client/Main.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * General functionality things of the ClientGame module goes here. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | #include "ClientGameLocals.h" 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Game/Client/TemporaryEntities.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Client Game Temp Entities. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | void CLG_ParseTempEntity(void); 13 | void CLG_SmokeAndFlash(vec3_t origin); 14 | 15 | void CLG_RegisterTempEntityModels(void); 16 | void CLG_RegisterTempEntitySounds(void); 17 | 18 | void CLG_ClearTempEntities(void); 19 | void CLG_AddTempEntities(void); 20 | void CLG_InitTempEntities(void); 21 | 22 | /** 23 | * Game - Specific to the game itself. 24 | **/ 25 | // Stores parameters parsed from a temporary entity message.s 26 | extern tent_params_t teParameters; 27 | // Stores parameters parsed from a muzzleflash message. 28 | extern mz_params_t mzParameters; -------------------------------------------------------------------------------- /src/Game/Client/clgame.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetClientGameAPI 3 | -------------------------------------------------------------------------------- /src/Game/Server/AI/MonsterAI.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/AI/MonsterAI.cpp -------------------------------------------------------------------------------- /src/Game/Server/AI/MonsterAI.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/AI/MonsterAI.h -------------------------------------------------------------------------------- /src/Game/Server/Ballistics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * @brief Fires a single 9mm bullet. 5 | **/ 6 | void SVG_FireBullet(SVGBasePlayer *player, const vec3_t& start, const vec3_t& aimDirection, int32_t damage, int32_t kickForce, int32_t horizontalSpread, int32_t verticalSpread, int32_t meansOfDeath); -------------------------------------------------------------------------------- /src/Game/Server/ChaseCamera.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // chasecamera.h 6 | // 7 | // The ChaseCamera does just what it says. It's used to chase a client. 8 | // Think of spectator mode. 9 | // 10 | */ 11 | #ifndef __SVGAME_CHASECAMERA_H__ 12 | #define __SVGAME_CHASECAMERA_H__ 13 | 14 | class SVGBaseEntity; 15 | class SVGBasePlayer; 16 | 17 | void SVG_UpdateChaseCam(SVGBasePlayer* ent); 18 | void SVG_ChaseNext(SVGBasePlayer* ent); 19 | void SVG_ChasePrev(SVGBasePlayer* ent); 20 | void SVG_GetChaseTarget(SVGBasePlayer* ent); 21 | 22 | #endif -------------------------------------------------------------------------------- /src/Game/Server/Effects.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // effects.h 5 | // 6 | // 7 | // Gibs, to turning things into explosions. 8 | // 9 | #pragma once 10 | 11 | // 12 | // Forward declaration. 13 | // 14 | class IServerGameEntity; 15 | class SVGBasePlayer; 16 | 17 | // 18 | // Explosions. 19 | // 20 | void SVG_BecomeExplosion1(IServerGameEntity* self); 21 | void SVG_BecomeExplosion2(IServerGameEntity* self); 22 | 23 | // 24 | // Gibs. 25 | // 26 | void SVG_ThrowClientHead(SVGBasePlayer* self, int damage); 27 | -------------------------------------------------------------------------------- /src/Game/Server/Entities.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Entities.cpp -------------------------------------------------------------------------------- /src/Game/Server/Entities/Base/BodyCorpse.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // BodyCorpse.h 6 | // 7 | // Class entity to accommodate body corpses with. 8 | // These serve for client entities when they die, and get pushed into the body queue. 9 | // 10 | */ 11 | #ifndef __SVGAME_ENTITIES_BASE_BODYCORPSE_H__ 12 | #define __SVGAME_ENTITIES_BASE_BODYCORPSE_H__ 13 | 14 | class SVGBaseEntity; 15 | 16 | class BodyCorpse : public SVGBaseEntity { 17 | public: 18 | // Constructor/Deconstructor. 19 | BodyCorpse(PODEntity *svEntity); 20 | virtual ~BodyCorpse() = default; 21 | 22 | DefineClass(BodyCorpse, SVGBaseEntity); 23 | 24 | // 25 | // Interface functions. 26 | // 27 | void Precache() override; // Precaches data. 28 | void Spawn() override; // Spawns the entity. 29 | void Respawn() override; // Respawns the entity. 30 | void PostSpawn() override; // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 31 | void Think() override; // General entity thinking routine. 32 | 33 | void SpawnKey(const std::string& key, const std::string& value) override; 34 | 35 | // 36 | // Callback functions. 37 | // 38 | // 39 | void BodyCorpseDie(IServerGameEntity* inflictor, IServerGameEntity* attacker, int damage, const vec3_t& point); 40 | void BodyCorpseTouch(IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf); 41 | 42 | // 43 | // Get/Set 44 | // 45 | 46 | 47 | protected: 48 | 49 | private: 50 | 51 | }; 52 | 53 | #endif // __SVGAME_ENTITIES_BASE_BODYCORPSE_H__ -------------------------------------------------------------------------------- /src/Game/Server/Entities/Base/DebrisEntity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Debris entity, spawned only by using its static create method. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class SVGBaseEntity; 13 | 14 | class DebrisEntity : public SVGBaseEntity { 15 | public: 16 | /** 17 | * @brief Used by game modes to spawn server side gibs. 18 | * @param debrisser The entity that is about to spawn debris. 19 | **/ 20 | static DebrisEntity* Create(GameEntity* debrisser, const std::string& debrisModel, const vec3_t &origin, float speed); 21 | 22 | private: 23 | DebrisEntity(PODEntity *svEntity); 24 | virtual ~DebrisEntity() = default; 25 | 26 | public: 27 | DefineClass(DebrisEntity, SVGBaseEntity); 28 | 29 | /** 30 | * 31 | * 32 | * Callback functions. 33 | * 34 | * 35 | **/ 36 | /** 37 | * @brief Die callback. 38 | **/ 39 | void DebrisEntityDie(IServerGameEntity* inflictor, IServerGameEntity* attacker, int damage, const vec3_t& point); 40 | }; -------------------------------------------------------------------------------- /src/Game/Server/Entities/Base/SVGBaseItemAmmo.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * See header for information. 8 | * 9 | ***/ 10 | #include "../../ServerGameLocals.h" // SVGame. 11 | #include "../../Effects.h" // Effects. 12 | #include "../../Utilities.h" // Util funcs. 13 | #include "../../Physics/StepMove.h" // Stepmove funcs. 14 | 15 | // Server Game Base Entity. 16 | #include "SVGBaseEntity.h" 17 | #include "SVGBaseTrigger.h" 18 | #include "SVGBaseItem.h" 19 | #include "SVGBasePlayer.h" 20 | 21 | // Base Item Weapon. 22 | #include "SVGBaseItemAmmo.h" 23 | 24 | 25 | //! Constructor/Destructor. 26 | SVGBaseItemAmmo::SVGBaseItemAmmo(PODEntity *svEntity, const std::string& displayString, uint32_t identifier) 27 | : Base(svEntity, displayString, identifier) { 28 | 29 | } 30 | 31 | 32 | 33 | /*** 34 | * 35 | * Interface functions. 36 | * 37 | ***/ 38 | /** 39 | * @brief 40 | **/ 41 | void SVGBaseItemAmmo::Precache() { 42 | Base::Precache(); 43 | } 44 | 45 | /** 46 | * @brief 47 | **/ 48 | void SVGBaseItemAmmo::Spawn() { 49 | Base::Spawn(); 50 | } 51 | 52 | 53 | /*** 54 | * 55 | * Entity functions. 56 | * 57 | ***/ 58 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Base/SVGBaseTrigger.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * ServerGame BaseTrigger Entity. 8 | * 9 | ***/ 10 | #include "../../ServerGameLocals.h" // SVGame. 11 | #include "../../Effects.h" // Effects. 12 | #include "../../Entities.h" // Entities. 13 | #include "../../Utilities.h" // Util funcs. 14 | 15 | // Class Entities. 16 | #include "SVGBaseTrigger.h" 17 | 18 | // Included for delayed use. 19 | #include "../Trigger/TriggerDelayedUse.h" 20 | 21 | // Constructor/Deconstructor. 22 | SVGBaseTrigger::SVGBaseTrigger(PODEntity *svEntity) : Base(svEntity) {} 23 | 24 | // Interface functions. 25 | // 26 | // 27 | 28 | /** 29 | * 30 | **/ 31 | void SVGBaseTrigger::InitBrushTrigger() { 32 | SetModel(GetModel()); 33 | SetMoveType(MoveType::None); 34 | SetSolid(Solid::Trigger); 35 | 36 | SetServerFlags(EntityServerFlags::NoClient); 37 | } 38 | 39 | /** 40 | * 41 | **/ 42 | void SVGBaseTrigger::InitPointTrigger() { 43 | const vec3_t HULL_MINS = { -16.f, -16.f, -36.f }; 44 | const vec3_t HULL_MAXS = { 16.f, 16.f, 36.f }; 45 | 46 | SetSize(HULL_MINS + HULL_MAXS); 47 | SetMoveType(MoveType::None); 48 | SetSolid(Solid::Trigger); 49 | 50 | // Ensure we got the proper no client flags. 51 | SetServerFlags(EntityServerFlags::NoClient); 52 | } 53 | 54 | /** 55 | * 56 | **/ 57 | void SVGBaseTrigger::SpawnKey(const std::string& key, const std::string& value) { 58 | // Wait. 59 | if (key == "wait") { 60 | // Parse. 61 | ParseKeyValue(key, value, waitTime); 62 | } 63 | // Parent class spawnkey. 64 | else { 65 | Base::SpawnKey(key, value); 66 | } 67 | } -------------------------------------------------------------------------------- /src/Game/Server/Entities/Base/SVGBaseTrigger.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * ServerGame BaseTrigger Entity. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class SVGBaseTrigger : public SVGBaseEntity { 13 | public: 14 | // 15 | // Constructor/Deconstructor. 16 | // 17 | SVGBaseTrigger(PODEntity *svEntity); 18 | virtual ~SVGBaseTrigger() = default; 19 | 20 | DefineAbstractClass( SVGBaseTrigger, SVGBaseEntity ); 21 | 22 | // 23 | // Interface functions. 24 | // 25 | virtual void SpawnKey(const std::string& key, const std::string& value) override; 26 | 27 | protected: 28 | virtual void InitBrushTrigger(); 29 | virtual void InitPointTrigger(); 30 | }; -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncAreaportal.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // FuncAreaportal.cpp 5 | */ 6 | 7 | #include "../../ServerGameLocals.h" 8 | #include "../../Effects.h" 9 | #include "../../Entities.h" 10 | #include "../../Utilities.h" 11 | #include "../../Physics/StepMove.h" 12 | 13 | #include "../Base/SVGBaseEntity.h" 14 | 15 | #include "FuncAreaportal.h" 16 | 17 | //=============== 18 | // FuncAreaportal::ctor 19 | //=============== 20 | FuncAreaportal::FuncAreaportal( Entity* entity ) 21 | : Base( entity ) { 22 | 23 | } 24 | 25 | //=============== 26 | // FuncAreaportal::Spawn 27 | //=============== 28 | void FuncAreaportal::Spawn() { 29 | gi.SetAreaPortalState( GetStyle(), false ); 30 | } 31 | 32 | //=============== 33 | // FuncAreaportal::SpawnKey 34 | //=============== 35 | void FuncAreaportal::SpawnKey( const std::string& key, const std::string& value ) { 36 | if ( key == "style" ) { 37 | // Parsed integer. 38 | int32_t parsedInteger = 0; 39 | 40 | // Parse. 41 | ParseKeyValue( key, value, parsedInteger); 42 | 43 | // Set style. 44 | SetStyle(parsedInteger); 45 | } else { 46 | Base::SpawnKey( key, value ); 47 | } 48 | } 49 | 50 | //=============== 51 | // FuncAreaportal::PortalUse 52 | //=============== 53 | void FuncAreaportal::PortalUse( IServerGameEntity* other, IServerGameEntity* activator ) { 54 | ActivatePortal( !turnedOn ); 55 | } 56 | 57 | //=============== 58 | // FuncAreaportal::ActivatePortal 59 | //=============== 60 | void FuncAreaportal::ActivatePortal( bool open ) { 61 | gi.SetAreaPortalState( GetStyle(), open ); 62 | turnedOn = open; 63 | } 64 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncAreaportal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | 5 | //============================================= 6 | // FuncAreaportal 7 | // 8 | // This is a non-visible object that divides the world into 9 | // areas that are seperated when this portal is not activated. 10 | // Usually enclosed in the middle of a door. 11 | //============================================= 12 | class FuncAreaportal : public SVGBaseEntity { 13 | public: 14 | FuncAreaportal( Entity* entity ); 15 | virtual ~FuncAreaportal() = default; 16 | 17 | DefineMapClass( "func_areaportal", FuncAreaportal, SVGBaseEntity ); 18 | 19 | void Spawn() override; 20 | void SpawnKey( const std::string& key, const std::string& value ) override; 21 | 22 | // For triggering by mappers 23 | void PortalUse( IServerGameEntity* other, IServerGameEntity* activator ); 24 | // For doors and other autonomous entities 25 | void ActivatePortal( bool open ); 26 | 27 | protected: 28 | bool turnedOn{ false }; 29 | }; 30 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseMover; 4 | 5 | //=============== 6 | // A standard button, able to trigger entities once pressed, 7 | // and changes its texture depending on its state 8 | //=============== 9 | class FuncButton : public SVGBaseMover { 10 | public: 11 | FuncButton( PODEntity *svEntity ); 12 | virtual ~FuncButton() = default; 13 | 14 | DefineMapClass( "func_button", FuncButton, SVGBaseMover ); 15 | 16 | void Precache() override; 17 | void Spawn() override; 18 | void SpawnKey( const std::string& key, const std::string& value ) override; 19 | 20 | // These static methods here are required for mover logic, since the legacy code 21 | // we ported simply operates on global functions & function pointers 22 | static void OnButtonDone( IServerGameEntity* self ); 23 | void ButtonDone(); // The button is done moving, it is fully pressed 24 | void ButtonReturn(); // The button is returning from "pressed" to "sticking out" 25 | static void OnButtonWait( IServerGameEntity* self ); 26 | void ButtonWait(); // The button is waiting for further interactions 27 | void ButtonFire(); // The button has just been pressed, do something 28 | 29 | void ButtonUse( IServerGameEntity* other, IServerGameEntity* activator ); 30 | void ButtonTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 31 | void ButtonDie( IServerGameEntity* inflictor, IServerGameEntity* attacker, int damage, const vec3_t& point ); 32 | }; 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncDoorRotating.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | class SVGBaseMover; 5 | class FuncDoor; 6 | 7 | class FuncDoorRotating : public FuncDoor { 8 | public: 9 | FuncDoorRotating( Entity* entity ); 10 | virtual ~FuncDoorRotating() = default; 11 | 12 | DefineMapClass( "func_door_rotating", FuncDoorRotating, FuncDoor ); 13 | 14 | void Spawn() override; 15 | void SpawnKey( const std::string& key, const std::string& value ) override; 16 | 17 | protected: 18 | void DoGoUp() override; 19 | void DoGoDown() override; 20 | 21 | protected: 22 | float distance = 0.f; 23 | }; 24 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncExplosive.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class FuncExplosive : public SVGBaseEntity { 5 | public: 6 | FuncExplosive( Entity* entity ); 7 | virtual ~FuncExplosive() = default; 8 | 9 | DefineMapClass( "func_explosive", FuncExplosive, SVGBaseEntity ); 10 | 11 | // Spawn flags 12 | static constexpr int32_t SF_StartDeactivated = 1 << 0; 13 | static constexpr int32_t SF_Animated = 1 << 1; 14 | static constexpr int32_t SF_AnimatedFast = 1 << 2; 15 | 16 | void Spawn() override; 17 | 18 | void ExplosiveDeath( IServerGameEntity* inflictor, IServerGameEntity* attacker, int damage, const vec3_t& point ); 19 | void ExplosiveUse( IServerGameEntity* other, IServerGameEntity* activator ); 20 | void ExplosiveAppearUse( IServerGameEntity* other, IServerGameEntity* activator ); 21 | }; 22 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncRotating.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | class SVGBaseMover; 5 | 6 | class FuncRotating : public SVGBaseMover { 7 | public: 8 | FuncRotating( Entity* entity ); 9 | virtual ~FuncRotating() = default; 10 | 11 | DefineMapClass( "func_rotating", FuncRotating, SVGBaseMover ); 12 | 13 | // Spawn flags 14 | static constexpr int32_t SF_StartOn = 1;//1 << 0; 15 | static constexpr int32_t SF_Reverse = 2;//1 << 1; 16 | static constexpr int32_t SF_XAxis = 4;//1 << 3; 17 | static constexpr int32_t SF_YAxis = 8;//1 << 2; 18 | static constexpr int32_t SF_HurtTouch = 16;//1 << 4; 19 | static constexpr int32_t SF_StopOnBlock = 32;//1 << 5; 20 | static constexpr int32_t SF_Animated = 64;//1 << 6; 21 | static constexpr int32_t SF_AnimatedFast = 128;//1 << 7; 22 | 23 | void Spawn() override; 24 | 25 | void SpawnKey(const std::string& key, const std::string& value) override; 26 | 27 | void RotatorBlocked( IServerGameEntity* other ); 28 | void RotatorHurtTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 29 | void RotatorUse( IServerGameEntity* other, IServerGameEntity* activator ); 30 | }; 31 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncTimer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | 5 | //============================================= 6 | // FuncTimer 7 | // 8 | // A utility entity for mappers, that triggers its targets 9 | // every "wait" seconds + "random" if specified. 10 | // 11 | // NOTE: pausetime is currently always 0 12 | //============================================= 13 | class FuncTimer : public SVGBaseEntity { 14 | public: 15 | FuncTimer( Entity* entity ); 16 | virtual ~FuncTimer() = default; 17 | 18 | DefineMapClass( "func_timer", FuncTimer, SVGBaseEntity ); 19 | 20 | // Spawn flags 21 | static constexpr int32_t SF_StartOn = 1 << 0; 22 | 23 | void Spawn() override; 24 | void SpawnKey( const std::string& key, const std::string& value ) override; 25 | 26 | void TimerThink(); 27 | void TimerUse( IServerGameEntity* other, IServerGameEntity* activator ); 28 | 29 | protected: 30 | Frametime pauseTime = Frametime::zero(); 31 | Frametime randomTime = Frametime::zero(); 32 | }; 33 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncTrain.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | class SVGBaseTrigger; 5 | class SVGBaseMover; 6 | class PathCorner; 7 | 8 | class FuncTrain : public SVGBaseMover { 9 | public: 10 | FuncTrain( Entity* entity ); 11 | virtual ~FuncTrain() = default; 12 | 13 | DefineMapClass( "func_train", FuncTrain, SVGBaseMover ); 14 | 15 | // Spawnflags 16 | static constexpr int32_t SF_StartOn = 1 << 0; 17 | static constexpr int32_t SF_Toggled = 1 << 1; 18 | static constexpr int32_t SF_StopWhenBlocked = 1 << 2; 19 | 20 | void Precache() override; 21 | void Spawn() override; 22 | // Find the initial path_corner and teleport to it 23 | void PostSpawn() override; 24 | void SpawnKey( const std::string& key, const std::string& value ) override; 25 | 26 | void TrainUse( IServerGameEntity* other, IServerGameEntity* activator ); 27 | 28 | // Finds the next path corner target, if any. 29 | void FindNextTarget(); 30 | // Travels to the next path_corner 31 | void NextCornerThink(); 32 | // Resumes the path when the train is used but was stopped before 33 | void ResumePath(); 34 | // Waits at the arrived path_corner 35 | void WaitAtCorner(); 36 | // Callback for the brush movement code 37 | static void OnWaitAtCorner( IServerGameEntity* ent ); 38 | // The train has been blocked by an obstacle, damage it or stop? 39 | void TrainBlocked( IServerGameEntity* other ); 40 | 41 | private: 42 | PathCorner* currentPathEntity = nullptr; 43 | GameTime damageDebounceTime = GameTime::zero(); 44 | }; 45 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Func/FuncWall.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class FuncWall : public SVGBaseEntity { 5 | public: 6 | FuncWall( Entity* entity ); 7 | virtual ~FuncWall() = default; 8 | 9 | DefineMapClass( "func_wall", FuncWall, SVGBaseEntity ); 10 | 11 | // Spawn flags 12 | static constexpr int32_t SF_TriggerSpawn = 1 << 0; 13 | static constexpr int32_t SF_Toggle = 1 << 1; 14 | static constexpr int32_t SF_StartOn = 1 << 2; 15 | static constexpr int32_t SF_Animated = 1 << 3; 16 | static constexpr int32_t SF_AnimatedFast = 1 << 4; 17 | 18 | void Spawn() override; 19 | 20 | void WallUse( IServerGameEntity* other, IServerGameEntity* activator ); 21 | }; 22 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoNotNull.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // PlayerStart.cpp 6 | // 7 | // 8 | */ 9 | #include "../../ServerGameLocals.h" // SVGame. 10 | #include "../Base/SVGBaseEntity.h" // BaseEntity. 11 | #include "InfoNotNull.h" // Class. 12 | 13 | // Constructor/Deconstructor. 14 | InfoNotNull::InfoNotNull(PODEntity *svEntity) 15 | : Base(svEntity) { 16 | 17 | } 18 | 19 | // Interface functions. 20 | //=============== 21 | // InfoNotNull::Precache 22 | // 23 | //=============== 24 | void InfoNotNull::Precache() { 25 | Base::Precache(); 26 | } 27 | 28 | //=============== 29 | // InfoNotNull::Spawn 30 | // 31 | //=============== 32 | void InfoNotNull::Spawn() { 33 | Base::Spawn(); 34 | 35 | SetInUse(true); 36 | SetMins(vec3_t{-16.f, -16.f, -16.f}); 37 | SetMaxs(vec3_t{16.f, 16.f, 16.f}); 38 | SetMoveType(MoveType::None); 39 | SetSolid(Solid::Not); 40 | std::string x = GetTargetName(); 41 | gi.DPrintf("InfoNotNull: TargetName: %s\n", x.c_str()); 42 | LinkEntity(); 43 | } 44 | 45 | //=============== 46 | // InfoNotNull::PostSpawn 47 | // 48 | //=============== 49 | void InfoNotNull::PostSpawn() { 50 | Base::PostSpawn(); 51 | } 52 | 53 | //=============== 54 | // InfoNotNull::Think 55 | // 56 | //=============== 57 | void InfoNotNull::Think() { 58 | // Parent think. 59 | Base::Think(); 60 | } 61 | 62 | //=============== 63 | // InfoNotNull::SpawnKey 64 | // 65 | //=============== 66 | void InfoNotNull::SpawnKey(const std::string& key, const std::string& value) { 67 | Base::SpawnKey(key, value); 68 | } 69 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoNotNull.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // InfoNotNull.h 6 | // 7 | // 8 | */ 9 | #pragma once 10 | 11 | class SVGBaseEntity; 12 | 13 | class InfoNotNull : public SVGBaseEntity { 14 | public: 15 | // Constructor/Deconstructor. 16 | InfoNotNull(PODEntity *svEntity); 17 | virtual ~InfoNotNull() = default; 18 | 19 | DefineMapClass( "info_notnull", InfoNotNull, SVGBaseEntity ); 20 | 21 | // Interface functions. 22 | virtual void Precache() final; // Precaches data. 23 | virtual void Spawn() final; // Spawns the entity. 24 | virtual void PostSpawn() final; // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 25 | virtual void Think() final; // General entity thinking routine. 26 | 27 | virtual void SpawnKey(const std::string& key, const std::string& value) final; 28 | 29 | private: 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoNull.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // InfoNull.cpp 5 | */ 6 | 7 | #include "../../ServerGameLocals.h" 8 | #include "../../Effects.h" 9 | #include "../../Entities.h" 10 | #include "../../Utilities.h" 11 | #include "../../Physics/StepMove.h" 12 | 13 | #include "../Base/SVGBaseEntity.h" 14 | 15 | // This entity never spawns, and as such, no edicts will be wasted on it during spawn time 16 | class InfoNull : public SVGBaseEntity 17 | { 18 | public: 19 | DefineDummyMapClass( "info_null", InfoNull, SVGBaseEntity ); 20 | }; 21 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerCoop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // PlayerStart.cpp 6 | // 7 | // 8 | */ 9 | #include "../../ServerGameLocals.h" // SVGame. 10 | #include "../Base/SVGBaseEntity.h" // BaseEntity. 11 | #include "InfoPlayerStart.h" 12 | #include "InfoPlayerCoop.h" // Class. 13 | 14 | // Constructor/Deconstructor. 15 | InfoPlayerCoop::InfoPlayerCoop(PODEntity *svEntity) 16 | : InfoPlayerStart(svEntity) { 17 | 18 | } 19 | 20 | // Interface functions. 21 | //=============== 22 | // InfoPlayerStart::Precache 23 | // 24 | //=============== 25 | void InfoPlayerCoop::Precache() { 26 | Base::Precache(); 27 | } 28 | 29 | //=============== 30 | // InfoPlayerStart::Spawn 31 | // 32 | //=============== 33 | void InfoPlayerCoop::Spawn() { 34 | Base::Spawn(); 35 | } 36 | 37 | //=============== 38 | // InfoPlayerCoop::PostSpawn 39 | // 40 | //=============== 41 | void InfoPlayerCoop::PostSpawn() { 42 | Base::PostSpawn(); 43 | } 44 | 45 | //=============== 46 | // InfoPlayerCoop::Think 47 | // 48 | //=============== 49 | void InfoPlayerCoop::Think() { 50 | // Parent think. 51 | Base::Think(); 52 | } 53 | 54 | //=============== 55 | // InfoPlayerCoop::SpawnKey 56 | // 57 | //=============== 58 | void InfoPlayerCoop::SpawnKey(const std::string& key, const std::string& value) { 59 | Base::SpawnKey(key, value); 60 | } 61 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerCoop.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // InfoPlayerCoop.h 6 | // 7 | // 8 | */ 9 | #pragma once 10 | 11 | class SVGBaseEntity; 12 | class InfoPlayerStart; 13 | 14 | class InfoPlayerCoop : public InfoPlayerStart { 15 | public: 16 | // Constructor/Deconstructor. 17 | InfoPlayerCoop(PODEntity *svEntity); 18 | virtual ~InfoPlayerCoop() = default; 19 | 20 | DefineMapClass( "info_player_coop", InfoPlayerCoop, InfoPlayerStart ); 21 | 22 | // Interface functions. 23 | void Precache(); // Precaches data. 24 | void Spawn(); // Spawns the entity. 25 | void PostSpawn(); // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 26 | void Think(); // General entity thinking routine. 27 | 28 | void SpawnKey(const std::string& key, const std::string& value) override; 29 | 30 | private: 31 | 32 | }; -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerDeathmatch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // InfoPlayerDeathmatch.cpp 6 | // 7 | // 8 | */ 9 | #include "../../ServerGameLocals.h" // SVGame. 10 | #include "../Base/SVGBaseEntity.h" // BaseEntity. 11 | #include "InfoPlayerStart.h" 12 | #include "InfoPlayerDeathmatch.h" // Class. 13 | 14 | // Constructor/Deconstructor. 15 | InfoPlayerDeathmatch::InfoPlayerDeathmatch(PODEntity *svEntity) 16 | : InfoPlayerStart(svEntity) { 17 | 18 | } 19 | 20 | // Interface functions. 21 | //=============== 22 | // InfoPlayerDeathmatch::Precache 23 | // 24 | //=============== 25 | void InfoPlayerDeathmatch::Precache() { 26 | Base::Precache(); 27 | } 28 | 29 | //=============== 30 | // InfoPlayerDeathmatch::Spawn 31 | // 32 | //=============== 33 | void InfoPlayerDeathmatch::Spawn() { 34 | Base::Spawn(); 35 | } 36 | 37 | //=============== 38 | // InfoPlayerDeathmatch::PostSpawn 39 | // 40 | //=============== 41 | void InfoPlayerDeathmatch::PostSpawn() { 42 | Base::PostSpawn(); 43 | } 44 | 45 | //=============== 46 | // InfoPlayerDeathmatch::Think 47 | // 48 | //=============== 49 | void InfoPlayerDeathmatch::Think() { 50 | // Parent think. 51 | Base::Think(); 52 | } 53 | 54 | //=============== 55 | // InfoPlayerDeathmatch::SpawnKey 56 | // 57 | //=============== 58 | void InfoPlayerDeathmatch::SpawnKey(const std::string& key, const std::string& value) { 59 | Base::SpawnKey(key, value); 60 | } 61 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerDeathmatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // InfoPlayerDeathmatch.h 6 | // 7 | // 8 | */ 9 | #pragma once 10 | 11 | class SVGBaseEntity; 12 | class InfoPlayerStart; 13 | 14 | class InfoPlayerDeathmatch : public InfoPlayerStart { 15 | public: 16 | // Constructor/Deconstructor. 17 | InfoPlayerDeathmatch(PODEntity *svEntity); 18 | virtual ~InfoPlayerDeathmatch() = default; 19 | 20 | DefineMapClass( "info_player_deathmatch", InfoPlayerDeathmatch, InfoPlayerStart ); 21 | 22 | // Interface functions. 23 | void Precache(); // Precaches data. 24 | void Spawn(); // Spawns the entity. 25 | void PostSpawn(); // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 26 | void Think(); // General entity thinking routine. 27 | 28 | void SpawnKey(const std::string& key, const std::string& value) override; 29 | 30 | private: 31 | 32 | }; -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerIntermission.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // PlayerStart.cpp 6 | // 7 | // 8 | */ 9 | #include "../../ServerGameLocals.h" // SVGame. 10 | #include "../Base/SVGBaseEntity.h" // BaseEntity. 11 | #include "InfoPlayerStart.h" 12 | #include "InfoPlayerIntermission.h" // Class. 13 | 14 | // Constructor/Deconstructor. 15 | InfoPlayerIntermission::InfoPlayerIntermission(PODEntity *svEntity) 16 | : InfoPlayerStart(svEntity) { 17 | 18 | } 19 | 20 | // Interface functions. 21 | //=============== 22 | // InfoPlayerStart::Precache 23 | // 24 | //=============== 25 | void InfoPlayerIntermission::Precache() { 26 | Base::Precache(); 27 | } 28 | 29 | //=============== 30 | // InfoPlayerStart::Spawn 31 | // 32 | //=============== 33 | void InfoPlayerIntermission::Spawn() { 34 | Base::Spawn(); 35 | } 36 | 37 | //=============== 38 | // InfoPlayerIntermission::PostSpawn 39 | // 40 | //=============== 41 | void InfoPlayerIntermission::PostSpawn() { 42 | Base::PostSpawn(); 43 | } 44 | 45 | //=============== 46 | // InfoPlayerIntermission::Think 47 | // 48 | //=============== 49 | void InfoPlayerIntermission::Think() { 50 | // Parent think. 51 | Base::Think(); 52 | } 53 | 54 | //=============== 55 | // InfoPlayerIntermission::SpawnKey 56 | // 57 | //=============== 58 | void InfoPlayerIntermission::SpawnKey(const std::string& key, const std::string& value) { 59 | Base::SpawnKey(key, value); 60 | } 61 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerIntermission.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // InfoPlayerIntermission.h 6 | // 7 | // 8 | */ 9 | #pragma once 10 | 11 | class SVGBaseEntity; 12 | class InfoPlayerStart; 13 | 14 | class InfoPlayerIntermission : public InfoPlayerStart { 15 | public: 16 | // Constructor/Deconstructor. 17 | InfoPlayerIntermission(PODEntity *svEntity); 18 | virtual ~InfoPlayerIntermission() = default; 19 | 20 | DefineMapClass( "info_player_intermission", InfoPlayerIntermission, InfoPlayerStart ); 21 | 22 | // Interface functions. 23 | void Precache(); // Precaches data. 24 | void Spawn(); // Spawns the entity. 25 | void PostSpawn(); // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 26 | void Think(); // General entity thinking routine. 27 | 28 | void SpawnKey(const std::string& key, const std::string& value) override; 29 | 30 | private: 31 | 32 | }; 33 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerStart.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // PlayerStart.cpp 6 | // 7 | // 8 | */ 9 | #include "../../ServerGameLocals.h" // SVGame. 10 | #include "../Base/SVGBaseEntity.h" // BaseEntity. 11 | #include "InfoPlayerStart.h" // Class. 12 | 13 | // Constructor/Deconstructor. 14 | InfoPlayerStart::InfoPlayerStart(PODEntity *svEntity) 15 | : SVGBaseEntity(svEntity) { 16 | 17 | } 18 | 19 | // Interface functions. 20 | //=============== 21 | // InfoPlayerStart::Precache 22 | // 23 | //=============== 24 | void InfoPlayerStart::Precache() { 25 | Base::Precache(); 26 | } 27 | 28 | //=============== 29 | // InfoPlayerStart::Spawn 30 | // 31 | //=============== 32 | void InfoPlayerStart::Spawn() { 33 | Base::Spawn(); 34 | } 35 | 36 | //=============== 37 | // InfoPlayerStart::PostSpawn 38 | // 39 | //=============== 40 | void InfoPlayerStart::PostSpawn() { 41 | Base::PostSpawn(); 42 | } 43 | 44 | //=============== 45 | // InfoPlayerStart::Think 46 | // 47 | //=============== 48 | void InfoPlayerStart::Think() { 49 | // Parent think. 50 | Base::Think(); 51 | } 52 | 53 | //=============== 54 | // InfoPlayerStart::SpawnKey 55 | // 56 | //=============== 57 | void InfoPlayerStart::SpawnKey(const std::string& key, const std::string& value) { 58 | Base::SpawnKey(key, value); 59 | } 60 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Info/InfoPlayerStart.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // InfoPlayerStart.h 6 | // 7 | // 8 | */ 9 | #pragma once 10 | 11 | class SVGBaseEntity; 12 | 13 | class InfoPlayerStart : public SVGBaseEntity { 14 | public: 15 | // Constructor/Deconstructor. 16 | InfoPlayerStart(PODEntity *svEntity); 17 | virtual ~InfoPlayerStart() = default; 18 | 19 | DefineMapClass( "info_player_start", InfoPlayerStart, SVGBaseEntity ); 20 | 21 | // Interface functions. 22 | void Precache() override; // Precaches data. 23 | void Spawn() override; // Spawns the entity. 24 | void PostSpawn() override; // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 25 | void Think() override; // General entity thinking routine. 26 | 27 | void SpawnKey(const std::string& key, const std::string& value) override; 28 | 29 | private: 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Items/ItemAmmo9mm.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Basic 9mm ammo clip item. Used for most short range weapons. 8 | * 9 | * 10 | ***/ 11 | #pragma once 12 | 13 | class SVGBaseEntity; 14 | class SVGBaseItem; 15 | 16 | class ItemAmmo9mm : public SVGBaseItemAmmo { 17 | public: 18 | 19 | //! Constructor/Deconstructor. 20 | ItemAmmo9mm(PODEntity *svEntity, const std::string& displayString, uint32_t identifier); 21 | virtual ~ItemAmmo9mm() = default; 22 | 23 | //! Abstract Class TypeInfo registry. 24 | DefineItemMapClass("9 Millimeter Ammo", "ammo_9mm", ItemID::Ammo9mm, "item_ammo_9mm", ItemAmmo9mm, SVGBaseItemAmmo); 25 | 26 | 27 | /*** 28 | * Item flags 29 | ***/ 30 | //static constexpr int32_t IF_IgnoreMaxHealth = 1 << 0; 31 | //static constexpr int32_t IF_TimedHealth = 1 << 1; 32 | 33 | 34 | /*** 35 | * 36 | * Interface implementation functions. 37 | * 38 | ***/ 39 | virtual void Precache() override; // Precaches data. 40 | virtual void Spawn() override; // Spawns the entity. 41 | 42 | 43 | /*** 44 | * 45 | * Entity functions. 46 | * 47 | ***/ 48 | /** 49 | * @return The maximum ammo cap limit to carry around for this ammo type. 50 | **/ 51 | virtual uint32_t GetCapLimit() { return 144; } 52 | 53 | 54 | /** 55 | * 56 | * Callback functions. 57 | * 58 | ***/ 59 | qboolean Ammo9mmPickup(IServerGameEntity *other); 60 | 61 | private: 62 | 63 | }; 64 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Items/ItemHealthMega.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Simple health item class, "mega", cuz it heals you to 100%. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | class SVGBaseEntity; 13 | class SVGBaseItem; 14 | 15 | class ItemHealthMega : public SVGBaseItem { 16 | public: 17 | // Constructor/Deconstructor. 18 | ItemHealthMega(PODEntity *svEntity, const std::string& displayString, uint32_t identifier); 19 | virtual ~ItemHealthMega() = default; 20 | 21 | DefineItemMapClass("Mega Health", "megahealth", ItemID::MegaHealth, "item_health_mega", ItemHealthMega, SVGBaseItem); 22 | 23 | // Item flags 24 | static constexpr int32_t IF_IgnoreMaxHealth = 1 << 0; 25 | static constexpr int32_t IF_TimedHealth = 1 << 1; 26 | 27 | // 28 | // Interface functions. 29 | // 30 | virtual void Precache() override; // Precaches data. 31 | virtual void Spawn() override; // Spawns the entity. 32 | virtual void Respawn() override; // Respawns the entity. 33 | virtual void PostSpawn() override; // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 34 | virtual void Think() override; // General entity thinking routine. 35 | 36 | // 37 | // Callback Functions. 38 | // 39 | //void HealthMegaUse( SVGBaseEntity* caller, SVGBaseEntity* activator ); 40 | void HealthMegaThink(void); 41 | //void HealthMegaDie(SVGBaseEntity* inflictor, SVGBaseEntity* attacker, int damage, const vec3_t& point); 42 | //void HealthMegaTouch(IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf); 43 | qboolean HealthMegaPickup(IServerGameEntity *other); 44 | 45 | private: 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Items/ItemWeaponKnife.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Entities/Items/ItemWeaponKnife.cpp -------------------------------------------------------------------------------- /src/Game/Server/Entities/Items/ItemWeaponKnife.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Entities/Items/ItemWeaponKnife.h -------------------------------------------------------------------------------- /src/Game/Server/Entities/Path/PathCorner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // PathCorner.cpp 5 | */ 6 | 7 | #include "../../ServerGameLocals.h" 8 | #include "../../Entities.h" 9 | 10 | #include "PathCorner.h" 11 | 12 | //=============== 13 | // PathCorner::ctor 14 | //=============== 15 | PathCorner::PathCorner( Entity* entity ) 16 | : Base( entity ) { 17 | 18 | } 19 | 20 | //=============== 21 | // PathCorner::Spawn 22 | //=============== 23 | void PathCorner::Spawn() { 24 | Base::Spawn(); 25 | 26 | if ( GetTargetName().empty()) { 27 | gi.DPrintf( "path_corner with no targetname at %s\n", vec3_to_cstr( GetOrigin() ) ); 28 | return Remove(); 29 | } 30 | 31 | SetSolid( Solid::Trigger ); 32 | SetMaxs( BboxSize ); 33 | SetMins( vec3_negate( BboxSize ) ); 34 | SetServerFlags(GetServerFlags() | EntityServerFlags::NoClient); 35 | LinkEntity(); 36 | } 37 | 38 | //=============== 39 | // PathCorner::SpawnKey 40 | //=============== 41 | void PathCorner::SpawnKey( const std::string& key, const std::string& value ) { 42 | if ( key == "pathtarget" ) { 43 | pathTarget = value; 44 | } else { 45 | return Base::SpawnKey( key, value ); 46 | } 47 | } 48 | 49 | //=============== 50 | // PathCorner::OnReachedCorner 51 | //=============== 52 | void PathCorner::OnReachedCorner( SVGBaseEntity* traveler ) { 53 | // Not implemented 54 | } 55 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Path/PathCorner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | 5 | class PathCorner : public SVGBaseEntity { 6 | public: 7 | PathCorner( Entity* entity ); 8 | virtual ~PathCorner() = default; 9 | 10 | DefineMapClass( "path_corner", PathCorner, SVGBaseEntity ); 11 | 12 | const vec3_t BboxSize = vec3_t( 8.0f, 8.0f, 8.0f ); 13 | 14 | // Spawnflags 15 | static constexpr int32_t SF_Teleport = 1 << 0; 16 | 17 | void Spawn() override; 18 | void SpawnKey( const std::string& key, const std::string& value ) override; 19 | 20 | // For AI 21 | virtual void OnReachedCorner( SVGBaseEntity* traveler ); 22 | 23 | inline const char* GetPathTarget() override { 24 | return pathTarget.c_str(); 25 | } 26 | 27 | private: 28 | std::string pathTarget; 29 | }; 30 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Path/PathMonsterGoal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseEntity; 4 | 5 | class PathMonsterGoal : public SVGBaseEntity { 6 | public: 7 | PathMonsterGoal( Entity* entity ); 8 | virtual ~PathMonsterGoal() = default; 9 | 10 | DefineMapClass( "path_monster_goal", PathMonsterGoal, SVGBaseEntity ); 11 | 12 | // Spawnflags 13 | static constexpr int32_t SF_Teleport = 1 << 0; 14 | 15 | void Spawn() override; 16 | void SpawnKey( const std::string& key, const std::string& value ) override; 17 | 18 | void PathMonsterGoalTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 19 | //void PathMonsterGoalEnable(IServerGameEntity* other, IServerGameEntity* activator); 20 | void PathMonsterGoalUse( IServerGameEntity* other, IServerGameEntity* activator ); 21 | 22 | inline const std::string GetMonstersString() { 23 | return strMonsters; 24 | } 25 | 26 | private: 27 | //! When set, will make the monster prepare to navigate to its next 28 | //! goal. 29 | std::string strNextGoal = ""; 30 | //! Determines which monsters can trigger this goal on 'touch'. 31 | //! When empty, all monsters will trigger this goal on touch. 32 | std::string strMonsters = ""; 33 | }; 34 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Target/TargetEarthquake.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TargetEarthquake : public SVGBaseEntity { 5 | public: 6 | TargetEarthquake( Entity* entity ); 7 | virtual ~TargetEarthquake() = default; 8 | 9 | DefineMapClass( "target_earthquake", TargetEarthquake, SVGBaseEntity ); 10 | 11 | void Spawn() override; 12 | void SpawnKey( const std::string& key, const std::string& value ) override; 13 | 14 | void QuakeUse( IServerGameEntity* other, IServerGameEntity* activator ); 15 | void QuakeThink(); 16 | 17 | private: 18 | float severity{ 200.0f }; 19 | Frametime duration = 5s; 20 | GameTime timeStamp = GameTime::zero(); 21 | GameTime lastQuakeTime = GameTime::zero(); 22 | }; 23 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Target/TargetExplosion.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TargetExplosion : public SVGBaseEntity { 5 | public: 6 | TargetExplosion( Entity* entity ); 7 | virtual ~TargetExplosion() = default; 8 | 9 | DefineMapClass( "target_explosion", TargetExplosion, SVGBaseEntity ); 10 | 11 | void Spawn() override; 12 | 13 | void ExplosionUse( IServerGameEntity* other, IServerGameEntity* activator ); 14 | void ExplosionThink(); 15 | }; 16 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Target/TargetSpeaker.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TargetSpeaker : public SVGBaseEntity { 5 | public: 6 | TargetSpeaker( Entity* entity ); 7 | virtual ~TargetSpeaker() = default; 8 | 9 | DefineMapClass( "target_speaker", TargetSpeaker, SVGBaseEntity ); 10 | 11 | static constexpr int32_t SF_LoopedOn = 1 << 0; 12 | static constexpr int32_t SF_LoopedOff = 1 << 1; 13 | static constexpr int32_t SF_Reliable = 1 << 2; 14 | 15 | void Spawn() override; 16 | void SpawnKey( const std::string& key, const std::string& value ) override; 17 | 18 | void SpeakerUse( IServerGameEntity* other, IServerGameEntity* activator ); 19 | 20 | private: 21 | std::string soundFile; 22 | float volume{ 1.0f }; 23 | float attenuation{ 1.0f }; 24 | }; 25 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Target/TargetTempEntity.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // TargetTempEntity.cpp 5 | */ 6 | 7 | #include "../../ServerGameLocals.h" 8 | #include "../../Effects.h" 9 | #include "../../Entities.h" 10 | #include "../../Utilities.h" 11 | 12 | #include "../Base/SVGBaseEntity.h" 13 | 14 | #include "TargetTempEntity.h" 15 | 16 | //=============== 17 | // TargetTempEntity::ctor 18 | //=============== 19 | TargetTempEntity::TargetTempEntity( Entity* entity ) 20 | : Base( entity ) { 21 | 22 | } 23 | 24 | //=============== 25 | // TargetTempEntity::Spawn 26 | //=============== 27 | void TargetTempEntity::Spawn() { 28 | SetUseCallback( &TargetTempEntity::TempEntityUse ); 29 | } 30 | 31 | //=============== 32 | // TargetTempEntity::TempEntityUse 33 | //=============== 34 | void TargetTempEntity::TempEntityUse( IServerGameEntity* other, IServerGameEntity* activator ) { 35 | gi.MSG_WriteUint8(ServerGameCommand::TempEntityEvent);//WriteByte( ServerGameCommand::TempEntityEvent ); 36 | gi.MSG_WriteUint8(GetStyle());//WriteByte( GetStyle() ); 37 | gi.MSG_WriteVector3( GetOrigin(), false );//WriteVector3( GetOrigin() ); 38 | gi.Multicast( GetOrigin(), Multicast::PVS ); 39 | } 40 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Target/TargetTempEntity.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TargetTempEntity : public SVGBaseEntity { 5 | public: 6 | TargetTempEntity( Entity* entity ); 7 | virtual ~TargetTempEntity() = default; 8 | 9 | DefineMapClass( "target_temp_entity", TargetTempEntity, SVGBaseEntity ); 10 | 11 | void Spawn() override; 12 | 13 | void TempEntityUse( IServerGameEntity* other, IServerGameEntity* activator ); 14 | }; 15 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerAutoDoor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseTrigger; 4 | 5 | //=============== 6 | // Automatic trigger for func_door 7 | //=============== 8 | class TriggerAutoDoor : public SVGBaseTrigger { 9 | public: 10 | TriggerAutoDoor( Entity* entity ); 11 | virtual ~TriggerAutoDoor() = default; 12 | 13 | DefineClass( TriggerAutoDoor, SVGBaseTrigger ); 14 | 15 | void Spawn() override; 16 | // Responds to players touching this trigger 17 | void AutoDoorTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 18 | // Creates an automatic door trigger and sets everything up for it 19 | static TriggerAutoDoor* Create( SVGBaseEntity* ownerEntity, vec3_t ownerMins, vec3_t ownerMaxs ); 20 | 21 | protected: 22 | GameTime debounceTouchTime = GameTime::zero(); 23 | }; 24 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerAutoPlatform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SVGBaseTrigger; 4 | 5 | //=============== 6 | // Automatic trigger for func_plat 7 | //=============== 8 | class TriggerAutoPlatform : public SVGBaseTrigger { 9 | public: 10 | TriggerAutoPlatform( Entity* entity ); 11 | virtual ~TriggerAutoPlatform() = default; 12 | 13 | DefineClass( TriggerAutoPlatform, SVGBaseTrigger ); 14 | 15 | void Spawn() override; 16 | 17 | // Responds to players touching this trigger 18 | void AutoPlatformTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 19 | // Creates an automatic platform trigger and sets everything up for it 20 | static TriggerAutoPlatform* Create( SVGBaseEntity* ownerEntity, vec3_t ownerMins, vec3_t ownerMaxs ); 21 | 22 | protected: 23 | GameTime debounceTouchTime = GameTime::zero(); 24 | }; 25 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerCounter.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TriggerCounter : public SVGBaseTrigger { 5 | public: 6 | TriggerCounter( Entity* entity ); 7 | virtual ~TriggerCounter() = default; 8 | 9 | DefineMapClass( "trigger_counter", TriggerCounter, SVGBaseTrigger ); 10 | 11 | constexpr static int32_t SF_NoMessage = 1 << 0; 12 | 13 | void Spawn() override; 14 | void SpawnKey( const std::string& key, const std::string& value ); 15 | 16 | void CounterUse( IServerGameEntity* other, IServerGameEntity* activator ); 17 | 18 | private: 19 | uint32_t count{ 2U }; 20 | }; 21 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerDelayedUse.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // TriggerDelayedUse.h 6 | // 7 | // Trigger that is used for delayed use callback firing. 8 | // 9 | */ 10 | #ifndef __SVGAME_ENTITIES_TRIGGER_TRIGGERDELAYEDUSE_H__ 11 | #define __SVGAME_ENTITIES_TRIGGER_TRIGGERDELAYEDUSE_H__ 12 | 13 | class TriggerDelayedUse : public SVGBaseTrigger { 14 | public: 15 | // 16 | // Constructor/Deconstructor. 17 | // 18 | TriggerDelayedUse(PODEntity *svEntity); 19 | virtual ~TriggerDelayedUse() = default; 20 | 21 | DefineClass( TriggerDelayedUse, SVGBaseTrigger ); 22 | 23 | // 24 | // Interface functions. 25 | // 26 | void Precache() override; // Precaches data. 27 | void Spawn() override; // Spawns the entity. 28 | void Respawn() override; // Respawns the entity. 29 | void PostSpawn() override; // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 30 | void Think() override; // General entity thinking routine. 31 | 32 | void SpawnKey(const std::string& key, const std::string& value) override; 33 | 34 | // 35 | // Callback functions. 36 | // 37 | void TriggerDelayedUseThink(void); 38 | 39 | // 40 | // Get/Set 41 | // 42 | 43 | protected: 44 | // 45 | // Other base entity members. (These were old fields in edict_T back in the day.) 46 | // 47 | // The time this entity has last been hurting anyone else. It is used for the slow damage flag. 48 | //float lastHurtTime; 49 | 50 | // 51 | // Entity pointers. 52 | // 53 | 54 | public: 55 | 56 | }; 57 | 58 | #endif // __SVGAME_ENTITIES_TRIGGER_TRIGGERDELAYEDUSE_H__ -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerGravity.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // TriggerGravity.cpp 5 | */ 6 | 7 | #include "../../ServerGameLocals.h" 8 | #include "../../Effects.h" 9 | #include "../../Entities.h" 10 | #include "../../Utilities.h" 11 | 12 | #include "../Base/SVGBaseEntity.h" 13 | #include "../Base/SVGBaseTrigger.h" 14 | 15 | #include "TriggerGravity.h" 16 | 17 | //=============== 18 | // TriggerGravity::ctor 19 | //=============== 20 | TriggerGravity::TriggerGravity( Entity* entity ) 21 | : Base( entity ) { 22 | 23 | } 24 | 25 | //=============== 26 | // TriggerGravity::Spawn 27 | //=============== 28 | void TriggerGravity::Spawn() { 29 | if ( GetGravity() == 0.0f ) { 30 | gi.DPrintf( "trigger_gravity without gravity set at %s\n", vec3_to_cstr( GetOrigin() ) ); 31 | Remove(); 32 | return; 33 | } 34 | 35 | InitBrushTrigger(); 36 | SetTouchCallback( &TriggerGravity::GravityTouch ); 37 | } 38 | 39 | //=============== 40 | // TriggerGravity::SpawnKey 41 | //=============== 42 | void TriggerGravity::SpawnKey( const std::string& key, const std::string& value ) { 43 | if ( key == "gravity" ) { 44 | SetGravity( std::stof( value ) ); 45 | } else { 46 | return Base::SpawnKey( key, value ); 47 | } 48 | } 49 | 50 | //=============== 51 | // TriggerGravity::GravityTouch 52 | //=============== 53 | void TriggerGravity::GravityTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ) { 54 | other->SetGravity( GetGravity() ); 55 | } 56 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerGravity.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TriggerGravity : public SVGBaseTrigger { 5 | public: 6 | TriggerGravity( Entity* entity ); 7 | virtual ~TriggerGravity() = default; 8 | 9 | DefineMapClass( "trigger_gravity", TriggerGravity, SVGBaseTrigger ); 10 | 11 | void Spawn() override; 12 | 13 | void SpawnKey( const std::string& key, const std::string& value ) override; 14 | 15 | void GravityTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 16 | }; 17 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerPush.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TriggerPush : public SVGBaseTrigger { 5 | public: 6 | TriggerPush( Entity* entity ); 7 | virtual ~TriggerPush() = default; 8 | 9 | DefineMapClass( "trigger_push", TriggerPush, SVGBaseTrigger ); 10 | 11 | static constexpr int32_t SF_PushOnce = 1 << 0; 12 | 13 | void Spawn() override; 14 | void SpawnKey( const std::string& key, const std::string& value ); 15 | 16 | void PushTouch( IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf ); 17 | 18 | private: 19 | float pushForce{ 1000.0f }; 20 | vec3_t pushDirection{ vec3_zero() }; 21 | inline static int32_t WindSound = 0; 22 | }; 23 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerRelay.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // TriggerRelay.cpp 5 | */ 6 | 7 | #include "../../ServerGameLocals.h" 8 | #include "../../Effects.h" 9 | #include "../../Entities.h" 10 | #include "../../Utilities.h" 11 | #include "../../Physics/StepMove.h" 12 | 13 | #include "../Base/SVGBaseEntity.h" 14 | #include "../Base/SVGBaseTrigger.h" 15 | 16 | #include "TriggerRelay.h" 17 | 18 | //=============== 19 | // TriggerRelay::ctor 20 | //=============== 21 | TriggerRelay::TriggerRelay( Entity* entity ) 22 | : Base( entity ) { 23 | } 24 | 25 | //=============== 26 | // TriggerRelay::Spawn 27 | //=============== 28 | void TriggerRelay::Spawn() { 29 | Base::Spawn(); 30 | SetUseCallback( &TriggerRelay::RelayUse ); 31 | } 32 | 33 | //=============== 34 | // TriggerRelay::RelayUse 35 | //=============== 36 | void TriggerRelay::RelayUse( IServerGameEntity* other, IServerGameEntity* activator ) { 37 | UseTargets( activator ); 38 | } 39 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Trigger/TriggerRelay.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class TriggerRelay : public SVGBaseTrigger { 5 | public: 6 | TriggerRelay( Entity* entity ); 7 | virtual ~TriggerRelay() = default; 8 | 9 | DefineMapClass( "trigger_relay", TriggerRelay, SVGBaseTrigger ); 10 | 11 | void Spawn() override; 12 | void RelayUse( IServerGameEntity* other, IServerGameEntity* activator ); 13 | }; 14 | -------------------------------------------------------------------------------- /src/Game/Server/Entities/Weaponry/BlasterBolt.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // BlasterBolt.h 6 | // 7 | // 8 | */ 9 | #ifndef __SVGAME_ENTITIES_WEAPONRY_BLASTERBOLT_H__ 10 | #define __SVGAME_ENTITIES_WEAPONRY_BLASTERBOLT_H__ 11 | 12 | class SVGBaseEntity; 13 | 14 | class BlasterBolt : public SVGBaseEntity { 15 | public: 16 | // Constructor/Deconstructor. 17 | BlasterBolt(PODEntity *svEntity); 18 | virtual ~BlasterBolt() = default; 19 | 20 | DefineClass( BlasterBolt, SVGBaseEntity ); 21 | 22 | // 23 | // Interface functions. 24 | // 25 | void Precache() override; // Precaches data. 26 | void Spawn() override; // Spawns the entity. 27 | void Respawn() override; // Respawns the entity. 28 | void PostSpawn() override; // PostSpawning is for handling entity references, since they may not exist yet during a spawn period. 29 | void Think() override; // General entity thinking routine. 30 | 31 | void SpawnKey(const std::string& key, const std::string& value) override; 32 | 33 | // 34 | // Callback functions. 35 | // 36 | // 37 | void BlasterBoltTouch(IServerGameEntity* self, IServerGameEntity* other, CollisionPlane* plane, CollisionSurface* surf); 38 | 39 | // 40 | // Get/Set 41 | // 42 | 43 | 44 | protected: 45 | 46 | private: 47 | 48 | }; 49 | 50 | #endif // __SVGAME_ENTITIES_WEAPONRY_BLASTERBOLT_H__ -------------------------------------------------------------------------------- /src/Game/Server/Exports/Client.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/Client.cpp -------------------------------------------------------------------------------- /src/Game/Server/Exports/Client.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/Client.h -------------------------------------------------------------------------------- /src/Game/Server/Exports/Core.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/Core.cpp -------------------------------------------------------------------------------- /src/Game/Server/Exports/Core.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/Core.h -------------------------------------------------------------------------------- /src/Game/Server/Exports/Entities.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/Entities.cpp -------------------------------------------------------------------------------- /src/Game/Server/Exports/Entities.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/Entities.h -------------------------------------------------------------------------------- /src/Game/Server/Exports/GameState.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/GameState.cpp -------------------------------------------------------------------------------- /src/Game/Server/Exports/GameState.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/GameState.h -------------------------------------------------------------------------------- /src/Game/Server/Exports/LevelState.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/LevelState.cpp -------------------------------------------------------------------------------- /src/Game/Server/Exports/LevelState.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/Exports/LevelState.h -------------------------------------------------------------------------------- /src/Game/Server/Monsters/monster_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // monster_test.cpp 6 | // 7 | // 8 | // First test monster implementation... 9 | // 10 | */ 11 | #include "../ServerGameLocals.h" // SVGame. 12 | #include "../effects.h" // Effects. 13 | #include "../Utilities.h" // Util. 14 | #include "Game/Shared/SharedGame.h" 15 | #include "monster_test.h" -------------------------------------------------------------------------------- /src/Game/Server/Monsters/monster_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | // LICENSE HERE. 3 | 4 | // 5 | // monster_test.h 6 | // 7 | // 8 | // Test monster. 9 | // 10 | */ 11 | #ifndef __SVGAME_MONSTERS_MONSTER_TEST_H__ 12 | #define __SVGAME_MONSTERS_MONSTER_TEST_H__ 13 | 14 | 15 | #endif // __SVGAME_MONSTERS_MONSTER_TEST_H__ -------------------------------------------------------------------------------- /src/Game/Server/Physics/StepMove.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // stepmove.h 5 | // 6 | // 7 | // 8 | #ifndef __SVGAME_PHYSICS_STEPMOVE_H__ 9 | #define __SVGAME_PHYSICS_STEPMOVE_H__ 10 | 11 | void SVG_StepMove_CheckGround(IServerGameEntity* ent); 12 | qboolean SVG_StepMove_CheckBottom(IServerGameEntity* ent); 13 | qboolean SVG_StepMove_Walk(IServerGameEntity* ent, float yaw, float dist); 14 | 15 | #endif // __SVGAME_PHYSICS_STEPMOVE_H__ -------------------------------------------------------------------------------- /src/Game/Server/Player/Client.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // svgame/player/client.h 5 | // 6 | // Polyhedron: Client Header 7 | // 8 | // 9 | #ifndef __SVGAME_PLAYER_CLIENT_H__ 10 | #define __SVGAME_PLAYER_CLIENT_H__ 11 | 12 | class SVGBasePlayer; 13 | 14 | qboolean SVG_ClientConnect(Entity* ent, char* userinfo); 15 | void SVG_ClientDisconnect(Entity* ent); 16 | 17 | void SVG_HUD_BeginIntermission(Entity* targ); 18 | 19 | // Tosses the client weapon. 20 | void SVG_TossClientWeapon(SVGBasePlayer* playerClient); 21 | 22 | void SVG_ClientBegin(Entity* ent); 23 | void SVG_ClientCommand(Entity* ent); 24 | void SVG_ClientUserinfoChanged(Entity* ent, char* userinfo); 25 | 26 | //void SVG_ClientBeginServerFrame(SVGBaseEntity* ent); // WID: Moved to gamemodes. 27 | void SVG_ClientThink(PODEntity *svEntity, ClientMoveCommand* cmd); 28 | 29 | void SVG_ClientEndServerFrames(void); 30 | 31 | #endif // __SVGAME_PLAYER_CLIENT_H__ -------------------------------------------------------------------------------- /src/Game/Server/Player/Hud.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // svgame/player/hud.h 5 | // 6 | // Polyhedron: HUD Header 7 | // 8 | // 9 | #ifndef __SVGAME_PLAYER_HUD_H__ 10 | #define __SVGAME_PLAYER_HUD_H__ 11 | 12 | void HUD_MoveClientToIntermission(Entity* client); 13 | void SVG_HUD_SetClientStats(SVGBasePlayer* player, ServerClient *client); 14 | void SVG_HUD_SetSpectatorStats(SVGBasePlayer* ent, ServerClient *client); 15 | void SVG_HUD_CheckChaseStats(Entity* ent); 16 | void HUD_ValidateSelectedItem(SVGBasePlayer* ent); 17 | void SVG_HUD_GenerateDMScoreboardLayout(IServerGameEntity* client, IServerGameEntity* killer); 18 | 19 | #endif // __SVGAME_PLAYER_HUD_H__ -------------------------------------------------------------------------------- /src/Game/Server/Player/Weapons.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // weapons.h 5 | // 6 | // 7 | // Contains basic weapons functionalities. 8 | // 9 | #ifndef __SVGAME_PLAYER_WEAPONS_H__ 10 | #define __SVGAME_PLAYER_WEAPONS_H__ 11 | 12 | class SVGBaseEntity; 13 | class SVGBasePlayer; 14 | 15 | // Player project source. 16 | vec3_t SVG_PlayerProjectSource(ServerClient* client, const vec3_t &point, const vec3_t& distance, const vec3_t& forward, const vec3_t& right); 17 | 18 | #endif // __SVGAME_PLAYER_WEAPONS_H__ -------------------------------------------------------------------------------- /src/Game/Server/SVGame.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | GetServerGameAPI 3 | -------------------------------------------------------------------------------- /src/Game/Server/ServerGameExports.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Server/ServerGameExports.h -------------------------------------------------------------------------------- /src/Game/Server/Utilities.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // svgame/utils.h 5 | // 6 | // Polyhedron: UTILS Header 7 | // 8 | // 9 | #ifndef __SVGAME_UTILS_H__ 10 | #define __SVGAME_UTILS_H__ 11 | 12 | qboolean SVG_KillBox(IServerGameEntity* ent); 13 | 14 | vec3_t SVG_ProjectSource(const vec3_t& point, const vec3_t& distance, const vec3_t& forward, const vec3_t& right); 15 | vec3_t SVG_PlayerProjectSource(ServerClient* client, const vec3_t& point, const vec3_t& distance, const vec3_t& forward, const vec3_t& right); 16 | 17 | vec3_t SVG_VelocityForDamage(int damage); 18 | 19 | void UTIL_UseTargets(IServerGameEntity* ent, IServerGameEntity* activator); 20 | void UTIL_SetMoveDir(vec3_t &angles, vec3_t &moveDirection); 21 | 22 | void UTIL_TouchTriggers(IServerGameEntity* ent); 23 | void UTIL_TouchSolids(IServerGameEntity* ent); 24 | 25 | #endif // __SVGAME_UTILS_H__ -------------------------------------------------------------------------------- /src/Game/Shared/ButtonBits.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * SharedGame ButtonBit Fkags. These flags are used for letting the server know 8 | * about our user input actions, and send to the server (~multiple-) on a per 9 | * frame basis. 10 | * 11 | * Adding any custom player action starts here. Currently there is room 12 | * for 2 more commands. If more room is needed, please inquire on github by 13 | * posting an issue. It's perfectly do-able but seems like unwanted stress for 14 | * the oh so limited bandwidth. 15 | * 16 | ***/ 17 | #pragma once 18 | 19 | 20 | /** 21 | * @brief These are used for game logic. They are set in clg_input.cpp. One is free 22 | * to use up the remaining slots for their own custom needs. 23 | **/ 24 | struct ButtonBits { 25 | //! Button bit for when a player is primary firing. 26 | static constexpr uint8_t PrimaryFire = (1 << 0); 27 | //! Button bit for when a player is secondary firing. 28 | static constexpr uint8_t SecondaryFire = (1 << 1); 29 | //! Button bit for when a player is reloading its weapon. 30 | static constexpr uint8_t Reload = (1 << 4); 31 | //! Button bit for when a player is using an entity. 32 | //! TODO: This is currently still unimplemented. Should replace "auto touch" buttons etc. 33 | static constexpr uint8_t Use = (1 << 2); 34 | //! Button bit that is set when a player is moving. 35 | static constexpr uint8_t Walk = (1 << 3); 36 | //! Unused 0. 37 | static constexpr uint8_t Unused0 = (1 << 5); 38 | //! Unused 1. 39 | static constexpr uint8_t Unused1 = (1 << 6); 40 | //! Set when any button is pressed. 41 | static constexpr uint8_t Any = (1 << 7); 42 | }; -------------------------------------------------------------------------------- /src/Game/Shared/EntityFlags.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * SharedGame Entity Fkags. These are set and used during in-game gameplay. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | 13 | /** 14 | * @brief Entity Flags. These are set in-game during gameplay. 15 | **/ 16 | struct EntityFlags { 17 | static constexpr int32_t Fly = 1; 18 | static constexpr int32_t Swim = 2; //! Implied immunity to drowining 19 | static constexpr int32_t ImmuneLaser = 4; 20 | static constexpr int32_t InWater = 8; 21 | static constexpr int32_t GodMode = 16; 22 | static constexpr int32_t NoTarget = 32; 23 | static constexpr int32_t ImmuneToSlime = 64; 24 | static constexpr int32_t ImmuneToLava = 128; 25 | static constexpr int32_t PartiallyOnGround = 256; //! Not all corners are valid 26 | static constexpr int32_t WaterJump = 512; //! Player jumping out of water 27 | static constexpr int32_t TeamSlave = 1024; //! Not the first on the team 28 | static constexpr int32_t NoKnockBack = 2048; 29 | static constexpr int32_t PowerArmor = 4096; //! Power armor (if any) is active 30 | static constexpr int32_t Respawn = 0x80000000; //! Used for item respawning 31 | }; 32 | 33 | /** 34 | * @brief Use Entity Flags. Determine how a player can interact with this entity by 'Using' it. 35 | **/ 36 | struct UseEntityFlags { 37 | //! Default, this entity can not be 'Use' interacted with. 38 | static constexpr int32_t Not = 0; 39 | //! Takes repeated 'Use' key hit presses to dispatch 'Use' callbacks. 40 | static constexpr int32_t Toggle = 2; 41 | //! Takes a single 'Use' key press, which when hold will dispatch a 'Use' callback each frame. 42 | static constexpr int32_t Hold = 4; 43 | }; 44 | -------------------------------------------------------------------------------- /src/Game/Shared/ItemIDs.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * SharedGame ItemIDs. Each item has its own identifier, including weaponry. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | 13 | /** 14 | * @brief Item identifiers. 15 | **/ 16 | struct ItemID { 17 | /*** 18 | * Weapons. 19 | ***/ 20 | //! Bare hands. 21 | static constexpr uint32_t Barehands = 1; 22 | //! Pistol. 23 | static constexpr uint32_t Beretta = 2; 24 | //! SMG. 25 | static constexpr uint32_t SMG = 3; 26 | //! Shotgun. 27 | static constexpr uint32_t Shotgun = 4; 28 | //! Last item slot that can be used for weapons. 29 | static constexpr uint32_t MaxWeapons = 64; 30 | 31 | /*** 32 | * Ammo. 33 | ***/ 34 | //! 9 millimeter ammo. 35 | static constexpr uint32_t Ammo9mm = 65; 36 | //! 9 millimeter ammo. 37 | static constexpr uint32_t MaxAmmos = 85; 38 | 39 | /*** 40 | * Medical Stats Items. 41 | ***/ 42 | //! Mega Health. 43 | static constexpr uint32_t MegaHealth = 86; 44 | 45 | /** 46 | * ... :-) 47 | **/ 48 | //! Total amount of items. 49 | static constexpr uint32_t Total = 87; 50 | //! Maximum amount of allowed items. 51 | static constexpr uint32_t Maximum = 255; 52 | }; 53 | -------------------------------------------------------------------------------- /src/Game/Shared/MuzzleFlashTypes.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Muzzle Flashes are effects applied to an entity itself and as such take place at its origin. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | 13 | /** 14 | * @brief Muzzle Flashes are effects applied to an entity itself and as such 15 | * take place at its origin. 16 | **/ 17 | struct MuzzleFlashType { 18 | //! Shows a respawn particle effect at the entity's origin. 19 | static constexpr uint8_t Respawn = 0; 20 | //! Shows an item specific respawn particle effect at the entity's origin. 21 | static constexpr uint8_t ItemRespawn = 1; 22 | //! Shows a login particle effect. (When a client connects and spawns for the first time in a game.) 23 | static constexpr uint8_t Login = 2; 24 | //! Shows a logout particle effect. (When a client disconnects from a game.) 25 | static constexpr uint8_t Logout = 3; 26 | 27 | //! Shows a Pistol muzzleflash effect. 28 | static constexpr uint8_t Smg45 = 16; 29 | //! Shows a MachineGun muzzleflash effect. 30 | static constexpr uint8_t MachineGun = 17; 31 | //! Shows a Shotgun muzzleflash effect. 32 | static constexpr uint8_t Shotgun = 18; 33 | //! Shows a SuperShotgun muzzleflash effect. 34 | static constexpr uint8_t SuperShotgun = 19; 35 | }; 36 | 37 | /** 38 | * @brief Monster entity specific muzzleflash types. 39 | **/ 40 | struct MonsterMuzzleFlashType { 41 | static constexpr int32_t FictionalMonsterWeapon = 0; 42 | }; -------------------------------------------------------------------------------- /src/Game/Shared/Physics/MoveTypes/MoveTypeLinearProjectile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Shared/Physics/MoveTypes/MoveTypeLinearProjectile.cpp -------------------------------------------------------------------------------- /src/Game/Shared/Physics/MoveTypes/MoveTypeNone.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Both the ClientGame and the ServerGame modules share the same general Physics code. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | // Shared Game. 13 | #include "../../SharedGame.h" 14 | 15 | #ifdef SHAREDGAME_SERVERGAME 16 | #include "../../../Server/ServerGameLocals.h" 17 | #include "../../../Server/World/ServerGameWorld.h" 18 | #endif 19 | #ifdef SHAREDGAME_CLIENTGAME 20 | #include "../../../Client/ClientGameLocals.h" 21 | #include "../../../Client/World/ClientGameWorld.h" 22 | #endif 23 | 24 | // Physics. 25 | #include "../Physics.h" 26 | #include "../RootMotionMove.h" 27 | 28 | // TODO: This needs some fixing hehe... ugly method but hey. 29 | #ifdef SHAREDGAME_SERVERGAME 30 | extern cvar_t *sv_maxvelocity; 31 | extern cvar_t *sv_gravity; 32 | extern void CheckSVCvars(); 33 | #endif 34 | 35 | #ifdef SHAREDGAME_CLIENTGAME 36 | extern cvar_t *GetSVMaxVelocity(); 37 | extern cvar_t *GetSVGravity(); 38 | #endif 39 | //======================================================================== 40 | 41 | /** 42 | * @brief Logic for MoveType::(None, PlayerMove): Gives the entity a chance to 'Think', does not execute any physics logic. 43 | **/ 44 | void SG_Physics_None(SGEntityHandle& entityHandle) { 45 | // Assign handle to base entity. 46 | GameEntity* gameEntity = *entityHandle; 47 | 48 | // Ensure it is a valid entity. 49 | if (!gameEntity) { 50 | SG_Physics_PrintWarning( std::string(__func__) + "got an invalid entity handle!" ); 51 | return; 52 | } 53 | 54 | // Run think method. 55 | SG_RunThink(gameEntity); 56 | } -------------------------------------------------------------------------------- /src/Game/Shared/Physics/MoveTypes/MoveTypeTossSlide.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Shared/Physics/MoveTypes/MoveTypeTossSlide.cpp -------------------------------------------------------------------------------- /src/Game/Shared/Physics/StepMove.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Shared/Physics/StepMove.h -------------------------------------------------------------------------------- /src/Game/Shared/PlayerMove.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Game/Shared/PlayerMove.cpp -------------------------------------------------------------------------------- /src/Game/Shared/Protocol.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Shared Game Network Protocol. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | /** 13 | * @brief Server Game Command are a way for the server to tell a client what to do. 14 | * Spawn a muzzleflash effect, or a temp entity effect, or update a client's 15 | * layout string. 16 | * 17 | * Due to protocol limitations at the time of writing, the index starts at 22 18 | * and the limit is 32 extra custom types. 19 | **/ 20 | struct ServerGameCommand { 21 | //! First index is 22, all other slots are reserved for the server itself. 22 | static constexpr int32_t MuzzleFlash = 22; 23 | static constexpr int32_t MuzzleFlash2 = 23; 24 | static constexpr int32_t TempEntityEvent = 24; 25 | static constexpr int32_t Layout = 25; 26 | static constexpr int32_t Inventory = 26; 27 | 28 | //! Be sure to increase limit in case you modify this array. 29 | static constexpr int32_t TotalNumberOfCommands = 27; 30 | }; 31 | 32 | /** 33 | * @brief Client Game Commands are a way for the client to tell the server what to do. 34 | * Currently it is not in utilized but can be used if needed. 35 | * 36 | * Due to protocol limitations at the time of writing, the index starts at 13 37 | * and the limit is 32 extra custom types. 38 | **/ 39 | struct ClientGameCommand { 40 | //! First index is 13, all other slots are reserved for the client itself. Feel free to rename this one and make it your own. 41 | static constexpr int32_t FirstCommand = 13; 42 | 43 | //! Be sure to increase limit in case you modify this array. 44 | static constexpr int32_t TotalNumberOfCommands = 14; 45 | }; 46 | -------------------------------------------------------------------------------- /src/Game/Shared/RenderDrawFlags.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * @brief Render Draw Flags for telling the client how to "render the screen". 8 | * This can be an overlay, or actually tell it to render a 3D model on 9 | * the screen instead of inside the actual world. 10 | * 11 | * These can be set by the ServerGame and if set will be transfered to 12 | * the clients 'on the wire' along with the rest of an entity state update. 13 | * 14 | ***/ 15 | #pragma once 16 | 17 | 18 | /** 19 | * @brief Render Draw Flags for telling the client how to "render the screen". 20 | * This can be an overlay, or actually tell it to render a 3D model on 21 | * the screen instead of inside the actual world. 22 | **/ 23 | struct RenderDrawFlags { 24 | static constexpr int32_t Underwater = 1; // warp the screen as apropriate 25 | static constexpr int32_t NoWorldModel = 2; // used for player configuration screen 26 | static constexpr int32_t InfraRedGoggles = 4; 27 | static constexpr int32_t UVGoggles = 8; 28 | }; -------------------------------------------------------------------------------- /src/Game/Shared/SkeletalAnimation.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Skeletal Animation functionality. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | 13 | 14 | //! MS Frametime for animations. 15 | static constexpr float ANIMATION_FRAMETIME = BASE_FRAMETIME;//FRAMERATE_MS; 16 | 17 | 18 | /** 19 | * @brief Calculates the current frame for the current time since the start time stamp. 20 | * 21 | * @return The frame and interpolation fraction for current time in an animation started at a given time. 22 | * When the animation is finished it will return frame -1. Takes looping into account. Looping animations 23 | * are never finished. In other words, they'll never return -1. 24 | **/ 25 | double SG_FrameForTime( int32_t *frame, const GameTime ¤tTimestamp, const GameTime &startTimeStamp, float frameTime, int32_t startFrame, int32_t endFrame, int32_t loopingFrames = 0, bool forceLoop =false); -------------------------------------------------------------------------------- /src/Game/Shared/Time.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Contains declarations and definitions of types used for handling time in 8 | * both of the game modules. It makes use of std::chrono to simplify things 9 | * for us. 10 | * 11 | ***/ 12 | #pragma once 13 | 14 | 15 | //! Time of a game's frame. 16 | static constexpr Frametime FRAMETIME_S = Frametime(1.0f / BASE_HZ); 17 | 18 | //! Literal to return the 'frame counts'. Should be avoided to use. 19 | using Frames = std::chrono::duration>; 20 | //static constexpr Frames operator""_hz(uint64_t frame) { 21 | // return Frames(frame); 22 | //} 23 | 24 | //! Milliseconds per frame. 25 | static constexpr GameTime FRAMERATE_MS = duration_cast(FRAMETIME_S); -------------------------------------------------------------------------------- /src/Game/Shared/Utilities.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * SharedGame Utilities. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | 13 | /** 14 | * ClientGame Entity required includes for building SharedGame code. 15 | **/ 16 | #ifdef SHAREDGAME_CLIENTGAME 17 | // Include IClientGameEntity. 18 | #include "../Client/Utilities/CLGTraceResult.h" 19 | #endif 20 | /** 21 | * ServerGame Entity required includes for building SharedGame code. 22 | **/ 23 | #ifdef SHAREDGAME_CLIENTGAME 24 | // Include IClientGameEntity. 25 | #include "../Server/Utilities/SVGTraceResult.h" 26 | #endif -------------------------------------------------------------------------------- /src/Game/Shared/WaterLevels.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * SharedGame WaterLevels. These are set by both (Client-/Server-)Game Modules 8 | * in the Physics and PlayerMove code base on the results of PointContents testing. 9 | * 10 | ***/ 11 | #pragma once 12 | 13 | 14 | /** 15 | * @brief The water level that a certain entity is at. 16 | **/ 17 | struct WaterLevel { 18 | static constexpr int32_t Unknown = -1; 19 | static constexpr int32_t None = 0; 20 | static constexpr int32_t Feet = 1; 21 | static constexpr int32_t Waist = 2; 22 | static constexpr int32_t Under = 3; 23 | }; -------------------------------------------------------------------------------- /src/Game/Shared/WeaponStates.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * SharedGame WeaponStates are used to determine what kind of actual logic 8 | * to process for the current state of the weapon. 9 | * 10 | * Specifics are explained below. 11 | * 12 | ***/ 13 | #pragma once 14 | 15 | 16 | /** 17 | * @brief Used to determine the state a weapon is currently in. 18 | **/ 19 | struct WeaponState { 20 | //! None state, meaning it has no logic to process. 21 | static constexpr int32_t None = 0; 22 | //! Draw state, when set it'll process a draw animation. 23 | static constexpr int32_t Holster = 1; 24 | //! Holster state, when set it'll process a holster animation. 25 | static constexpr int32_t Draw = 2; 26 | //! Idle state, when set it'll play idle animations at random intervals. 27 | static constexpr int32_t Idle = 3; 28 | //! Reload, when set it'll try and reload. 29 | static constexpr int32_t Reload = 4; 30 | //! Primary Fire. Speaks for itself. 31 | static constexpr int32_t PrimaryFire = 5; 32 | //! Secondary Fire. This too, speaks for itself. 33 | static constexpr int32_t SecondaryFire = 6; 34 | }; -------------------------------------------------------------------------------- /src/Game/Shared/World/IGameWorld.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | ***/ 8 | #include "../SharedGame.h" 9 | #include "IGameWorld.h" -------------------------------------------------------------------------------- /src/Refresh/Models.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | Copyright (C) 2008 Andrey Nazarov 4 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | */ 20 | 21 | #ifndef MODELS_H 22 | #define MODELS_H 23 | 24 | // 25 | // models.h -- common models manager 26 | // 27 | #include "Shared/Refresh.h" 28 | #include "System/Hunk.h" 29 | #include "Common/Error.h" 30 | 31 | //! Maximum allowed Alias Model Skins. 32 | static constexpr int32_t MAX_ALIAS_SKINS = 32; 33 | //! Maximum allowed Alias Model Verts. 34 | static constexpr int32_t MAX_ALIAS_VERTS = 4096; 35 | 36 | qhandle_t R_RegisterModel(const char *name); 37 | 38 | #endif // MODELS_H 39 | -------------------------------------------------------------------------------- /src/Refresh/gl/arbfp.h: -------------------------------------------------------------------------------- 1 | static const char gl_prog_warp[] = 2 | "!!ARBfp1.0\n" 3 | "OPTION ARB_precision_hint_fastest;\n" 4 | 5 | "TEMP ofs, coord, diffuse;\n" 6 | "PARAM amp = { 0.0625, 0.0625 };\n" 7 | "PARAM phase = { 4, 4 };\n" 8 | 9 | "MAD coord, phase, fragment.texcoord[0], program.local[0];\n" 10 | "SIN ofs.x, coord.y;\n" 11 | "SIN ofs.y, coord.x;\n" 12 | "MAD coord, ofs, amp, fragment.texcoord[0];\n" 13 | "TEX diffuse, coord, texture[0], 2D;\n" 14 | "MUL result.color, diffuse, fragment.color;\n" 15 | "END\n" 16 | ; 17 | 18 | -------------------------------------------------------------------------------- /src/Refresh/stb/stb.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2018 Christoph Schied 3 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "../../Shared/Shared.h" 21 | #include "../../Common/Common.h" 22 | #include "../../Common/Zone.h" 23 | 24 | #define STBI_MALLOC(sz) Z_Malloc(sz) 25 | #define STBI_REALLOC(p,newsz) Z_Realloc(p,newsz) 26 | #define STBI_FREE(p) Z_Free(p) 27 | 28 | #define STB_IMAGE_IMPLEMENTATION 29 | #include "stb_image.h" 30 | #define STB_IMAGE_RESIZE_IMPLEMENTATION 31 | #include "stb_image_resize.h" 32 | #define STB_IMAGE_WRITE_IMPLEMENTATION 33 | #include "stb_image_write.h" 34 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/buddy_allocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #pragma once 20 | #include 21 | 22 | typedef enum 23 | { 24 | BA_SUCCESS = 0, 25 | BA_NOT_ENOUGH_MEMORY, 26 | BA_INVALID_ALIGNMENT 27 | } BAResult; 28 | 29 | typedef struct BuddyAllocator BuddyAllocator; 30 | 31 | BuddyAllocator* create_buddy_allocator(uint64_t capacity, uint64_t block_size); 32 | BAResult buddy_allocator_allocate(BuddyAllocator* allocator, uint64_t size, uint64_t alignment, uint64_t* offset); 33 | void buddy_allocator_free(BuddyAllocator* allocator, uint64_t offset, uint64_t size); 34 | void destroy_buddy_allocator(BuddyAllocator* allocator); 35 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/cameras.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | typedef struct bsp_mesh_s bsp_mesh_t; 22 | 23 | void vkpt_cameras_init(void); 24 | void vkpt_cameras_shutdown(void); 25 | void vkpt_cameras_load(bsp_mesh_t* wm, const char* map_name); -------------------------------------------------------------------------------- /src/Refresh/vkpt/conversion.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #include "conversion.h" 20 | 21 | void packHalf4x16(uint32_t* half, float* vec4) { 22 | half[0] = floatToHalf(vec4[0]) | (floatToHalf(vec4[1]) << 16); 23 | half[1] = floatToHalf(vec4[2]) | (floatToHalf(vec4[3]) << 16); 24 | } 25 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/device_memory_allocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #pragma once 20 | #include 21 | 22 | typedef enum 23 | { 24 | DMA_SUCCESS = 0, 25 | DMA_NOT_ENOUGH_MEMORY 26 | } DMAResult; 27 | 28 | typedef struct DeviceMemory 29 | { 30 | VkDeviceMemory memory; 31 | uint64_t memory_offset; 32 | uint64_t size; 33 | uint64_t alignment; 34 | uint32_t memory_type; 35 | } DeviceMemory; 36 | 37 | typedef struct DeviceMemoryAllocator DeviceMemoryAllocator; 38 | 39 | DeviceMemoryAllocator* create_device_memory_allocator(VkDevice device); 40 | DMAResult allocate_device_memory(DeviceMemoryAllocator* allocator, DeviceMemory* device_memory); 41 | void free_device_memory(DeviceMemoryAllocator* allocator, const DeviceMemory* device_memory); 42 | void destroy_device_memory_allocator(DeviceMemoryAllocator* allocator); 43 | void get_device_malloc_stats(DeviceMemoryAllocator* allocator, size_t* memory_allocated, size_t* memory_used); -------------------------------------------------------------------------------- /src/Refresh/vkpt/fog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef __FOG_H_ 20 | #define __FOG_H_ 21 | 22 | #include "../../Shared/Shared.h" 23 | 24 | typedef struct { 25 | vec3_t point_a; 26 | vec3_t point_b; 27 | vec3_t color; 28 | float half_extinction_distance; 29 | int softface; // 0 = none, 1 = xa, 2 = xb, 3 = ya, 4 = yb, 5 = za, 6 = zb 30 | } fog_volume_t; 31 | 32 | struct ShaderFogVolume; 33 | 34 | void vkpt_fog_init(void); 35 | void vkpt_fog_shutdown(void); 36 | void vkpt_fog_reset(void); 37 | void vkpt_fog_upload(struct ShaderFogVolume* dst); 38 | 39 | #endif // __FOG_H_ 40 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/final_blit.vert: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | // ========================================================================== // 20 | // Vertex shader that produces a full screen quad for the final blit. 21 | // ========================================================================== // 22 | 23 | #version 450 24 | #extension GL_ARB_separate_shader_objects : enable 25 | 26 | out gl_PerVertex { 27 | vec4 gl_Position; 28 | }; 29 | 30 | layout(location = 0) out vec2 tex_coord; 31 | 32 | vec2 positions[4] = vec2[]( 33 | vec2(0.0, 1.0), 34 | vec2(0.0, 0.0), 35 | vec2(1.0, 1.0), 36 | vec2(1.0, 0.0) 37 | ); 38 | 39 | void 40 | main() 41 | { 42 | vec2 pos = positions[gl_VertexIndex] * 2 + vec2(-1); 43 | tex_coord = positions[gl_VertexIndex]; 44 | 45 | gl_Position = vec4(pos, 0.0, 1.0); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/fsr_easu_fp16.comp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | Copyright (C) 2021, Frank Richter. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #version 450 21 | #extension GL_GOOGLE_include_directive : enable 22 | #extension GL_ARB_separate_shader_objects : enable 23 | #extension GL_EXT_nonuniform_qualifier : enable 24 | 25 | #define A_HALF 26 | #define FSR_EASU_H 1 27 | 28 | // Macros for FP16/FP32 abstraction 29 | #define fsr_vec3 AH3 30 | #define fsr_vec4 AH4 31 | #define FsrEasu FsrEasuH 32 | #define FsrEasuR FsrEasuRH 33 | #define FsrEasuG FsrEasuGH 34 | #define FsrEasuB FsrEasuBH 35 | #define FsrSrtm FsrSrtmH 36 | #define FsrSrtmInv FsrSrtmInvH 37 | 38 | // Actual implementation 39 | #include "fsr_easu.glsl" 40 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/fsr_easu_fp32.comp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | Copyright (C) 2021, Frank Richter. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #version 450 21 | #extension GL_GOOGLE_include_directive : enable 22 | #extension GL_ARB_separate_shader_objects : enable 23 | #extension GL_EXT_nonuniform_qualifier : enable 24 | 25 | #define FSR_EASU_F 1 26 | 27 | // Macros for FP16/FP32 abstraction 28 | #define fsr_vec3 AF3 29 | #define fsr_vec4 AF4 30 | #define FsrEasu FsrEasuF 31 | #define FsrEasuR FsrEasuRF 32 | #define FsrEasuG FsrEasuGF 33 | #define FsrEasuB FsrEasuBF 34 | #define FsrSrtm FsrSrtmF 35 | #define FsrSrtmInv FsrSrtmInvF 36 | 37 | // Actual implementation 38 | #include "fsr_easu.glsl" 39 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/fsr_rcas_fp16.comp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | Copyright (C) 2021, Frank Richter. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #version 450 21 | #extension GL_GOOGLE_include_directive : enable 22 | #extension GL_ARB_separate_shader_objects : enable 23 | #extension GL_EXT_nonuniform_qualifier : enable 24 | 25 | #define A_HALF 26 | #define FSR_RCAS_H 1 27 | 28 | // Macros for FP16/FP32 abstraction 29 | #define fsr_val AH1 30 | #define fsr_vec3 AH3 31 | #define fsr_vec4 AH4 32 | #define FsrRcas FsrRcasH 33 | #define FsrRcasLoad FsrRcasLoadH 34 | #define load_coord ASW2 35 | #define FsrRcasInput FsrRcasInputH 36 | #define FsrSrtm FsrSrtmH 37 | #define FsrSrtmInv FsrSrtmInvH 38 | 39 | // Actual implementation 40 | #include "fsr_rcas.glsl" 41 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/fsr_rcas_fp32.comp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | Copyright (C) 2021, Frank Richter. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #version 450 21 | #extension GL_GOOGLE_include_directive : enable 22 | #extension GL_ARB_separate_shader_objects : enable 23 | #extension GL_EXT_nonuniform_qualifier : enable 24 | 25 | #define FSR_RCAS_F 1 26 | 27 | // Macros for FP16/FP32 abstraction 28 | #define fsr_val AF1 29 | #define fsr_vec3 AF3 30 | #define fsr_vec4 AF4 31 | #define FsrRcas FsrRcasF 32 | #define FsrRcasLoad FsrRcasLoadF 33 | #define load_coord ASU2 34 | #define FsrRcasInput FsrRcasInputF 35 | #define FsrSrtm FsrSrtmF 36 | #define FsrSrtmInv FsrSrtmInvF 37 | 38 | // Actual implementation 39 | #include "fsr_rcas.glsl" 40 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/fsr_utils.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | Copyright (C) 2021, Frank Richter. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | // Assumes spec_hdr constant is defined and that we're included after ffx_fsr1.h 21 | 22 | // Transform (potentially) HDR input for FSR 23 | fsr_vec3 hdr_input(fsr_vec3 color) 24 | { 25 | if (spec_hdr != 0) 26 | FsrSrtm(color); 27 | return color; 28 | } 29 | 30 | // Transform FSR output to (potentially) HDR 31 | fsr_vec3 hdr_output(fsr_vec3 color) 32 | { 33 | if (spec_hdr != 0) 34 | FsrSrtmInv(color); 35 | return color; 36 | } 37 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/god_rays_shared.h: -------------------------------------------------------------------------------- 1 | 2 | layout(set=GOD_RAYS_DESC_SET_IDX, binding=0) uniform sampler2DArray TEX_SHADOW_MAP; 3 | 4 | layout(push_constant, std140) uniform PushConstants { 5 | uint pass_index; 6 | } push; 7 | 8 | ivec2 GetRotatedGridOffset(ivec2 pixelPos) 9 | { 10 | return ivec2(pixelPos.y & 0x1, 1 - (pixelPos.x & 0x1)); 11 | } 12 | 13 | #define IMG_GODRAYS_INTERMEDIATE IMG_ASVGF_COLOR 14 | #define TEX_GODRAYS_INTERMEDIATE TEX_ASVGF_COLOR 15 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/normalize_normal_map.comp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #version 460 20 | #extension GL_EXT_nonuniform_qualifier : enable 21 | 22 | layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in; 23 | 24 | layout(set = 0, binding = 0, rgba8) uniform image2D global_texture_images[]; 25 | 26 | layout(push_constant, std430) uniform PushConstants { 27 | uint texture_index; 28 | } push; 29 | 30 | void 31 | main() 32 | { 33 | ivec2 ipos = ivec2(gl_GlobalInvocationID); 34 | 35 | vec4 value = imageLoad(global_texture_images[push.texture_index], ipos); 36 | 37 | value.xy = value.xy * 2.0 - vec2(1.0); 38 | 39 | float len = length(value.xyz); 40 | if (len == 0) 41 | value.xyz = vec3(0.0, 0.0, 1.0); 42 | else 43 | value.xyz /= len; 44 | 45 | value.xy = value.xy * 0.5 + vec2(0.5); 46 | 47 | imageStore(global_texture_images[push.texture_index], ipos, value); 48 | } 49 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer.rchit: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2018 Christoph Schied 3 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #version 460 21 | #extension GL_GOOGLE_include_directive : enable 22 | 23 | #include "path_tracer.h" 24 | #include "utils.glsl" 25 | 26 | #define GLOBAL_TEXTURES_DESC_SET_IDX 2 27 | #include "global_textures.h" 28 | 29 | #define VERTEX_BUFFER_DESC_SET_IDX 3 30 | #define VERTEX_READONLY 1 31 | #include "vertex_buffer.h" 32 | 33 | #include "path_tracer_transparency.glsl" 34 | #include "path_tracer_hit_shaders.h" 35 | 36 | layout (location = RT_PAYLOAD_GEOMETRY) rayPayloadInEXT RayPayloadGeometry ray_payload; 37 | 38 | hitAttributeEXT vec2 hit_attribs; 39 | 40 | void 41 | main() 42 | { 43 | pt_logic_rchit(ray_payload, gl_PrimitiveID, gl_InstanceCustomIndexEXT, gl_HitTEXT, hit_attribs.xy); 44 | } 45 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer.rmiss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2018 Christoph Schied 3 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #version 460 21 | 22 | void main() 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer_beam.rahit: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #version 460 20 | #extension GL_GOOGLE_include_directive : enable 21 | 22 | #include "path_tracer.h" 23 | #include "utils.glsl" 24 | 25 | #define GLOBAL_TEXTURES_DESC_SET_IDX 2 26 | #include "global_textures.h" 27 | 28 | #define VERTEX_BUFFER_DESC_SET_IDX 3 29 | #define VERTEX_READONLY 1 30 | #include "vertex_buffer.h" 31 | 32 | #include "path_tracer_transparency.glsl" 33 | #include "path_tracer_hit_shaders.h" 34 | 35 | layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; 36 | hitAttributeEXT HitAttributeBeam beam_hit_attrib; 37 | 38 | void main() 39 | { 40 | const vec2 beam_fade_and_thickness = unpackHalf2x16(beam_hit_attrib.fade_and_thickness); 41 | 42 | vec4 transparency = pt_logic_beam(gl_PrimitiveID, beam_fade_and_thickness, gl_HitTEXT, gl_RayTmaxEXT); 43 | 44 | if (transparency.a > 0) 45 | { 46 | update_payload_transparency(ray_payload, transparency, gl_HitTEXT); 47 | } 48 | 49 | ignoreIntersectionEXT; 50 | } 51 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer_beam.rint: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #version 460 20 | #extension GL_GOOGLE_include_directive : enable 21 | 22 | #include "path_tracer.h" 23 | #include "utils.glsl" 24 | 25 | #define GLOBAL_TEXTURES_DESC_SET_IDX 2 26 | #include "global_textures.h" 27 | 28 | #define VERTEX_BUFFER_DESC_SET_IDX 3 29 | #define VERTEX_READONLY 1 30 | #include "vertex_buffer.h" 31 | 32 | #include "path_tracer_transparency.glsl" 33 | #include "path_tracer_hit_shaders.h" 34 | 35 | hitAttributeEXT HitAttributeBeam beam_hit_attrib; 36 | 37 | void main() 38 | { 39 | const int beam_index = gl_PrimitiveID; 40 | 41 | float tShapeHit; 42 | vec2 fade_and_thickness; 43 | 44 | if (!pt_logic_beam_intersection(gl_PrimitiveID, gl_WorldRayOriginEXT, gl_WorldRayDirectionEXT, 45 | gl_RayTminEXT, gl_RayTmaxEXT, fade_and_thickness, tShapeHit)) 46 | { 47 | return; 48 | } 49 | 50 | beam_hit_attrib.fade_and_thickness = packHalf2x16(fade_and_thickness); 51 | 52 | reportIntersectionEXT(tShapeHit, 0); 53 | } 54 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer_explosion.rahit: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #version 460 20 | #extension GL_GOOGLE_include_directive : enable 21 | 22 | #include "path_tracer.h" 23 | #include "utils.glsl" 24 | 25 | #define GLOBAL_TEXTURES_DESC_SET_IDX 2 26 | #include "global_textures.h" 27 | 28 | #define VERTEX_BUFFER_DESC_SET_IDX 3 29 | #define VERTEX_READONLY 1 30 | #include "vertex_buffer.h" 31 | 32 | #include "path_tracer_transparency.glsl" 33 | #include "path_tracer_hit_shaders.h" 34 | 35 | layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; 36 | hitAttributeEXT vec2 hit_attribs; 37 | 38 | void main() 39 | { 40 | vec4 transparency = pt_logic_explosion(gl_PrimitiveID, gl_InstanceCustomIndexEXT, gl_WorldRayDirectionEXT, hit_attribs.xy); 41 | 42 | if (transparency.a > 0) 43 | { 44 | update_payload_transparency(ray_payload, transparency, gl_HitTEXT); 45 | } 46 | 47 | ignoreIntersectionEXT; 48 | } 49 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer_masked.rahit: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #version 460 20 | #extension GL_GOOGLE_include_directive : enable 21 | 22 | #include "path_tracer.h" 23 | #include "utils.glsl" 24 | 25 | #define GLOBAL_TEXTURES_DESC_SET_IDX 2 26 | #include "global_textures.h" 27 | 28 | #define VERTEX_BUFFER_DESC_SET_IDX 3 29 | #define VERTEX_READONLY 1 30 | #include "vertex_buffer.h" 31 | 32 | #include "path_tracer_transparency.glsl" 33 | #include "path_tracer_hit_shaders.h" 34 | 35 | hitAttributeEXT vec2 hit_attribs; 36 | 37 | void main() 38 | { 39 | if (!pt_logic_masked(gl_PrimitiveID, gl_InstanceCustomIndexEXT, hit_attribs.xy)) 40 | ignoreIntersectionEXT; 41 | } 42 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer_particle.rahit: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #version 460 20 | #extension GL_GOOGLE_include_directive : enable 21 | 22 | #include "path_tracer.h" 23 | #include "utils.glsl" 24 | 25 | #define GLOBAL_TEXTURES_DESC_SET_IDX 2 26 | #include "global_textures.h" 27 | 28 | #define VERTEX_BUFFER_DESC_SET_IDX 3 29 | #define VERTEX_READONLY 1 30 | #include "vertex_buffer.h" 31 | 32 | #include "path_tracer_transparency.glsl" 33 | #include "path_tracer_hit_shaders.h" 34 | 35 | layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; 36 | hitAttributeEXT vec2 hit_attribs; 37 | 38 | void main() 39 | { 40 | vec4 transparency = pt_logic_particle(gl_PrimitiveID, hit_attribs.xy); 41 | 42 | if (transparency.a > 0) 43 | { 44 | update_payload_transparency(ray_payload, transparency, gl_HitTEXT); 45 | } 46 | 47 | ignoreIntersectionEXT; 48 | } 49 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/path_tracer_sprite.rahit: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #version 460 20 | #extension GL_GOOGLE_include_directive : enable 21 | 22 | #include "path_tracer.h" 23 | #include "utils.glsl" 24 | 25 | #define GLOBAL_TEXTURES_DESC_SET_IDX 2 26 | #include "global_textures.h" 27 | 28 | #define VERTEX_BUFFER_DESC_SET_IDX 3 29 | #define VERTEX_READONLY 1 30 | #include "vertex_buffer.h" 31 | 32 | #include "path_tracer_transparency.glsl" 33 | #include "path_tracer_hit_shaders.h" 34 | 35 | layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; 36 | hitAttributeEXT vec2 hit_attribs; 37 | 38 | void main() 39 | { 40 | vec4 transparency = pt_logic_sprite(gl_PrimitiveID, hit_attribs.xy); 41 | 42 | if (transparency.a > 0) 43 | { 44 | update_payload_transparency(ray_payload, transparency, gl_HitTEXT); 45 | } 46 | 47 | ignoreIntersectionEXT; 48 | } 49 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/precomputed_sky_params.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _PRECOMPUTED_SKY_PARAMS_ 20 | #define _PRECOMPUTED_SKY_PARAMS_ 21 | 22 | #define SKY_LUM_SCALE 0.001f 23 | #define SUN_LUM_SCALE 0.00001f 24 | 25 | #define SKY_SPECTRAL_R_TO_L (683.000000f * SKY_LUM_SCALE) 26 | #define SUN_SPECTRAL_R_TO_L_R (98242.786222f * SUN_LUM_SCALE) 27 | #define SUN_SPECTRAL_R_TO_L_G (69954.398112f * SUN_LUM_SCALE) 28 | #define SUN_SPECTRAL_R_TO_L_B (66475.012354f * SUN_LUM_SCALE) 29 | 30 | #ifdef VKPT_SHADER 31 | 32 | const vec3 SKY_SPECTRAL_RADIANCE_TO_LUMINANCE = vec3(SKY_SPECTRAL_R_TO_L, SKY_SPECTRAL_R_TO_L, SKY_SPECTRAL_R_TO_L); 33 | const vec3 SUN_SPECTRAL_RADIANCE_TO_LUMINANCE = vec3(SUN_SPECTRAL_R_TO_L_R, SUN_SPECTRAL_R_TO_L_G, SUN_SPECTRAL_R_TO_L_B); 34 | 35 | #endif 36 | 37 | #endif // _PRECOMPUTED_SKY_PARAMS_ 38 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/shader_structs.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef SHADER_STRUCTS_H 20 | 21 | #ifdef VKPT_SHADER 22 | 23 | #define BEGIN_SHADER_STRUCT(NAME) struct NAME 24 | #define END_SHADER_STRUCT(NAME) ; 25 | 26 | #else // VKPT_SHADER 27 | 28 | #define BEGIN_SHADER_STRUCT(NAME) typedef struct 29 | #define END_SHADER_STRUCT(NAME) NAME; 30 | 31 | typedef uint32_t uint; 32 | typedef float vec2[2]; 33 | typedef float vec3[3]; 34 | typedef float vec4[4]; 35 | typedef uint32_t uvec2[2]; 36 | typedef uint32_t uvec3[3]; 37 | typedef uint32_t uvec4[4]; 38 | typedef int ivec2[2]; 39 | typedef int ivec3[3]; 40 | typedef int ivec4[4]; 41 | typedef float mat3[3][3]; 42 | typedef float mat4[4][4]; 43 | 44 | #endif // VKPT_SHADER 45 | 46 | #endif // SHADER_STRUCTS_H -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/shadow_map.vert: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | // ========================================================================== // 20 | // Vertex shader for shadow map rendering. There is no pixel shader. 21 | // Multiplies world position by a matrix that is passed through push constants. 22 | // ========================================================================== // 23 | 24 | #version 450 25 | #extension GL_ARB_separate_shader_objects : enable 26 | 27 | out gl_PerVertex { 28 | vec4 gl_Position; 29 | }; 30 | 31 | layout(location = 0) in vec3 world_pos; 32 | 33 | layout(push_constant, std140) uniform ShadowMapConstants { 34 | mat4 view_projection_matrix; 35 | } push; 36 | 37 | void 38 | main() 39 | { 40 | gl_Position = push.view_projection_matrix * vec4(world_pos, 1); 41 | gl_Position.y = -gl_Position.y; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/sky.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _SHADER_PHYSICAL_SKY_ 20 | #define _SHADER_PHYSICAL_SKY_ 21 | 22 | #define PHYSICAL_SKY_FLAG_NONE (0) 23 | 24 | #define PHYSICAL_SKY_FLAG_USE_SKYBOX (1 << 0) 25 | #define PHYSICAL_SKY_FLAG_DRAW_MOUNTAINS (1 << 1) 26 | #define PHYSICAL_SKY_FLAG_DRAW_CLOUDS (1 << 2) 27 | 28 | #define PHYSICAL_SKY_MASK_OFFSET (PHYSICAL_SKY_FLAG_DRAW_CLOUDS - 1) 29 | 30 | 31 | #ifndef VKPT_SHADER 32 | 33 | 34 | 35 | #else 36 | bool useSkybox() { 37 | return (global_ubo.physical_sky_flags & PHYSICAL_SKY_FLAG_USE_SKYBOX) != 0; 38 | } 39 | 40 | bool drawMountains() { 41 | return (global_ubo.physical_sky_flags & PHYSICAL_SKY_FLAG_DRAW_MOUNTAINS) != 0; 42 | } 43 | 44 | bool drawClouds() { 45 | return (global_ubo.physical_sky_flags & PHYSICAL_SKY_FLAG_DRAW_CLOUDS) != 0; 46 | } 47 | #endif 48 | 49 | #endif // _SHADER_PHYSICAL_SKY_ 50 | -------------------------------------------------------------------------------- /src/Refresh/vkpt/shader/tiny_encryption_algorithm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2018 Christoph Schied 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | uvec2 20 | encrypt_tea(uvec2 arg) 21 | { 22 | const uint key[] = { 23 | 0xa341316c, 0xc8013ea4, 0xad90777d, 0x7e95761e 24 | }; 25 | uint v0 = arg[0], v1 = arg[1]; 26 | uint sum = 0; 27 | uint delta = 0x9e3779b9; 28 | 29 | #pragma unroll 30 | for(int i = 0; i < 16; i++) { 31 | //for(int i = 0; i < 32; i++) { 32 | sum += delta; 33 | v0 += ((v1 << 4) + key[0]) ^ (v1 + sum) ^ ((v1 >> 5) + key[1]); 34 | v1 += ((v0 << 4) + key[2]) ^ (v0 + sum) ^ ((v0 >> 5) + key[3]); 35 | } 36 | return uvec2(v0, v1); 37 | } 38 | -------------------------------------------------------------------------------- /src/Server/Models.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Brings Model loading to the server, allowing it to pass a model pointer 8 | * to the SharedGame Skeletal Animatio Data loading system. 9 | * 10 | ***/ 11 | #pragma once 12 | 13 | void SV_Model_BeginRegistrationSequence(); 14 | void SV_Model_EndRegistrationSequence(); 15 | void SV_Model_Init(); 16 | void SV_Model_Shutdown(); 17 | model_t *SV_Model_Alloc(void); 18 | void SV_Model_List_f(void); 19 | void SV_Model_FreeUnused(); 20 | void SV_Model_FreeAll(); 21 | 22 | void SV_Model_Reference(model_t* model); 23 | 24 | model_t* SV_Model_Find(const char* name); 25 | model_t *SV_Model_ForHandle(qhandle_t handle); 26 | qhandle_t SV_Model_RegisterModel(const char* name); -------------------------------------------------------------------------------- /src/Shared/Formats/Pak.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef FORMAT_PAK_H 20 | #define FORMAT_PAK_H 21 | 22 | /* 23 | ======================================================================== 24 | 25 | The .pak files are just a linear collapse of a directory tree 26 | 27 | ======================================================================== 28 | */ 29 | 30 | #define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P') 31 | 32 | #define MAX_FILES_IN_PACK 4096 33 | 34 | typedef struct { 35 | char name[56]; 36 | uint32_t filepos, filelen; 37 | } dpackfile_t; 38 | 39 | typedef struct { 40 | uint32_t ident; // == IDPAKHEADER 41 | uint32_t dirofs; 42 | uint32_t dirlen; 43 | } dpackheader_t; 44 | 45 | #endif // FORMAT_PAK_H 46 | -------------------------------------------------------------------------------- /src/Shared/Formats/Pcx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef FORMAT_PCX_H 20 | #define FORMAT_PCX_H 21 | 22 | /* 23 | ======================================================================== 24 | 25 | PCX files are used for as many images as possible 26 | 27 | ======================================================================== 28 | */ 29 | 30 | typedef struct { 31 | uint8_t manufacturer; 32 | uint8_t version; 33 | uint8_t encoding; 34 | uint8_t bits_per_pixel; 35 | uint16_t xmin, ymin, xmax, ymax; 36 | uint16_t hres, vres; 37 | uint8_t palette[48]; 38 | uint8_t reserved; 39 | uint8_t color_planes; 40 | uint16_t bytes_per_line; 41 | uint16_t palette_type; 42 | uint8_t filler[58]; 43 | uint8_t data[1]; // unbounded 44 | } dpcx_t; 45 | 46 | #endif // FORMAT_PCX_H 47 | -------------------------------------------------------------------------------- /src/Shared/Formats/Sp2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef FORMAT_SP2_H 20 | #define FORMAT_SP2_H 21 | 22 | /* 23 | ======================================================================== 24 | 25 | .SP2 sprite file format 26 | 27 | ======================================================================== 28 | */ 29 | 30 | #define SP2_IDENT (('2'<<24)+('S'<<16)+('D'<<8)+'I') 31 | #define SP2_VERSION 2 32 | 33 | #define SP2_MAX_FRAMES 256 34 | #define SP2_MAX_FRAMENAME 64 35 | 36 | typedef struct { 37 | uint32_t width, height; 38 | uint32_t origin_x, origin_y; // raster coordinates inside pic 39 | char name[SP2_MAX_FRAMENAME]; // name of pcx file 40 | } dsp2frame_t; 41 | 42 | typedef struct { 43 | uint32_t ident; 44 | uint32_t version; 45 | uint32_t numframes; 46 | // dsp2frame_t frames[1]; // variable sized 47 | } dsp2header_t; 48 | 49 | #endif // FORMAT_SP2_H 50 | -------------------------------------------------------------------------------- /src/Shared/Formats/Wal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef FORMAT_WAL_H 20 | #define FORMAT_WAL_H 21 | 22 | /* 23 | ============================================================================== 24 | 25 | .WAL texture file format 26 | 27 | ============================================================================== 28 | */ 29 | 30 | #define MIPLEVELS 4 31 | 32 | typedef struct { 33 | char name[32]; 34 | uint32_t width, height; 35 | uint32_t offsets[MIPLEVELS]; // four mip maps stored 36 | char animname[32]; // next frame in animation chain 37 | uint32_t flags; 38 | uint32_t contents; 39 | uint32_t value; 40 | } miptex_t; 41 | 42 | #endif // FORMAT_WAL_H 43 | -------------------------------------------------------------------------------- /src/Shared/Math.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * License here. 4 | * 5 | * @file 6 | * 7 | * Shared Math Library. 8 | * 9 | ***/ 10 | #pragma once 11 | 12 | //----------------- 13 | // Utilities 14 | //----------------- 15 | #include "Math/Utilities.h" 16 | 17 | //----------------- 18 | // Vectors 19 | //----------------- 20 | #include "Math/Vector2.h" 21 | #include "Math/Vector3.h" 22 | #include "Math/Vector4.h" 23 | #include "Math/Vector5.h" 24 | 25 | //----------------- 26 | // Matrixes 27 | //----------------- 28 | #include "Math/Matrix3x3.h" 29 | #include "Math/Matrix4x4.h" 30 | 31 | //----------------- 32 | // Plane 33 | //----------------- 34 | #include "Math/Plane.h" 35 | 36 | //----------------- 37 | // Colors 38 | //----------------- 39 | #include "Math/Color.h" 40 | 41 | //----------------- 42 | // Rectangles. 43 | //----------------- 44 | #include "Math/Rectangle.h" 45 | 46 | //----------------- 47 | // Quaternions. 48 | //----------------- 49 | #include "Math/Quaternion.h" 50 | #include "Math/DualQuaternion.h" 51 | 52 | 53 | 54 | //----------------- 55 | // Specific Byte and Direction Vector Utilities. 56 | //----------------- 57 | #define NUMVERTEXNORMALS 162 58 | extern const vec3_t normalizedByteDirectionTable[NUMVERTEXNORMALS]; 59 | 60 | /** 61 | * @return The byteIndex of the normalized direction vector lookup table that closest matches the direction vector. 62 | **/ 63 | int32_t DirectionToByte(const vec3_t &dir); 64 | /** 65 | * @brief Gets the direction vector to the normalized direction vector table, positioned at 'byteindex'. 66 | **/ 67 | void ByteToDirection(int32_t byteIndex, vec3_t &direction); -------------------------------------------------------------------------------- /src/Shared/Math/Color.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // Shared/Math/color.h 5 | // 6 | // PH Math Library: Color 7 | // 8 | #ifndef __INC_SHARED_MATH_COLOR_H__ 9 | #define __INC_SHARED_MATH_COLOR_H__ 10 | 11 | #include "../Shared.h" 12 | 13 | // Color type definiton. (R8,G8,B8,A8) == uint32_t total. 14 | typedef union { 15 | uint32_t u32; 16 | uint8_t u8[4]; 17 | } color_t; 18 | 19 | // MakeColor macro. 20 | #if USE_BGRA 21 | #define MakeColor(r, g, b, a) (const uint32_t)MakeRawLong(b, g, r, a) 22 | #else 23 | #define MakeColor(r, g, b, a) (const uint32_t)MakeRawLong(r, g, b, a) 24 | #endif 25 | 26 | 27 | #endif // __INC_SHARED_MATH_COLOR_H__ -------------------------------------------------------------------------------- /src/Shared/Math/Rectangle.h: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // Shared/Math/rectangle.h 5 | // 6 | // PH Math Library: Rectangle 7 | // 8 | #ifndef __INC_SHARED_MATH_RECTANGLE_H__ 9 | #define __INC_SHARED_MATH_RECTANGLE_H__ 10 | 11 | #include "../Shared.h" 12 | 13 | // Use to 14 | typedef struct rect_s { 15 | int32_t x, y, width, height; 16 | } rect_t; 17 | 18 | #endif // __INC_SHARED_MATH_RECTANGLE_H__ -------------------------------------------------------------------------------- /src/Shared/Math/Vector2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Shared/Math/Vector2.h -------------------------------------------------------------------------------- /src/Shared/Math/Vector3.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/Shared/Math/Vector3.h -------------------------------------------------------------------------------- /src/Shared/Sound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * @details Sound channels 5 | * Channel 0 never willingly overrides 6 | * Other channels (1-7) allways override a playing sound on that channel 7 | **/ 8 | struct SoundChannel { 9 | static constexpr int32_t Auto = 0; 10 | static constexpr int32_t Weapon = 1; 11 | static constexpr int32_t Voice = 2; 12 | static constexpr int32_t Item = 3; 13 | static constexpr int32_t Body = 4; 14 | 15 | // Sound Channel Modifier Flags. 16 | //! Send to all clients, not just ones in PHS (ATTN 0 will also do this). 17 | static constexpr int32_t IgnorePHS = 8; 18 | //! Send by reliable message, not datagram. 19 | static constexpr int32_t Reliable = 16; 20 | }; 21 | 22 | /** 23 | * @brief Sound attenuation values 24 | **/ 25 | struct Attenuation { 26 | //! Full volume the entire level. 27 | static constexpr int32_t None = 0; 28 | static constexpr int32_t Normal = 1; 29 | static constexpr int32_t Idle = 2; 30 | //! Diminish very rapidly with distance. 31 | static constexpr int32_t Static = 3; 32 | }; -------------------------------------------------------------------------------- /src/Shared/Strings.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_SHARED_STRINGS_H__ 2 | #define __INC_SHARED_STRINGS_H__ 3 | 4 | 5 | 6 | #include 7 | 8 | // 9 | // String Splitting routine, shamelessly taken from: http://www.cplusplus.com/faq/sequences/strings/split/#token-vs-field 10 | // (the string::find_first_of variety ofc) 11 | // 12 | // 13 | struct split 14 | { 15 | enum empties_t { empties_ok, no_empties }; 16 | }; 17 | 18 | template inline 19 | Container& STR_Split( 20 | Container& result, 21 | const typename Container::value_type& s, 22 | const typename Container::value_type& delimiters, 23 | split::empties_t empties = split::empties_ok) 24 | { 25 | result.clear(); 26 | size_t current; 27 | size_t next = -1; 28 | do 29 | { 30 | if (empties == split::no_empties) 31 | { 32 | next = s.find_first_not_of(delimiters, next + 1); 33 | if (next == Container::value_type::npos) break; 34 | next -= 1; 35 | } 36 | current = next + 1; 37 | next = s.find_first_of(delimiters, current); 38 | result.push_back(s.substr(current, next - current)); 39 | } while (next != Container::value_type::npos); 40 | return result; 41 | } 42 | 43 | #endif -------------------------------------------------------------------------------- /src/Shared/TickRate.h: -------------------------------------------------------------------------------- 1 | // License here. 2 | // 3 | // This file contains all constexpr that define how fast (what framerate, etc) the engine 4 | // operates at. 5 | // 6 | #pragma once 7 | 8 | // From here on out (game modules) we use chrono literals namespace by default. 9 | using namespace std::chrono_literals; 10 | 11 | 12 | 13 | //! Measurement used keeping track of time in the game. 14 | using GameTime = std::chrono::milliseconds; 15 | //! Normalized(0 to 1.0) 0.#th of a second per frame time measurement. 16 | using Frametime = std::chrono::duration; 17 | 18 | 19 | /** 20 | * @brief This is the actual framerate which the game logic will simulate at. 21 | * (Client, Server and including Shared game modules.) 22 | **/ 23 | static constexpr uint64_t BASE_HZ = 60; 24 | 25 | // Calclate all related values we need to make it work smoothly even if we have 26 | // a nice 250fps, the game must run at 60fps. 27 | static constexpr uint64_t BASE_FRAMERATE = BASE_HZ; 28 | 29 | //! Non-integral Frametime in Milliseconds, stored as double precision. 30 | static constexpr double BASE_FRAMETIME = 1000.0 / BASE_FRAMERATE; 31 | 32 | 33 | static constexpr double BASE_1_FRAMETIME = 1.0 / BASE_FRAMETIME; 34 | static constexpr double BASE_FRAMETIME_1000 = BASE_FRAMETIME / 1000.0; 35 | 36 | // Used for old-school hardcoded values. 37 | static constexpr uint64_t BASE_FRAMEDIVIDER = (int64_t)BASE_FRAMERATE / 10.0; -------------------------------------------------------------------------------- /src/Shared/UI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define CHAR_WIDTH 8 4 | #define CHAR_HEIGHT 8 5 | 6 | static constexpr int32_t UI_LEFT = 0x00000001; 7 | static constexpr int32_t UI_RIGHT = 0x00000002; 8 | static constexpr int32_t UI_CENTER = (UI_LEFT | UI_RIGHT); 9 | static constexpr int32_t UI_BOTTOM = 0x00000004; 10 | static constexpr int32_t UI_TOP = 0x00000008; 11 | static constexpr int32_t UI_MIDDLE = (UI_BOTTOM | UI_TOP); 12 | static constexpr int32_t UI_DROPSHADOW = 0x00000010; 13 | static constexpr int32_t UI_ALTCOLOR = 0x00000020; 14 | static constexpr int32_t UI_IGNORECOLOR = 0x00000040; 15 | static constexpr int32_t UI_XORCOLOR = 0x00000080; 16 | static constexpr int32_t UI_AUTOWRAP = 0x00000100; 17 | static constexpr int32_t UI_MULTILINE = 0x00000200; 18 | static constexpr int32_t UI_DRAWCURSOR = 0x00000400; -------------------------------------------------------------------------------- /src/System/Hunk.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2003-2012 Andrey Nazarov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "../Shared/Shared.h" 22 | 23 | struct memhunk_t { 24 | void *base; 25 | size_t maximumSize; 26 | size_t currentSize; 27 | size_t mapped; 28 | }; 29 | 30 | void Hunk_Begin(memhunk_t *hunk, size_t maximumSize); 31 | void *Hunk_Alloc(memhunk_t *hunk, size_t size); 32 | void Hunk_End(memhunk_t *hunk); 33 | void Hunk_Free(memhunk_t *hunk); 34 | -------------------------------------------------------------------------------- /src/System/Lirc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010 Andrey Nazarov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef LIRC_H 20 | #define LIRC_H 21 | 22 | void Lirc_GetEvents(void); 23 | void Lirc_Shutdown(void); 24 | qboolean Lirc_Init(void); 25 | 26 | #endif // LIRC_H 27 | -------------------------------------------------------------------------------- /src/System/Resources/basepoly_cl.rc: -------------------------------------------------------------------------------- 1 | #if HAVE_CONFIG_H 2 | #include "../../Shared/config.h" 3 | #endif 4 | 5 | #include 6 | 7 | #pragma code_page(65001) 8 | 9 | #ifdef _DEBUG 10 | #define VER_FILEFLAGS VS_FF_DEBUG 11 | #else 12 | #define VER_FILEFLAGS 0x0L 13 | #endif 14 | 15 | #define VER_FILEDESCRIPTION_STR "Polyhedron Engine - Client Game Module " LONG_VERSION_STRING 16 | #define VER_ORIGINALFILENAME_STR "clgame.dll" 17 | 18 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 19 | 20 | VS_VERSION_INFO VERSIONINFO 21 | FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 22 | PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 23 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 24 | FILEFLAGS VER_FILEFLAGS 25 | FILEOS VOS_NT_WINDOWS32 26 | FILETYPE VFT_DLL 27 | FILESUBTYPE VFT2_UNKNOWN 28 | BEGIN 29 | BLOCK "StringFileInfo" 30 | BEGIN 31 | BLOCK "040904B0" 32 | BEGIN 33 | VALUE "CompanyName", "Polyhedron Studio" 34 | VALUE "FileDescription", VER_FILEDESCRIPTION_STR 35 | VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR 36 | VALUE "FileVersion", VERSION_STRING 37 | VALUE "InternalName", "Polyhedron Client Game Module" 38 | VALUE "LegalCopyright", "Copyright (C) 2020-2022, Polyhedron Studio. All rights reserved." 39 | VALUE "ProductName", "Polyhedron Engine" 40 | VALUE "ProductVersion", VERSION_STRING 41 | END 42 | END 43 | BLOCK "VarFileInfo" 44 | BEGIN 45 | VALUE "Translation", 0x409, 0x4B0 46 | END 47 | END 48 | 49 | -------------------------------------------------------------------------------- /src/System/Resources/basepoly_sv.rc: -------------------------------------------------------------------------------- 1 | #if HAVE_CONFIG_H 2 | #include "../../Shared/config.h" 3 | #endif 4 | 5 | #include 6 | 7 | #pragma code_page(65001) 8 | 9 | #ifdef _DEBUG 10 | #define VER_FILEFLAGS VS_FF_DEBUG 11 | #else 12 | #define VER_FILEFLAGS 0x0L 13 | #endif 14 | 15 | #define VER_FILEDESCRIPTION_STR "Polyhedron Engine - Server Game Module " LONG_VERSION_STRING 16 | #define VER_ORIGINALFILENAME_STR "svgame.dll" 17 | 18 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 19 | 20 | VS_VERSION_INFO VERSIONINFO 21 | FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 22 | PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 23 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 24 | FILEFLAGS VER_FILEFLAGS 25 | FILEOS VOS_NT_WINDOWS32 26 | FILETYPE VFT_DLL 27 | FILESUBTYPE VFT2_UNKNOWN 28 | BEGIN 29 | BLOCK "StringFileInfo" 30 | BEGIN 31 | BLOCK "040904B0" 32 | BEGIN 33 | VALUE "CompanyName", "Polyhedron Studio" 34 | VALUE "FileDescription", VER_FILEDESCRIPTION_STR 35 | VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR 36 | VALUE "FileVersion", VERSION_STRING 37 | VALUE "InternalName", "Polyhedron Server Game Module" 38 | VALUE "LegalCopyright", "Copyright (C) 2020-2022, Polyhedron Studio. All rights reserved." 39 | VALUE "ProductName", "Polyhedron Engine" 40 | VALUE "ProductVersion", VERSION_STRING 41 | END 42 | END 43 | BLOCK "VarFileInfo" 44 | BEGIN 45 | VALUE "Translation", 0x409, 0x4B0 46 | END 47 | END 48 | 49 | -------------------------------------------------------------------------------- /src/System/Resources/polyhedron.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/src/System/Resources/polyhedron.ico -------------------------------------------------------------------------------- /src/System/Resources/polyhedron.rc: -------------------------------------------------------------------------------- 1 | #if HAVE_CONFIG_H 2 | #include "../../Shared/config.h" 3 | #endif 4 | 5 | #include 6 | 7 | #pragma code_page(65001) 8 | 9 | #ifdef _DEBUG 10 | #define VER_FILEFLAGS VS_FF_DEBUG 11 | #else 12 | #define VER_FILEFLAGS 0x0L 13 | #endif 14 | 15 | #define VER_FILEDESCRIPTION_STR "Polyhedron Client " LONG_VERSION_STRING 16 | #define VER_ORIGINALFILENAME_STR "polyhedron.exe" 17 | 18 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 19 | 20 | VS_VERSION_INFO VERSIONINFO 21 | FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 22 | PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 23 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 24 | FILEFLAGS VER_FILEFLAGS 25 | FILEOS VOS_NT_WINDOWS32 26 | FILETYPE VFT_APP 27 | FILESUBTYPE VFT2_UNKNOWN 28 | BEGIN 29 | BLOCK "StringFileInfo" 30 | BEGIN 31 | BLOCK "040904B0" 32 | BEGIN 33 | VALUE "CompanyName", "Polyhedron Studio" 34 | VALUE "FileDescription", VER_FILEDESCRIPTION_STR 35 | VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR 36 | VALUE "FileVersion", VERSION_STRING 37 | VALUE "InternalName", "Polyhedron" 38 | VALUE "LegalCopyright", "Copyright (C) 2020-2022, Polyhedron Studio. All rights reserved." 39 | VALUE "ProductName", "Polyhedron Engine" 40 | VALUE "ProductVersion", VERSION_STRING 41 | END 42 | END 43 | BLOCK "VarFileInfo" 44 | BEGIN 45 | VALUE "Translation", 0x409, 0x4B0 46 | END 47 | END 48 | 49 | LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT 50 | 51 | 100 ICON "polyhedron.ico" 52 | 53 | -------------------------------------------------------------------------------- /src/System/Resources/polyhedron.xbm: -------------------------------------------------------------------------------- 1 | #define polyhedron_width 32 2 | #define polyhedron_height 32 3 | static unsigned char polyhedron_bits[] = { 4 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xe0, 0xff, 6 | 0xff, 0x1b, 0xc0, 0xff, 0xff, 0x77, 0xc0, 0xff, 0xff, 0xaa, 0x80, 0xff, 7 | 0xbf, 0x1e, 0x0a, 0xff, 0xff, 0x09, 0x70, 0xff, 0xff, 0x10, 0x80, 0xfe, 8 | 0x7f, 0x10, 0x00, 0xff, 0x6f, 0x10, 0x00, 0xfe, 0x3f, 0x10, 0x80, 0xff, 9 | 0x1f, 0x30, 0x10, 0xfd, 0x1f, 0x20, 0xe1, 0xfc, 0x1f, 0x20, 0x24, 0xf8, 10 | 0x0f, 0x20, 0x18, 0xfc, 0x1f, 0x60, 0x19, 0xfc, 0x7f, 0xe0, 0x06, 0xfc, 11 | 0x7f, 0xe3, 0x03, 0xfc, 0xff, 0xfc, 0x03, 0xfe, 0xff, 0xe1, 0x01, 0xfe, 12 | 0xff, 0xe1, 0x07, 0xff, 0xff, 0x23, 0xf0, 0xff, 0xff, 0x27, 0xfc, 0xff, 13 | 0xff, 0xdf, 0xdf, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 14 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 15 | -------------------------------------------------------------------------------- /src/System/Resources/polyhedron_dedicated.rc: -------------------------------------------------------------------------------- 1 | #if HAVE_CONFIG_H 2 | #include "../../Shared/config.h" 3 | #endif 4 | 5 | #include 6 | 7 | #pragma code_page(65001) 8 | 9 | #ifdef _DEBUG 10 | #define VER_FILEFLAGS VS_FF_DEBUG 11 | #else 12 | #define VER_FILEFLAGS 0x0L 13 | #endif 14 | 15 | #define VER_FILEDESCRIPTION_STR "Polyhedron Engine - Dedicated Server " LONG_VERSION_STRING 16 | #define VER_ORIGINALFILENAME_STR "polyhedron_dedicated.exe" 17 | 18 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 19 | 20 | VS_VERSION_INFO VERSIONINFO 21 | FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 22 | PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_POINT,0 23 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 24 | FILEFLAGS VER_FILEFLAGS 25 | FILEOS VOS_NT_WINDOWS32 26 | FILETYPE VFT_APP 27 | FILESUBTYPE VFT2_UNKNOWN 28 | BEGIN 29 | BLOCK "StringFileInfo" 30 | BEGIN 31 | BLOCK "040904B0" 32 | BEGIN 33 | VALUE "CompanyName", "Polyhedron Studio" 34 | VALUE "FileDescription", VER_FILEDESCRIPTION_STR 35 | VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR 36 | VALUE "FileVersion", VERSION_STRING 37 | VALUE "InternalName", "Polyhedron Dedicated Server" 38 | VALUE "LegalCopyright", "Copyright (C) 2020-2022, Polyhedron Studio. All rights reserved." 39 | VALUE "ProductName", "Polyhedron Engine" 40 | VALUE "ProductVersion", VERSION_STRING 41 | END 42 | END 43 | BLOCK "VarFileInfo" 44 | BEGIN 45 | VALUE "Translation", 0x409, 0x4B0 46 | END 47 | END 48 | 49 | LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT 50 | 51 | 100 ICON "polyhedron.ico" 52 | 53 | -------------------------------------------------------------------------------- /src/System/Resources/q2pro.default: -------------------------------------------------------------------------------- 1 | /* 2 | * This config is executed by both q2pro/q2proded at the very beginning 3 | * of initialization sequence, before any command line options are processed. 4 | * You can put any site specific defaults here, like base/library paths, etc. 5 | */ 6 | -------------------------------------------------------------------------------- /src/System/Resources/q2pro.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Polyhedron 3 | GenericName=Polyhedron Client 4 | Exec=Polyhedron 5 | Icon=Polyhedron 6 | Terminal=false 7 | Type=Application 8 | Categories=Game;ActionGame; 9 | -------------------------------------------------------------------------------- /src/System/Resources/q2pro.xbm: -------------------------------------------------------------------------------- 1 | #define q2icon_width 32 2 | #define q2icon_height 32 3 | static unsigned char q2icon_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x03, 0xc0, 0x00, 5 | 0x80, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x06, 6 | 0x60, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 7 | 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 8 | 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x70, 0x00, 0x00, 0x0e, 9 | 0x70, 0xf0, 0x0f, 0x0e, 0xe0, 0xe0, 0x07, 0x07, 0xe0, 0x61, 0x86, 0x07, 10 | 0xc0, 0x63, 0xc6, 0x03, 0x80, 0x7f, 0xfe, 0x01, 0x00, 0xff, 0xff, 0x00, 11 | 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0xe0, 0x07, 0x00, 12 | 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 13 | 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 14 | 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00 }; 15 | -------------------------------------------------------------------------------- /src/System/SDL2/Time.cpp: -------------------------------------------------------------------------------- 1 | // LICENSE HERE. 2 | 3 | // 4 | // os/sdl2/time.cpp 5 | // 6 | // 7 | // SDL2 Time function implementations. 8 | // 9 | 10 | #include "../../Shared/Shared.h" 11 | #include "../System.h" 12 | #include 13 | 14 | 15 | /** 16 | * @return Returns SDL2 time in Microseconds. 17 | **/ 18 | uint64_t Sys_Microseconds(void) { 19 | static Uint64 base = 0; 20 | static Uint64 freq = 0; 21 | 22 | // Initialize timer first time around. 23 | if (!base) { 24 | // Init SDL Timer for servers? 25 | if (!(SDL_WasInit(SDL_INIT_EVERYTHING) && SDL_INIT_TIMER)) { 26 | SDL_InitSubSystem(SDL_INIT_TIMER); 27 | } 28 | base = SDL_GetPerformanceCounter(); 29 | freq = SDL_GetPerformanceFrequency(); 30 | } 31 | 32 | return 1000000ULL * (SDL_GetPerformanceCounter() - base) / freq; 33 | } 34 | 35 | ///** 36 | //* @return Returns SDL2 time in Milliseconds. 37 | //**/ 38 | uint64_t Sys_Milliseconds(void) { 39 | return Sys_Microseconds() / 1000; 40 | } 41 | -------------------------------------------------------------------------------- /src/System/Unix/TTY.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2012 Andrey Nazarov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef TTY_H 20 | #define TTY_H 21 | 22 | #if USE_SYSCON 23 | qboolean tty_init_input(void); 24 | void tty_shutdown_input(void); 25 | #else 26 | #define tty_init_input() false 27 | #define tty_shutdown_input() (void)0 28 | #endif 29 | 30 | #endif // TTY_H 31 | -------------------------------------------------------------------------------- /src/System/Windows/GLImp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | // 20 | // win_glimp.h 21 | // 22 | 23 | #include 24 | #include 25 | 26 | typedef struct { 27 | HGLRC hGLRC; // handle to GL rendering context 28 | HINSTANCE hinstOpenGL; // handle to GL library 29 | qboolean minidriver; 30 | GLenum drawbuffer; 31 | unsigned extensions; 32 | } glwstate_t; 33 | 34 | extern glwstate_t glw; 35 | 36 | -------------------------------------------------------------------------------- /src/System/Windows/Threads/Threads.cpp: -------------------------------------------------------------------------------- 1 | #include "threads.h" 2 | 3 | // store the thread id per thread in thread local storage 4 | uint32_t threads_id = 0; 5 | -------------------------------------------------------------------------------- /src/System/Windows/Threads/Threads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // storage will be in the corresponding threads.c file: 8 | extern uint32_t threads_id; 9 | 10 | typedef struct { void* x; } pthread_mutex_t; 11 | #define threads_mutex_lock(m) ((void*)m) 12 | #define threads_mutex_unlock(m) ((void*)m) 13 | #define threads_mutex_destroy(m) ((void*)m) 14 | #define threads_mutex_init(m, p) ((void*)m) 15 | 16 | // hack :/ 17 | #define __sync_fetch_and_add(p, a) ((*(p) += (a)), *(p) - (a)) 18 | 19 | #ifndef aligned_alloc 20 | #define aligned_alloc(a, s) _aligned_malloc(s, a) 21 | #endif 22 | #ifndef aligned_free 23 | #define aligned_free(p) _aligned_free(p) 24 | #endif 25 | 26 | #define sysconf(x) 1 27 | #ifndef usleep 28 | #define usleep(x) 29 | #endif 30 | #ifndef sched_yield 31 | #define sched_yield() 32 | #endif 33 | 34 | typedef struct threads_t 35 | { 36 | uint32_t num_threads; 37 | uint32_t task[1]; 38 | void *pool; 39 | } 40 | threads_t; 41 | 42 | static inline void 43 | pthread_pool_task_init(uint32_t *task, void *pool, void* (*f)(void *), void *param) 44 | { // single threaded execution in line 45 | f(param); 46 | } 47 | 48 | static inline void pthread_pool_wait(void *pool) { } 49 | 50 | static inline threads_t *threads_init(uint32_t num_threads) 51 | { 52 | threads_t *t = malloc(sizeof(*t)); 53 | t->num_threads = 1; 54 | t->task[0] = 0; 55 | t->pool = 0; 56 | threads_id = 0; 57 | return t; 58 | } 59 | 60 | static inline void threads_cleanup(threads_t *t) 61 | { 62 | free(t); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /trenchbroom/Polyhedron/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/trenchbroom/Polyhedron/Icon.png -------------------------------------------------------------------------------- /trenchbroom/Polyhedron/assets/__tb_info_player_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/trenchbroom/Polyhedron/assets/__tb_info_player_start.png -------------------------------------------------------------------------------- /trenchbroom/Polyhedron/assets/pics/colormap.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/trenchbroom/Polyhedron/assets/pics/colormap.pcx -------------------------------------------------------------------------------- /trenchbroom/Polyhedron/assets/textures/__tb_empty.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/trenchbroom/Polyhedron/assets/textures/__tb_empty.jpg -------------------------------------------------------------------------------- /trenchbroom/Polyhedron/assets/textures/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/trenchbroom/Polyhedron/assets/textures/default.jpg -------------------------------------------------------------------------------- /trenchbroom/Polyhedron/template1.map: -------------------------------------------------------------------------------- 1 | // Game: Polyhedron 2 | // Format: Quake2 (Valve) 3 | // entity 0 4 | { 5 | "mapversion" "220" 6 | "classname" "worldspawn" 7 | "_tb_textures" "textures" 8 | // brush 0 9 | { 10 | ( -64 -64 -32 ) ( -64 -63 -32 ) ( -64 -64 -31 ) __TB_empty [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1 11 | ( -64 -64 -32 ) ( -64 -64 -31 ) ( -63 -64 -32 ) __TB_empty [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1 12 | ( -64 -64 -32 ) ( -63 -64 -32 ) ( -64 -63 -32 ) __TB_empty [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1 13 | ( 64 64 0 ) ( 64 65 0 ) ( 65 64 0 ) __TB_empty [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1 14 | ( 64 64 0 ) ( 65 64 0 ) ( 64 64 1 ) __TB_empty [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1 15 | ( 64 64 0 ) ( 64 64 1 ) ( 64 65 0 ) __TB_empty [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /trenchbroom/Polyhedron/template2.map: -------------------------------------------------------------------------------- 1 | // Game: Polyhedron 2 | // Format: Quake2 3 | // entity 0 4 | { 5 | "classname" "worldspawn" 6 | "_tb_textures" "textures" 7 | // brush 0 8 | { 9 | ( -64 -64 -32 ) ( -64 -63 -32 ) ( -64 -64 -31 ) __TB_empty 0 0 0 1 1 10 | ( -64 -64 -32 ) ( -64 -64 -31 ) ( -63 -64 -32 ) __TB_empty 0 0 0 1 1 11 | ( -64 -64 -32 ) ( -63 -64 -32 ) ( -64 -63 -32 ) __TB_empty 0 0 0 1 1 12 | ( 64 64 0 ) ( 64 65 0 ) ( 65 64 0 ) __TB_empty 0 0 0 1 1 13 | ( 64 64 0 ) ( 65 64 0 ) ( 64 64 1 ) __TB_empty 0 0 0 1 1 14 | ( 64 64 0 ) ( 64 64 1 ) ( 64 65 0 ) __TB_empty 0 0 0 1 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vulkan-1.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolyhedronStudio/Polyhedron-Engine/569bb9cde1f329ff8c8910b811bb0a17fb12cbd2/vulkan-1.lib --------------------------------------------------------------------------------