diff --git a/engine.h b/engine.h new file mode 100644 index 0000000..ef2d68c --- /dev/null +++ b/engine.h @@ -0,0 +1,248 @@ +#define FULLENGINENAME "Rad-Therapy II" +#define GAME_SHORTNAME "halflife2" +#define GAME_BASEGAMES "platform","hl2" +#define GAME_PROTOCOL "FTE-RadTherapy2" +#define GAME_DEFAULTCMDS "game_hl2;fteplug_ffmpeg;fteplug_hl2;fteplug_ode;plug_load ffmpeg;plug_load hl2;plug_load ode" +#define GAME_DOWNLOADSURL "https://www.frag-net.com/pkgs/list" + +#define BRANDING_ICON "freecs.ico" +#define DISTRIBUTION "RT2" +#define DISTRIBUTIONLONG "eukara" +#define GAME_FULLNAME FULLENGINENAME +#define GAME_DEFAULTPORT 27500 +#define ENGINEWEBSITE "https://www.frag-net.com/" + +#ifndef GLQUAKE +#define GLQUAKE +#endif + +/* +#ifndef VKQUAKE +#define VKQUAKE +#endif +*/ +#undef VKQUAKE /* not yet, needs more testing */ + + /* disable quake specific hacks and overrides */ +#define QUAKETC +#define NOBUILTINMENUS +#define NOLEGACY + +/* engine behaviour */ +#define PLUGINS /* enables fteplug_ files */ +#define AVAIL_ZLIB /* we need this for pk3 and ogg vorbis */ +#define CL_MASTER /* allows for serverbrowser builtins */ +#define CSQC_DAT /* clientside qcvm */ +#define MENU_DAT /* persistent qcvm */ +#define PSET_SCRIPT /* scripts defining particles */ +#define LOADERTHREAD /* multithreading related */ +#define USEAREAGRID /* leave it on, improves performance */ +#define AVAIL_DINPUT /* input for Windows */ +#define AVAIL_FREETYPE /* for truetype font rendering */ +#define AVAIL_STBI /* avoid libpng/libjpeg dependancies */ +#define ENGINE_ROUTING /* engine-side, fast routing */ + +#ifndef LEGACY_GPU + #define RTLIGHTS +#else + #undef RTLIGHTS +#endif + +#undef D3D9QUAKE /* MICROS~1 trash */ +#undef D3D11QUAKE /* MICROS~1 trash */ +#undef D3D8QUAKE /* MICROS~1 trash */ + +/* uncompressed textures */ +#define IMAGEFMT_BMP /* sprays */ +#define IMAGEFMT_TGA + +/* compressed textures */ +#define IMAGEFMT_KTX +#define DECOMPRESS_ETC2 +#define DECOMPRESS_RGTC +#define DECOMPRESS_S3TC + +/* To be able to comm with Frag-Net.com */ +#define HAVE_PACKET +#define SUPPORT_ICE +#define HAVE_TCP +#define HAVE_GNUTLS /* linux tls/dtls support */ +#define HAVE_WINSSPI /* windows tls/dtls support */ +#define WEBCLIENT /* uri_get+any internal downloads etc */ + +#ifndef MULTITHREAD +#define MULTITHREAD +#endif + +#ifndef DEBUG +/* if 2, disables writing fteextensions.qc completely. */ +#define NOQCDESCRIPTIONS 2 +#endif + +/* various package formats */ +#define PACKAGE_PK3 +#define PACKAGE_TEXWAD +#define PACKAGE_Q1PAK + +/* level formats */ +#define Q3BSPS +#define Q1BSPS +#define TERRAIN + +/* audio */ +#define AVAIL_DSOUND +#undef AVAIL_OPENAL +#define AVAIL_OGGVORBIS +#define HAVE_OPUS +#define VOICECHAT + +/* todo: make OpenAL only */ +#define HAVE_MIXER + +/* Model formats, IQM/VVM and HLMDL for legacy maps */ +#define INTERQUAKEMODELS +#define HALFLIFEMODELS + +/* physics */ +#undef USE_INTERNAL_ODE +#undef USE_INTERNAL_BULLET +#define RAGDOLL +#define USERBE + +/* we don't need any of these */ +#undef IMAGEFMT_PCX +#undef PACKAGE_DOOMWAD +#undef DOOMWADS +#undef MAP_PROC +#undef Q2BSPS +#define RFBSPS +#define VERTEXINDEXBYTES 2 //16bit indexes work everywhere but may break some file types, 32bit indexes are optional in gles<=2 and d3d<=9 and take more memory/copying but allow for bigger batches/models. Plugins need to be compiled the same way so this is no longer set per-renderer. +#define SPRMODELS +#undef SP2MODELS +#undef DSPMODELS +#undef MD1MODELS +#undef MD2MODELS +#undef MD3MODELS +#undef MD5MODELS +#undef ZYMOTICMODELS +#undef DPMMODELS +#undef PSKMODELS +#undef MENU_NATIVECODE /* native menu replacing menuQC */ +#undef MVD_RECORDING /* server can record MVDs. */ +#undef AVAIL_WASAPI /* windows advanced sound api */ +//#undef AVAIL_DSOUND /* MICROS~1 trash */ +#undef BOTLIB_STATIC /* q3 botlib */ +#undef AVAIL_XZDEC /* .xz decompression */ +#undef HAVE_SPEEX /* .xz decompression */ +#undef AVAIL_GZDEC /* .gz decompression */ +#undef PACKAGE_DZIP /* .dzip special-case archive support */ +#undef AVAIL_PNGLIB /* .png image format support (read+screenshots) */ +#undef AVAIL_JPEGLIB /* .jpeg image format support (read+screenshots) */ +#undef AVAIL_MP3_ACM /* .mp3 support (in windows). */ +#undef IMAGEFMT_DDS +#undef IMAGEFMT_PKM +#undef IMAGEFMT_BLP +#undef NETPREPARSE /* allows for running both nq+qw on the same server (if not, protocol used must match gamecode) */ +#undef USE_SQLITE /* sql-database-as-file support */ +#undef QUAKESTATS /* defines STAT_HEALTH etc. if omitted, you'll need to provide that functionality yourself */ +#undef QUAKEHUD /* support for drawing the vanilla hud */ +#undef QWSKINS /* disabling this means no qw .pcx skins nor enemy/team skin/colour forcing */ +#undef SVRANKING /* legacy server-side ranking system */ +#define HUFFNETWORK /* crappy network compression. probably needs reseeding */ +#undef SVCHAT /* ancient lame builtin to support NPC-style chat.. */ +#undef VM_Q1 /* q1qvm implementation, to support ktx */ +#undef Q2SERVER /* q2 server+gamecode */ +#undef Q2CLIENT /* q2 client. file formats enabled separately */ +#undef Q3CLIENT /* q3 client stuff */ +#undef Q3SERVER /* q3 server stuff */ +#undef HEXEN2 /* runs hexen2 gamecode, supports hexen2 file formats */ +#undef NQPROT /* act as an nq client/server, with nq gamecode */ +#undef WEBSERVER /* sv_ftp + sv_http cvars */ +#undef RUNTIMELIGHTING /* automatic generation of .lit files */ +#undef R_XFLIP /* old silly thing */ +#undef TEXTEDITOR /* because emacs */ +#undef TCPCONNECT /* support for playing over tcp sockets, instead of just udp. compatible with qizmo */ +#undef IRCCONNECT /* lame support for routing game packets via irc server. not a good idea */ +#undef PSET_CLASSIC /* support the 'classic' particle system, for that classic quake feel */ +#undef HAVE_CDPLAYER /* Redbook CD Audio */ +#undef QTERM +#undef SIDEVIEWS +#undef MAX_SPLITS +#undef SUBSERVERS /* multi-map */ +#undef VM_LUA /* lua game-logic */ +#undef HLCLIENT /* regressed, unfinished*/ +#undef HLSERVER /* regressed, unfinished */ +#undef FTPSERVER +#undef HAVE_JUKEBO /* includes built-in jukebox */ +#define HAVE_MEDIA_DECODER /* can play cin/roq, more with plugins */ +#undef HAVE_MEDIA_ENCODER /* capture/capturedemo work */ +#undef HAVE_SPEECHTOTEXT /* Windows speech-to-text thing */ +#undef SAVEDGAMES +#undef PACKAGEMANAGER /* enable/disable/download packages and plugins */ +#undef HEADLESSQUAKE +#undef WAYLANDQUAKE +#undef SERVER_DEMO_PLAYBACK /* deprecated */ +#undef DECOMPRESS_BPTC +#undef IMAGEFMT_HDR +#undef IMAGEFMT_PBM +#undef IMAGEFMT_PSD +#undef IMAGEFMT_XCF +#undef IMAGEFMT_LMP +#undef IMAGEFMT_PNG +#undef IMAGEFMT_JPG +#undef IMAGEFMT_GIF +#undef IMAGEFMT_EXR +#undef IPLOG +#undef AVAIL_BOTLIB +#undef AVAIL_BZLIB +#undef DECOMPRESS_ASTC +#undef IMAGEFMT_ASTC +#undef HAVE_HTTPSV +#undef MODELFMT_MDX +#undef MODELFMT_OBJ +#undef MODELFMT_GLTF + +#ifdef COMPILE_OPTS +/* things to configure qclib, which annoyingly doesn't include this + * file itself */ +-DOMIT_QCC /* disable the built-in qcc */ +-DSIMPLE_QCVM /* disable qc debugging and 32bit opcodes */ +#ifndef AVAIL_ZLIB +-DNO_ZLIB /* disable zlib */ +#endif +#ifdef AVAIL_PNGLIB +-DLINK_PNG +#endif +#ifdef AVAIL_JPEGLIB +-DLINK_JPEG +#endif +#ifdef AVAIL_FREETYPE +-DLINK_FREETYPE +#endif + +/* makefile will respond to this by trying to link bullet into the + * engine itself, instead of as a plugin. */ +#ifdef USE_INTERNAL_BULLET +-DLINK_INTERNAL_BULLET +#endif + +#ifdef USE_INTERNAL_ODE +-DODE_STATIC +#endif + +/* disable static speex */ +#ifdef HAVE_SPEEX +-DNO_SPEEX +#endif + +/* disable static botlib */ +#ifndef BOTLIB_STATIC +-DNO_BOTLIB +#endif + +-DLIBVORBISFILE_STATIC + +/* optimise for size instead of speed. less cpu cache needed means that + * its sometimes faster.*/ +-Os +#endif diff --git a/src/menu/Makefile b/src/menu/Makefile new file mode 100644 index 0000000..2fe44a4 --- /dev/null +++ b/src/menu/Makefile @@ -0,0 +1,4 @@ +QCC=fteqcc + +all: + $(QCC) progs.src diff --git a/src/menu/progs.src b/src/menu/progs.src new file mode 100644 index 0000000..953b5b8 --- /dev/null +++ b/src/menu/progs.src @@ -0,0 +1,10 @@ +#pragma target fte_5768 +//#pragma flag enable assumeint +#pragma progs_dat "../../menu.dat" +#define MENU +#define GAME_DIR "base" + +#includelist +../../../src/menu-vgui/includes.src +#endlist + diff --git a/zpak001.pk3dir/PAK_NAME b/zpak001.pk3dir/PAK_NAME new file mode 100644 index 0000000..8ed6502 --- /dev/null +++ b/zpak001.pk3dir/PAK_NAME @@ -0,0 +1 @@ +package_hl2.pk3 diff --git a/zpak001.pk3dir/cfg/skill_manifest.cfg b/zpak001.pk3dir/cfg/skill_manifest.cfg new file mode 100644 index 0000000..5187a53 --- /dev/null +++ b/zpak001.pk3dir/cfg/skill_manifest.cfg @@ -0,0 +1,2 @@ +exec "skill.cfg" +exec "skill_hl2.cfg" diff --git a/zpak001.pk3dir/cvar_defaults.cfg b/zpak001.pk3dir/cvar_defaults.cfg new file mode 100644 index 0000000..3ae3823 --- /dev/null +++ b/zpak001.pk3dir/cvar_defaults.cfg @@ -0,0 +1,161 @@ +set ai_debugAlerts "0" // Show prints when AI gets alerted to a position. +set ai_debugLogic "0" // Show prints when AI makes decisions regarding thinking. +set ai_debugNav "0" // Show prints when AI makes decisions regarding navigation. +set ai_debugScripts "0" // Show prints when AI interacts with scripted sequences. +set ai_runSpeed "320" // Default run speed chosen by AI characters, in units per second. +set ai_walkSpeed "150" // Default walk speed chosen by AI characters, in units per second. +set ai_enable "1" // Disable AI behaviour when set. + +set bot_aimless "0" // Bots will not set goals for themselves when set. +set bot_backspeed "133" // Bots desired maximum backwards speed. +set bot_crouch "0" // Bots are all forced to move crouched. +set bot_developer "0" // TODO: remove? +set bot_dont_shoot "0" // Bots never actually shoot. +set bot_enable "1" // Bot support enabled when set. +set bot_fastChat "0" // Bots will chat instantly instead of 'typing'. +set bot_forwardspeed "190" // Bots desired maximum forward speed. +set bot_minClients "-1" // How many player slots are to be filled, -1 is 'untouched'. +set bot_noChat "0" // Bots will no longer communicate when set. +set bot_pause "0" // Bots logic will be paused. +set bot_prefix "" // Bot nickname prefix for newly added bots. +set bot_prone "0" // Bots are all forced to move prone. +set bot_sidespeed "152" // Bots desired maximum strafe speed. +set bot_skill "2" // Bot version of cvar "skill". +set bot_walk "0" // Bots are forced to walk slowly. + +set cg_chatEnabled "1" // Enable the display of chat messages. +set cg_damageShake "0" // Shake the display upon taking damage. +set cg_hudAspect "0" // Aspect ratio override for the HUD. 1.0 is 1:1 square, 0 is auto. +set cg_muzzleDLight "1" // Enable dlights being spawned from muzzleflashes. +set cg_muzzleDLightColor "1.0 0.45 0.0" // Color of muzzleflash dlights. +set cg_viewZSmoothingMax "16" // Camera vertical-axis smoothing max delta threshold. +set cg_viewZSmoothingMin "1" // Camera vertical-axis smoothing delta threshold. +set cg_viewZSmoothingTime "0.1" // Camera vertical-axis smoothing steps. +set cg_viewmodelFlip "0" // Flip the viewmodel. +set cg_viewmodelFov "90" // Viewmodel field of view. +set cg_viewmodelLag "0" // Viewmodel lag when camera looks around. +set cg_viewmodelOffset "0 0 0" // Viewmodel offset in relative units (forward, right, up) +set cg_viewmodelPass "1" // Renders viewmodel in separate drawpass (no lighting) +set cg_viewmodelScale "1.0" // Viewmodel scale multiplier, affects bob as well. + +set cl_backspeed "400" // Client's desired backwards speed. +set cl_decals "128" +set cl_forwardspeed "400" // Client's desired forward speed. +set cl_musicstyle "0" +set cl_sidespeed "400" // Client's desired side-step speed. + +set con_color "255 150 0" // HUD color value, R G B, 0-255 for each channel. + +set dev_cornerspeed "0" // Override speed set by path_corner entities. +set dev_loddistance "0" // Override distance at which func_lod entities disappear. +set dev_skyscale "" // Override for the sky_camera room scale. + +set dsp_soundscapes "1" // Enable the use of sound scapes. + +set g_damageScale "1" // final damage scale on objects +set g_logLevel "2" // Game console log levels. 0 = None, 1 = Errors, 2 = Warnings, 3 = Extra Messages +set g_logTimestamps "0" // When 1, will print time stamps before the log message +set g_gravity "800" // Global gravity setting. + +set in_zoomSensitivity "1.0" // Input sensitivity multiplier for when you're zoomed in. + +set logging_enabled "0" // Enable server-side logging for game specific events. + +set menu_helptext_size "11" +set menu_intro "1" +set menu_steambg "0" +set menu_updating "0" + +set motdfile "motd.txt" + +set mp_allowvote "1" +set mp_decals "128" +set mp_flashlight "1" +set mp_td_dmgToKick "300" +set mp_td_dmgToWarn "200" + +set nav_linksize "256" +set nav_radius "32" + +set phys_developer "0" // Shows debug prints regarding physics operations when set. +set phys_impactforcescale "100" +set phys_pushscale "1" + +set pm_accelerate "10" +set pm_airaccelerate "10" +set pm_airstepsize "0" +set pm_boxcenter "1" +set pm_boxwidth "32" +set pm_crouchheight "36" +set pm_crouchspeed "90" +set pm_crouchviewheight "30" +set pm_edgefriction "1" +set pm_friction "4" +set pm_gravity "800" +set pm_jumpheight "265" +set pm_maxviewpitch "89" +set pm_minviewpitch "-89" +set pm_noclipaccelerate "5" +set pm_noclipspeed "500" +set pm_normalheight "72" +set pm_normalviewheight "64" +set pm_nospeedcap "0" +set pm_proneheight "0" +set pm_pronespeed "40.5" +set pm_proneviewheight "16" +set pm_runspeed "0" +set pm_stairSmoothing "1" +set pm_stamina "24" +set pm_staminarate "0.75" +set pm_staminathreshold "4" +set pm_stepsize "18" +set pm_stopspeed "100" +set pm_thirdPerson "0" +set pm_walkspeed "270" +set pm_wateraccelerate "10" +set pm_waterjumpheight "350" + +set r_autoscale "1" // When set, will ensure the game is at 640x480 type scaling. +set r_drawdecals "1" // Shows decal entities managed by the game when set. +set r_pixelscale "0" // When set, will ensure the 3D rendered scene is restricted to 640x480 resolution in definition. +set r_renderEntityInfo "0" // Display visual information about entities in-world. +set r_showDlights "0" // Displays dynamic light representations in-world. +set r_showPhysicsInfo "0" // Displays physics entity information in-world. +set r_skipGlows "0" // Skip rendering of glowing sprites. +set r_skipLensFlares "0" // Skip rendering of lens flares. +set r_skipWorld "0" // Skip rendering of the world. + +set rm_unlit_additive "1" // Render entities with the 'additive' rendermode fullbright. +set rm_unlit_texture "1" // Render entities with the 'texture' rendermode fullbright. + +set rope_debug "0" // Shows primitive debug rendering of a rope when set. +set rope_fast "1" // Don't perform expensive calculations on the rope when set. +set rope_maxsegments "-1" // Limit rope segments. -1 means no limit. +set rope_sag "2" // Rope sagging multiplier. +set rope_swing "2" // Rope swinging multiplier. + +set s_logLevel "2" // Sound console log levels. 0 = None, 1 = Errors, 2 = Warnings, 3 = Extra Messages + +set sp_decals "128" + +set sv_friendlyFire "0" // Team-inflicted damage is possible when set. +set sv_levelexec "1" // Will search and execute `/maps/currentmap.cfg` when set. +set sv_plugins "1" // Enable the use of server-side plugins when set. + +set vehicle_developer "0" // Shows vehicle related debug prints when set. + +set vgui_color "255 170 0" // Default primary color for VGUI widgets. + +set vid_brightness "0" // Controls display brightness. +set vid_gamma "1" // Controls gamma level. +set vid_desktopgamma "0" +set vid_hardwaregamma "2" + +set violence_ablood "1" // Enable non-human (alternative) blood. +set violence_agibs "1" // Enable non-human (alternative) gibs. +set violence_hblood "1" // Enable human blood. +set violence_hgibs "1" // Enable human giblets. + +set xr_roomScale "1.0" // XR: Room scale multiplier. +set xr_testInputs "0" // XR: Enable fake inputs, to debug the VR camera and weapon inputs. +set xr_viewHeight "-48" // XR: Default view-height offset. diff --git a/zpak001.pk3dir/decls/def/items.def b/zpak001.pk3dir/decls/def/items.def new file mode 100644 index 0000000..cd105d6 --- /dev/null +++ b/zpak001.pk3dir/decls/def/items.def @@ -0,0 +1,44 @@ +entityDef item_battery +{ + "spawnclass" "NSItem" + "model" "models/items/battery.mdl" + "mins" "-16 -16 0" + "maxs" "16 16 16" + "snd_acquire" "item.battery" + "snd_respawn" "item.respawn" + "inv_armor" "skill:battery" + "requires" "item_suit" +} + +entityDef item_healthvial +{ + "spawnclass" "NSItem" + "model" "models/healthvial.mdl" + "mins" "-16 -16 0" + "maxs" "16 16 16" + "snd_acquire" "item.healthkit" + "snd_respawn" "item.respawn" + "inv_health" "skill:healthvial" +} + +entityDef item_healthkit +{ + "spawnclass" "NSItem" + "model" "models/items/healthkit.mdl" + "mins" "-16 -16 0" + "maxs" "16 16 16" + "snd_acquire" "item.healthkit" + "snd_respawn" "item.respawn" + "inv_health" "skill:healthkit" +} + +entityDef item_suit +{ + "spawnclass" "NSItem" + "model" "models/items/hevsuit.mdl" + "mins" "-16 -16 0" + "maxs" "16 16 16" + "snd_acquire" "item.suit" + "snd_respawn" "item.respawn" + "inv_carry" "1" +} diff --git a/zpak001.pk3dir/decls/def/projectiles.def b/zpak001.pk3dir/decls/def/projectiles.def new file mode 100644 index 0000000..6439fac --- /dev/null +++ b/zpak001.pk3dir/decls/def/projectiles.def @@ -0,0 +1,6 @@ +entityDef projectile_bullet_base +{ + "spawnclass" "NSProjectile" + "is_bullet" "1" + "detonate_on_world" "1" +} diff --git a/zpak001.pk3dir/decls/def/spawns.def b/zpak001.pk3dir/decls/def/spawns.def new file mode 100644 index 0000000..e0145cb --- /dev/null +++ b/zpak001.pk3dir/decls/def/spawns.def @@ -0,0 +1,26 @@ +entityDef info_player_start +{ + "spawnclass" "NSSpawnPoint" + "editor_mins" "-16 -16 -36" + "editor_maxs" "16 16 36" + "editor_description" "Singleplayer Spawn Point" + "editor_color" "1 0 0" +} + +entityDef info_player_deathmatch +{ + "spawnclass" "NSSpawnPoint" + "editor_mins" "-16 -16 -36" + "editor_maxs" "16 16 36" + "editor_description" "Deathmatch Spawn Point" + "editor_color" "1 0 0" +} + +entityDef info_player_coop +{ + "spawnclass" "NSSpawnPoint" + "editor_mins" "-16 -16 -36" + "editor_maxs" "16 16 36" + "editor_description" "Cooperative Spawn Point" + "editor_color" "1 0 0" +} diff --git a/zpak001.pk3dir/default.cfg b/zpak001.pk3dir/default.cfg index b210ac5..a0b75fc 100644 --- a/zpak001.pk3dir/default.cfg +++ b/zpak001.pk3dir/default.cfg @@ -10,3 +10,5 @@ seta "cross_color" "0 255 0" seta pm_walkspeed 190 seta pm_runspeed 320 + +seta r_imageextensions "vtf tga" diff --git a/zpak001.pk3dir/default_controls.cfg b/zpak001.pk3dir/default_controls.cfg new file mode 100644 index 0000000..ec189a2 --- /dev/null +++ b/zpak001.pk3dir/default_controls.cfg @@ -0,0 +1,35 @@ +bind "ESC" "togglemenu" +bind "w" "+forward" +bind "s" "+back" +bind "a" "+moveleft" +bind "d" "+moveright" +bind "SPACE" "+jump" +bind "CTRL" "+duck" +bind "SHIFT" "+speed" +bind "0" "slot10" +bind "1" "slot1" +bind "2" "slot2" +bind "3" "slot3" +bind "4" "slot4" +bind "5" "slot5" +bind "6" "slot6" +bind "7" "slot7" +bind "8" "slot8" +bind "9" "slot9" +bind "UPARROW" "+forward" +bind "DOWNARROW" "+back" +bind "LEFTARROW" "+left" +bind "RIGHTARROW" "+right" +bind "MOUSE1" "+attack" +bind "MOUSE2" "+attack2" +bind "MWHEELDOWN" "invnext" +bind "MWHEELUP" "invprev" +bind "r" "+reload" +bind "e" "+use" +bind "TAB" "+showscores" +bind "y" "messagemode" +bind "u" "messagemode2" +bind "t" "impulse 201" +bind "f" "impulse 100" +bind "f1" "vote yes" +bind "f2" "vote no" diff --git a/zpak001.pk3dir/fonts/IBMPlexMono-Text.otf b/zpak001.pk3dir/fonts/IBMPlexMono-Text.otf new file mode 100644 index 0000000..3096456 Binary files /dev/null and b/zpak001.pk3dir/fonts/IBMPlexMono-Text.otf differ diff --git a/zpak001.pk3dir/fonts/IBMPlexMono-Text.txt b/zpak001.pk3dir/fonts/IBMPlexMono-Text.txt new file mode 100644 index 0000000..f72f765 --- /dev/null +++ b/zpak001.pk3dir/fonts/IBMPlexMono-Text.txt @@ -0,0 +1,92 @@ +Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/chat.font b/zpak001.pk3dir/fonts/chat.font new file mode 100644 index 0000000..d7956f1 --- /dev/null +++ b/zpak001.pk3dir/fonts/chat.font @@ -0,0 +1,2 @@ +path fonts/IBMPlexMono-Text.otf +size 12 \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/font16.font b/zpak001.pk3dir/fonts/font16.font new file mode 100644 index 0000000..34f2c50 --- /dev/null +++ b/zpak001.pk3dir/fonts/font16.font @@ -0,0 +1,2 @@ +path fonts/IBMPlexMono-Text.otf +size 16 \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/font20.font b/zpak001.pk3dir/fonts/font20.font new file mode 100644 index 0000000..d8f9d39 --- /dev/null +++ b/zpak001.pk3dir/fonts/font20.font @@ -0,0 +1,2 @@ +path fonts/IBMPlexMono-Text.otf +size 20 \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/fontcon.font b/zpak001.pk3dir/fonts/fontcon.font new file mode 100644 index 0000000..d7956f1 --- /dev/null +++ b/zpak001.pk3dir/fonts/fontcon.font @@ -0,0 +1,2 @@ +path fonts/IBMPlexMono-Text.otf +size 12 \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/menu_header.font b/zpak001.pk3dir/fonts/menu_header.font new file mode 100644 index 0000000..3992e2a --- /dev/null +++ b/zpak001.pk3dir/fonts/menu_header.font @@ -0,0 +1,3 @@ +rendersize "21 16" +path fonts/IBMPlexMono-Text.otf +size 16 \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/menu_label.font b/zpak001.pk3dir/fonts/menu_label.font new file mode 100644 index 0000000..aaebdd3 --- /dev/null +++ b/zpak001.pk3dir/fonts/menu_label.font @@ -0,0 +1,2 @@ +rendersize "10 11 12 14" +path fonts/IBMPlexMono-Text.otf \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/menu_label_bold.font b/zpak001.pk3dir/fonts/menu_label_bold.font new file mode 100644 index 0000000..c8ddd86 --- /dev/null +++ b/zpak001.pk3dir/fonts/menu_label_bold.font @@ -0,0 +1,2 @@ +rendersize "14 12" +path fonts/IBMPlexMono-Text.otf \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/menu_main.font b/zpak001.pk3dir/fonts/menu_main.font new file mode 100644 index 0000000..f54db34 --- /dev/null +++ b/zpak001.pk3dir/fonts/menu_main.font @@ -0,0 +1,3 @@ +rendersize "14 11 12" +path fonts/IBMPlexMono-Text.otf +size 12 \ No newline at end of file diff --git a/zpak001.pk3dir/fonts/ui.font b/zpak001.pk3dir/fonts/ui.font new file mode 100644 index 0000000..8422ed0 --- /dev/null +++ b/zpak001.pk3dir/fonts/ui.font @@ -0,0 +1,4 @@ +color "255 255 255" +alpha 255 +size 12 +path fonts/IBMPlexMono-Text.otf diff --git a/zpak001.pk3dir/glsl/vmt/lightmapped.glsl b/zpak001.pk3dir/glsl/vmt/lightmapped.glsl new file mode 100644 index 0000000..3b37c41 --- /dev/null +++ b/zpak001.pk3dir/glsl/vmt/lightmapped.glsl @@ -0,0 +1,173 @@ +!!ver 110 +!!permu FOG +!!permu BUMP +!!permu LIGHTSTYLED +!!permu REFLECTCUBEMASK +!!samps diffuse + +!!samps lightmap +!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3 + +!!samps =BUMP normalmap + +// envmaps only +!!samps =REFLECTCUBEMASK reflectmask reflectcube + +!!permu FAKESHADOWS +!!cvardf r_glsl_pcf +!!samps =FAKESHADOWS shadowmap + +#include "sys/defs.h" + +varying vec2 tex_c; + +varying vec2 lm0; + +#ifdef LIGHTSTYLED +varying vec2 lm1, lm2, lm3; +#endif + +#ifdef FAKESHADOWS + varying vec4 vtexprojcoord; +#endif + +/* CUBEMAPS ONLY */ +#ifdef REFLECTCUBEMASK + varying vec3 eyevector; + varying mat3 invsurface; +#endif + +#ifdef VERTEX_SHADER + void lightmapped_init(void) + { + lm0 = v_lmcoord; + #ifdef LIGHTSTYLED + lm1 = v_lmcoord2; + lm2 = v_lmcoord3; + lm3 = v_lmcoord4; + #endif + } + + void main () + { + lightmapped_init(); + tex_c = v_texcoord; + gl_Position = ftetransform(); + + /* CUBEMAPS ONLY */ + #ifdef REFLECTCUBEMASK + invsurface = mat3(v_svector, v_tvector, v_normal); + + vec3 eyeminusvertex = e_eyepos - v_position.xyz; + eyevector.x = dot(eyeminusvertex, v_svector.xyz); + eyevector.y = dot(eyeminusvertex, v_tvector.xyz); + eyevector.z = dot(eyeminusvertex, v_normal.xyz); + #endif + + #ifdef FAKESHADOWS + vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0)); + #endif + } +#endif + +#ifdef FRAGMENT_SHADER + #include "sys/fog.h" + +#ifdef FAKESHADOWS + #include "sys/pcf.h" +#endif + + #ifdef LIGHTSTYLED + #define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb + #define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb + #define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb + #define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb + #else + #define LIGHTMAP texture2D(s_lightmap, lm0).rgb + #endif + + vec3 lightmap_fragment() + { + vec3 lightmaps; + +#ifdef LIGHTSTYLED + lightmaps = LIGHTMAP0 * e_lmscale[0].rgb; + lightmaps += LIGHTMAP1 * e_lmscale[1].rgb; + lightmaps += LIGHTMAP2 * e_lmscale[2].rgb; + lightmaps += LIGHTMAP3 * e_lmscale[3].rgb; +#else + lightmaps = LIGHTMAP * e_lmscale.rgb; +#endif + + /* the light we're getting is always too bright */ + lightmaps *= 0.75; + + /* clamp at 1.5 */ + if (lightmaps.r > 1.5) + lightmaps.r = 1.5; + if (lightmaps.g > 1.5) + lightmaps.g = 1.5; + if (lightmaps.b > 1.5) + lightmaps.b = 1.5; + + return lightmaps; + } + + void main (void) + { + vec4 diffuse_f; + vec3 light = vec3(0.0, 0.0, 0.0); + + diffuse_f = texture2D(s_diffuse, tex_c); + +#ifdef MASKLT + if (diffuse_f.a < float(MASK)) + discard; +#endif + +#ifdef FAKESHADOWS + diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord); +#endif + + /* deluxemapping isn't working on Source BSP yet */ + diffuse_f.rgb *= lightmap_fragment(); + +/* CUBEMAPS ONLY */ +#ifdef REFLECTCUBEMASK + /* We currently only use the normal/bumpmap for cubemap warping. move this block out once we do proper radiosity normalmapping */ + #ifdef BUMP + /* Source's normalmaps are in the DX format where the green channel is flipped */ + vec4 normal_f = texture2D(s_normalmap, tex_c); + normal_f.g *= -1.0; + normal_f.rgb = normalize(normal_f.rgb - 0.5); + #else + vec4 normal_f = vec4(0.0,0.0,1.0,0.0); + #endif + + #if defined(ENVFROMMASK) + /* We have a dedicated reflectmask */ + #define refl texture2D(s_reflectmask, tex_c).r + #else + /* when ENVFROMBASE is set or a normal isn't present, we're getting the reflectivity info from the diffusemap's alpha channel */ + #if defined(ENVFROMBASE) || !defined(BUMP) + #define refl 1.0 - diffuse_f.a + #else + #define refl normal_f.a * 0.5 + #endif + #endif + + vec3 cube_c = reflect(normalize(-eyevector), normal_f.rgb); + cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2]; + cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz; + diffuse_f.rgb += (textureCube(s_reflectcube, cube_c).rgb * vec3(refl,refl,refl)); +#endif + + light += (e_light_mul * lambert(norm, e_light_dir)) * 2.0; + light += (e_light_ambient * lambert(norm, reflect(norm, e_light_dir))) * 0.5; + light += (e_light_mul * dot(normal_f, e_light_dir)); + + diffuse_f.rgb *= light; + + gl_FragColor = fog4(diffuse_f); + } +#endif diff --git a/zpak001.pk3dir/glsl/vmt/refract.glsl b/zpak001.pk3dir/glsl/vmt/refract.glsl new file mode 100644 index 0000000..fa56149 --- /dev/null +++ b/zpak001.pk3dir/glsl/vmt/refract.glsl @@ -0,0 +1,47 @@ +!!ver 110 +!!samps diffuse +!!samps =BUMP normalmap +!!samps =REFLECTCUBEMASK reflectmask reflectcube +!!samps refraction=0 + +#include "sys/defs.h" + +varying vec2 tex_c; +varying mat3 invsurface; +varying vec4 tf_c; +varying vec3 eyeminusvertex; + +#ifdef VERTEX_SHADER + void main () + { + invsurface[0] = v_svector; + invsurface[1] = v_tvector; + invsurface[2] = v_normal; + tf_c = ftetransform(); + tex_c = v_texcoord; + gl_Position = tf_c; + } +#endif + +#ifdef FRAGMENT_SHADER + #include "sys/fog.h" + void main ( void ) + { + vec2 refl_c; + vec3 refr_f; + vec3 norm_f; + vec4 out_f = vec4( 1.0, 1.0, 1.0, 1.0 ); + + norm_f = ( texture2D( s_normalmap, tex_c).xyz); + norm_f.g *= -1.0; + norm_f = normalize( norm_f ); + + // Reflection/View coordinates + refl_c = ( 1.0 + ( tf_c.xy / tf_c.w ) ) * 0.5; + + refr_f = texture2D(s_refraction, refl_c + (norm_f.st) ).rgb; + out_f.rgb = refr_f * texture2D(s_diffuse, tex_c).rgb; + + gl_FragColor = out_f; + } +#endif diff --git a/zpak001.pk3dir/glsl/vmt/transition.glsl b/zpak001.pk3dir/glsl/vmt/transition.glsl new file mode 100644 index 0000000..100280f --- /dev/null +++ b/zpak001.pk3dir/glsl/vmt/transition.glsl @@ -0,0 +1,160 @@ +!!ver 110 +!!permu FOG +!!permu BUMP +!!permu LIGHTSTYLED +!!permu REFLECTCUBEMASK +!!permu UPPERLOWER +!!samps diffuse upper + +!!samps lightmap +!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3 + +!!samps =BUMP normalmap + +// envmaps only +!!samps =REFLECTCUBEMASK reflectmask reflectcube + +!!permu FAKESHADOWS +!!cvardf r_glsl_pcf +!!samps =FAKESHADOWS shadowmap + +#include "sys/defs.h" + +varying vec2 tex_c; +varying vec4 vex_color; + +varying vec2 lm0; + +#ifdef LIGHTSTYLED +varying vec2 lm1, lm2, lm3; +#endif + +#ifdef FAKESHADOWS + varying vec4 vtexprojcoord; +#endif + +/* CUBEMAPS ONLY */ +#ifdef REFLECTCUBEMASK + varying vec3 eyevector; + varying mat3 invsurface; +#endif + +#ifdef VERTEX_SHADER + void lightmapped_init(void) + { + lm0 = v_lmcoord; + #ifdef LIGHTSTYLED + lm1 = v_lmcoord2; + lm2 = v_lmcoord3; + lm3 = v_lmcoord4; + #endif + } + + void main () + { + lightmapped_init(); + tex_c = v_texcoord; + gl_Position = ftetransform(); + vex_color = v_colour; + + /* CUBEMAPS ONLY */ + #ifdef REFLECTCUBEMASK + invsurface = mat3(v_svector, v_tvector, v_normal); + + vec3 eyeminusvertex = e_eyepos - v_position.xyz; + eyevector.x = dot(eyeminusvertex, v_svector.xyz); + eyevector.y = dot(eyeminusvertex, v_tvector.xyz); + eyevector.z = dot(eyeminusvertex, v_normal.xyz); + #endif + + #ifdef FAKESHADOWS + vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0)); + #endif + } +#endif + +#ifdef FRAGMENT_SHADER + #include "sys/fog.h" + +#ifdef FAKESHADOWS + #include "sys/pcf.h" +#endif + + #ifdef LIGHTSTYLED + #define LIGHTMAP0 texture2D(s_lightmap0, lm0).rgb + #define LIGHTMAP1 texture2D(s_lightmap1, lm1).rgb + #define LIGHTMAP2 texture2D(s_lightmap2, lm2).rgb + #define LIGHTMAP3 texture2D(s_lightmap3, lm3).rgb + #else + #define LIGHTMAP texture2D(s_lightmap, lm0).rgb + #endif + + vec3 lightmap_fragment() + { + vec3 lightmaps; + +#ifdef LIGHTSTYLED + lightmaps = LIGHTMAP0 * e_lmscale[0].rgb; + lightmaps += LIGHTMAP1 * e_lmscale[1].rgb; + lightmaps += LIGHTMAP2 * e_lmscale[2].rgb; + lightmaps += LIGHTMAP3 * e_lmscale[3].rgb; +#else + lightmaps = LIGHTMAP * e_lmscale.rgb; +#endif + + /* the light we're getting is always too bright */ + lightmaps *= 0.75; + + /* clamp at 1.5 */ + if (lightmaps.r > 1.5) + lightmaps.r = 1.5; + if (lightmaps.g > 1.5) + lightmaps.g = 1.5; + if (lightmaps.b > 1.5) + lightmaps.b = 1.5; + + return lightmaps; + } + + void main (void) + { + vec4 diffuse_f; + diffuse_f.rgb = mix(texture2D(s_diffuse, tex_c).rgb, texture2D(s_upper, tex_c).rgb, vex_color.a); + diffuse_f.a = 1.0; + + /* deluxemapping isn't working on Source BSP yet, FIXME */ + diffuse_f.rgb *= lightmap_fragment(); + +#ifdef FAKESHADOWS + diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord); +#endif + +/* CUBEMAPS ONLY */ +#ifdef REFLECTCUBEMASK + /* We currently only use the normal/bumpmap for cubemap warping. move this block out once we do proper radiosity normalmapping */ + #ifdef BUMP + /* Source's normalmaps are in the DX format where the green channel is flipped */ + vec4 normal_f = texture2D(s_normalmap, tex_c); + normal_f.g *= -1.0; + normal_f.rgb = normalize(normal_f.rgb - 0.5); + #else + vec4 normal_f = vec4(0.0,0.0,1.0,0.0); + #endif + + /* when ENVFROMBASE is set or a normal isn't present, we're getting the reflectivity info from the diffusemap's alpha channel */ + #if defined(ENVFROMBASE) || !defined(BUMP) + /* since we're sampling from the diffuse = 1.0 fully visible, 0.0 = fully reflective */ + #define refl 1.0 - diffuse_f.a + #else + #define refl normal_f.a * 0.5 + #endif + + vec3 cube_c = reflect(normalize(-eyevector), normal_f.rgb); + cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2]; + cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz; + diffuse_f.rgb += (textureCube(s_reflectcube, cube_c).rgb * vec3(refl,refl,refl)); +#endif + + gl_FragColor = fog4(diffuse_f); + } +#endif diff --git a/zpak001.pk3dir/glsl/vmt/unlit.glsl b/zpak001.pk3dir/glsl/vmt/unlit.glsl new file mode 100644 index 0000000..bcb7915 --- /dev/null +++ b/zpak001.pk3dir/glsl/vmt/unlit.glsl @@ -0,0 +1,30 @@ +!!ver 110 +!!permu FOG +!!samps diffuse + +#include "sys/defs.h" +#include "sys/fog.h" + +varying vec2 tex_c; + +#ifdef VERTEX_SHADER +void main () +{ + tex_c = v_texcoord; + gl_Position = ftetransform(); +} +#endif + +#ifdef FRAGMENT_SHADER +void main () +{ + vec4 diffuse_f = texture2D( s_diffuse, tex_c ); + +#ifdef MASKLT + if (diffuse_f.a < float(MASK)) + discard; +#endif + + gl_FragColor = fog4( diffuse_f ); +} +#endif diff --git a/zpak001.pk3dir/glsl/vmt/vertexlit.glsl b/zpak001.pk3dir/glsl/vmt/vertexlit.glsl new file mode 100644 index 0000000..8b53ccd --- /dev/null +++ b/zpak001.pk3dir/glsl/vmt/vertexlit.glsl @@ -0,0 +1,140 @@ +!!ver 110 +!!permu FRAMEBLEND +!!permu BUMP +!!permu FOG +!!permu SKELETAL +!!permu AMBIENTCUBE +!!samps diffuse fullbright normalmap +!!permu FAKESHADOWS +!!cvardf r_glsl_pcf +!!samps =FAKESHADOWS shadowmap + +// envmaps only +!!samps =REFLECTCUBEMASK reflectmask reflectcube + +!!cvardf r_skipDiffuse + +#include "sys/defs.h" + +varying vec2 tex_c; +varying vec3 norm; + +/* CUBEMAPS ONLY */ +#ifdef REFLECTCUBEMASK + varying vec3 eyevector; + varying mat3 invsurface; +#endif + +#ifdef FAKESHADOWS + varying vec4 vtexprojcoord; +#endif + +#ifdef VERTEX_SHADER + #include "sys/skeletal.h" + + void main (void) + { + vec3 n, s, t, w; + tex_c = v_texcoord; + gl_Position = skeletaltransform_wnst(w,n,s,t); + norm = n; + +/* CUBEMAPS ONLY */ +#ifdef REFLECTCUBEMASK + invsurface = mat3(v_svector, v_tvector, v_normal); + + vec3 eyeminusvertex = e_eyepos - v_position.xyz; + eyevector.x = dot(eyeminusvertex, v_svector.xyz); + eyevector.y = dot(eyeminusvertex, v_tvector.xyz); + eyevector.z = dot(eyeminusvertex, v_normal.xyz); +#endif + + #ifdef FAKESHADOWS + vtexprojcoord = (l_cubematrix*vec4(v_position.xyz, 1.0)); + #endif + } +#endif + + +#ifdef FRAGMENT_SHADER + #include "sys/fog.h" + #include "sys/pcf.h" + + float lambert(vec3 normal, vec3 dir) + { + return max(dot(normal, dir), 0.0); + } + + float halflambert(vec3 normal, vec3 dir) + { + return (lambert(normal, dir) * 0.5) + 0.5; + } + + void main (void) + { + vec4 diffuse_f = texture2D(s_diffuse, tex_c); + vec3 light; + +#ifdef MASKLT + if (diffuse_f.a < float(MASK)) + discard; +#endif + +/* Normal/Bumpmap Shenanigans */ +#ifdef BUMP + /* Source's normalmaps are in the DX format where the green channel is flipped */ + vec3 normal_f = texture2D(s_normalmap, tex_c).rgb; + normal_f.g *= -1.0; + normal_f = normalize(normal_f.rgb - 0.5); +#else + vec3 normal_f = vec3(0.0,0.0,1.0); +#endif + +/* CUBEMAPS ONLY */ +#ifdef REFLECTCUBEMASK + /* when ENVFROMBASE is set or a normal isn't present, we're getting the reflectivity info from the diffusemap's alpha channel */ + #if defined(ENVFROMBASE) || !defined(BUMP) + #define refl 1.0 - diffuse_f.a + #else + #define refl texture2D(s_normalmap, tex_c).a + #endif + vec3 cube_c = reflect(normalize(-eyevector), normal_f.rgb); + cube_c = cube_c.x * invsurface[0] + cube_c.y * invsurface[1] + cube_c.z * invsurface[2]; + cube_c = (m_model * vec4(cube_c.xyz, 0.0)).xyz; + diffuse_f.rgb += (textureCube(s_reflectcube, cube_c).rgb * vec3(refl,refl,refl)); +#endif + +#ifdef AMBIENTCUBE + //no specular effect here. use rtlights for that. + vec3 nn = norm*norm; //FIXME: should be worldspace normal. + light = nn.x * e_light_ambientcube[(norm.x<0.0)?1:0] + + nn.y * e_light_ambientcube[(norm.y<0.0)?3:2] + + nn.z * e_light_ambientcube[(norm.z<0.0)?5:4]; +#else + #ifdef HALFLAMBERT + light = e_light_ambient + (e_light_mul * halflambert(norm, e_light_dir)); + #else + light = e_light_ambient + (e_light_mul * lambert(norm, e_light_dir)); + #endif + + /* the light we're getting is always too bright */ + light *= 0.75; + + /* clamp at 1.5 */ + if (light.r > 1.5) + light.r = 1.5; + if (light.g > 1.5) + light.g = 1.5; + if (light.b > 1.5) + light.b = 1.5; +#endif + + diffuse_f.rgb *= light; + + #ifdef FAKESHADOWS + diffuse_f.rgb *= ShadowmapFilter(s_shadowmap, vtexprojcoord); + #endif + + gl_FragColor = fog4(diffuse_f * e_colourident) * e_lmscale; + } +#endif diff --git a/zpak001.pk3dir/glsl/vmt/water.glsl b/zpak001.pk3dir/glsl/vmt/water.glsl new file mode 100644 index 0000000..223a64e --- /dev/null +++ b/zpak001.pk3dir/glsl/vmt/water.glsl @@ -0,0 +1,183 @@ +!!cvardf r_glsl_turbscale_reflect=1 //simpler scaler +!!cvardf r_glsl_turbscale_refract=1 //simpler scaler +!!samps diffuse normalmap +!!samps refract=0 //always present +!!samps =REFLECT reflect=1 +!!samps !REFLECT reflectcube +!!permu FOG + +#include "sys/defs.h" + +//modifier: REFLECT (s_t2 is a reflection instead of diffusemap) +//modifier: STRENGTH_REFL (distortion strength - 0.1 = fairly gentle, 0.2 = big waves) +//modifier: STRENGTH_REFL (distortion strength - 0.1 = fairly gentle, 0.2 = big waves) +//modifier: FRESNEL_EXP (5=water) +//modifier: TXSCALE (wave size - 0.2) +//modifier: RIPPLEMAP (s_t3 contains a ripplemap +//modifier: TINT_REFR (some colour value) +//modifier: TINT_REFL (some colour value) +//modifier: ALPHA (mix in the normal water texture over the top) +//modifier: USEMODS (use single-texture scrolling via tcmods - note, also forces the engine to actually use tcmod etc) + +//a few notes on DP compat: +//'dpwater' makes numerous assumptions about DP internals +//by default there is a single pass that uses the pass's normal tcmods +//the fresnel has a user-supplied min+max rather than an exponent +//both parts are tinted individually +//if alpha is enabled, the regular water texture is blended over the top, again using the same crappy tcmods... + +//legacy crap +#ifndef FRESNEL +#define FRESNEL 5.0 +#endif +#ifndef TINT +#define TINT 0.7,0.8,0.7 +#endif +#ifndef STRENGTH +#define STRENGTH 0.1 +#endif +#ifndef TXSCALE +#define TXSCALE 1 +#endif + +//current values (referring to legacy defaults where needed) +#ifndef FRESNEL_EXP +#define FRESNEL_EXP 4.0 +#endif +#ifndef FRESNEL_MIN +#define FRESNEL_MIN 0.0 +#endif +#ifndef FRESNEL_RANGE +#define FRESNEL_RANGE 1.0 +#endif +#ifndef STRENGTH_REFL +#define STRENGTH_REFL STRENGTH +#endif +#ifndef STRENGTH_REFR +#define STRENGTH_REFR STRENGTH +#endif +#ifndef TXSCALE1 +#define TXSCALE1 TXSCALE +#endif +#ifndef TXSCALE2 +#define TXSCALE2 TXSCALE +#endif +#ifndef TINT_REFR +#define TINT_REFR TINT +#endif +#ifndef TINT_REFL +#define TINT_REFL 1.0,1.0,1.0 +#endif +#ifndef FOGTINT +#define FOGTINT 0.2,0.3,0.2 +#endif + +varying vec2 tc; +varying vec4 tf; +varying vec3 norm; +varying vec3 eye; +#ifdef VERTEX_SHADER +void main (void) +{ + tc = v_texcoord.st; + tf = ftetransform(); + norm = v_normal; + eye = e_eyepos - v_position.xyz; + gl_Position = ftetransform(); +} +#endif +#ifdef FRAGMENT_SHADER +#include "sys/fog.h" + + +void main (void) +{ + vec2 stc; //screen tex coords + vec2 ntc; //normalmap/diffuse tex coords + vec3 n, refr, refl; + float fres; + float depth; + stc = (1.0 + (tf.xy / tf.w)) * 0.5; + //hack the texture coords slightly so that there are less obvious gaps + stc.t -= 1.5*norm.z/1080.0; + +#if 0//def USEMODS + ntc = tc; + n = texture2D(s_normalmap, ntc).xyz - 0.5; +#else + //apply q1-style warp, just for kicks + ntc.s = tc.s + sin(tc.t+e_time)*0.125; + ntc.t = tc.t + sin(tc.s+e_time)*0.125; + + //generate the two wave patterns from the normalmap + n = (texture2D(s_normalmap, vec2(TXSCALE1)*tc + vec2(e_time*0.1, 0.0)).xyz); + n += (texture2D(s_normalmap, vec2(TXSCALE2)*tc - vec2(0, e_time*0.097)).xyz); + n -= 1.0 - 4.0/256.0; +#endif + +#ifdef RIPPLEMAP + n += texture2D(s_ripplemap, stc).rgb*3.0; +#endif + n = normalize(n); + + //the fresnel term decides how transparent the water should be + fres = pow(1.0-abs(dot(n, normalize(eye))), float(FRESNEL_EXP)) * float(FRESNEL_RANGE) + float(FRESNEL_MIN); + +#ifdef DEPTH + float far = #include "cvar/gl_maxdist"; + float near = #include "cvar/gl_mindist"; + //get depth value at the surface + float sdepth = gl_FragCoord.z; + sdepth = (2.0*near) / (far + near - sdepth * (far - near)); + sdepth = mix(near, far, sdepth); + + //get depth value at the ground beyond the surface. + float gdepth = texture2D(s_refractdepth, stc).x; + gdepth = (2.0*near) / (far + near - gdepth * (far - near)); + if (gdepth >= 0.5) + { + gdepth = sdepth; + depth = 0.0; + } + else + { + gdepth = mix(near, far, gdepth); + depth = gdepth - sdepth; + } + + //reduce the normals in shallow water (near walls, reduces the pain of linear sampling) + if (depth < 100.0) + n *= depth/100.0; +#else + depth = 1.0; +#endif + + + //refraction image (and water fog, if possible) + refr = texture2D(s_refract, stc + n.st*float(STRENGTH_REFR)*float(r_glsl_turbscale_refract)).rgb * vec3(TINT_REFR); +#ifdef DEPTH + refr = mix(refr, vec3(FOGTINT), min(depth/4096.0, 1.0)); +#endif + +#ifdef REFLECT + //reflection/diffuse + refl = texture2D(s_reflect, stc - n.st*float(STRENGTH_REFL)*float(r_glsl_turbscale_reflect)).rgb * vec3(TINT_REFL); +#else + refl = textureCube(s_reflectcube, n).rgb;// * vec3(TINT_REFL); +#endif + + //interplate by fresnel + refr = mix(refr, refl, fres); + +#ifdef ALPHA + vec4 ts = texture2D(s_diffuse, ntc); + vec4 surf = fog4blend(vec4(ts.rgb, float(ALPHA)*ts.a)); + refr = mix(refr, surf.rgb, surf.a); +#else + refr = fog3(refr); +#endif + + //done + gl_FragColor = vec4(refr, 1.0); +} +#endif