Add "exclusive use to pickup" option.

Make "pickup through melee" optional (disabled by default).
Increased leniency of use to pickup (nice for items with small hitboxes).
This commit is contained in:
Mari the Deer 2021-05-29 23:26:12 +02:00
commit 3500f72db0
38 changed files with 170 additions and 13 deletions

View file

@ -107,6 +107,8 @@ nosave int swwm_filterachievements = 1; // filter for achievements at 0%: 0 - n
nosave noarchive bool swwm_debugview = false; // debug visual aid for various things, such as actor collision, trajectories, relationships, etc.
nosave noarchive bool swwm_oldcheat = false; // set to true if you used a SWWM Platinum cheat, so the easter egg only appears once per session
server bool swwm_selflight = true; // player emits light
server bool swwm_usetopickup = false; // allow item pickup only by pressing use
server bool swwm_meleepickup = false; // allow picking up items through melee
// minimap settings
nosave bool swwm_mm_enable = true; // show a minimap below the score counter

View file

@ -184,6 +184,8 @@ SWWM_TIME_MINUTES = "minutes";
SWWM_TIME_SECONDS = "seconds";
SWWM_ATITLE = "Achievements";
SWWM_SELFLIGHT = "Self-Lighting";
SWWM_USETOPICKUP = "Exclusive Use To Pickup";
SWWM_MELEEPICKUP = "Allow Item Pickup Through Melee";
SWWM_MMTITLE = "Minimap Settings";
SWWM_MM_ENABLE = "Show Minimap";
SWWM_MM_ROTATE = "Rotate Minimap";
@ -320,6 +322,8 @@ TOOLTIP_SWWM_UNIQSTATS = "Clears duplicate map entries in the mission stats tab,
TOOLTIP_SWWM_FILTERACHIEVEMENTS = "Filters out achievements at 0% in the Demolitionist Menu, if you'd rather avoid spoiling the fun. The 'Obfuscate' option is recommended, as it will at least leave a hint of things to be discovered.";
TOOLTIP_SWWM_PLAYTIME = "Your total play time with this mod loaded.";
TOOLTIP_SWWM_SELFLIGHT = "Emit blue light from the player's face. Disable if this causes performance issues.";
TOOLTIP_SWWM_USETOPICKUP = "Prevents picking up mod items through touch, exclusively requiring a use action instead.";
TOOLTIP_SWWM_MELEEPICKUP = "Allows picking up items though melee attacks. Do note that some weapons have an extended melee range, allowing you to grab things from farther away.";
TOOLTIP_SWWM_MM_ENABLE = "Displays a minimap under the score counter.";
TOOLTIP_SWWM_MM_ROTATE = "Rotates the minimap view.";
TOOLTIP_SWWM_MM_GRID = "Shows a 128x128 grid on the minimap.";
@ -375,9 +379,9 @@ SWWM_CGUTA2 = "For the Gutamatics library, and for helping me with learning ZScr
SWWM_CKEKS2 = "For assistance with exception handling code, and also for being such a cool Touhou nerd.";
SWWM_CZN2 = "For slope alignment code, and to Nash also for being a cool smart cactus dude.";
SWWM_CVAL2 = "For the custom Nashgore footprints, and for being a good friend and cute bun.";
SWWM_CKATHY2 = "For being a great friend and for collaborating with me on lore and character development. May your world flourish too.";
SWWM_CBOUNCY2 = "For letting me rant about lore for hours, and being there to listen along. And for being cute and a friend.";
SWWM_CSLEDGE2 = "For being great buds, not just for me but for all of us, and also for encouraging me to take part in the Doom modiverse.";
SWWM_CKATHY2 = "For being one of my best friends ever and for collaborating with me on lore and character development. May your world flourish too.";
SWWM_CBOUNCY2 = "For lots of help with testing and for letting me rant about lore for hours and being there to listen along. You're a wonderful friend.";
SWWM_CSLEDGE2 = "For being great buds, not just for me but for all of us. Your support and encouragement are something I value a lot, and I can't thank you enough.";
SWWM_CSPY2 = "For being so enthusiastic about everything in this mod, and for being the cute little brother I never had.";
SWWM_CINSP1 = "Combine Kegan, HyperUltra64, TerminusEst13, Yholl and friends";
SWWM_CINSP2 = "For inspiration and also for being really cool people. Bless all of you, keep being amazing.";

View file

@ -183,6 +183,8 @@ SWWM_TIME_MINUTES = "minutos";
SWWM_TIME_SECONDS = "segundos";
SWWM_ATITLE = "Logros";
SWWM_SELFLIGHT = "Luz Propia";
SWWM_USETOPICKUP = "Uso Exclusivo para Recoger";
SWWM_MELEEPICKUP = "Permitir Recoger Ítems con Melé";
SWWM_MMTITLE = "Opciones de Minimapa";
SWWM_MM_ENABLE = "Mostrar Minimapa";
SWWM_MM_ROTATE = "Rotar Minimapa";
@ -319,6 +321,8 @@ TOOLTIP_SWWM_UNIQSTATS = "Elimina entradas duplicadas de mapa en la pestaña de
TOOLTIP_SWWM_FILTERACHIEVEMENTS = "Filtra logros al 0% en el Menú de Demolicionista, si prefieres no estropear la sorpresa. La opción de 'Ofuscar' es la recomendada, ya que al menos dejará pistas de cosas que quedan por descubrir.";
TOOLTIP_SWWM_PLAYTIME = "Tu tiempo de juego total con este mod cargado.";
TOOLTIP_SWWM_SELFLIGHT = "Emite luz azul desde la cara del jugador. Desactiva si causa problemas de rendimiento.";
TOOLTIP_SWWM_USETOPICKUP = "Evita recoger ítems del mod al tocarlos, en su lugar requiriendo exclusivamente una acción de uso.";
TOOLTIP_SWWM_MELEEPICKUP = "Permite recoger ítems por medio de ataques a melé. Ten en cuenta que algunas armas tienen un rango de melé extendido, permitiéndote alcanzar cosas desde una mayor distancia.";
TOOLTIP_SWWM_MM_ENABLE = "Muestra un minimapa bajo el contador de puntuación.";
TOOLTIP_SWWM_MM_ROTATE = "Gira la vista del minimapa.";
TOOLTIP_SWWM_MM_GRID = "Muestra una cuadrícula de 128x128 en el minimapa.";
@ -372,9 +376,9 @@ SWWM_CGUTA2 = "Por la librería de Gutamatics, y por ayudarme a aprender ZScript
SWWM_CKEKS2 = "Por asistencia con el código de manejo de excepciones, y también por ser un friki tan guay de Touhou.";
SWWM_CZN2 = "Por el código para alineación con superficies inclinadas, y a Nash además por ser un molón tío cactus listo.";
SWWM_CVAL2 = "Por las huellas personalizadas para Nashgore, y por ser una buena amiga y conejita mona.";
SWWM_CKATHY2 = "Por ser una gran amiga y por colaborar conmigo en lore y desarrollo de personajes. Deseo que tu mundo también prospere.";
SWWM_CBOUNCY2 = "Por dejar que suelte lore durante horas, y estar ahí para escuchar. Y por ser adorable y un amigo.";
SWWM_CSLEDGE2 = "Por ser grandes colegas, no solo conmigo si no con todos nosotros, y también por animarme a tomar parte en el modiverso de Doom.";
SWWM_CKATHY2 = "Por ser una de mis mejores amigas y por colaborar conmigo en lore y desarrollo de personajes. Deseo que tu mundo también prospere.";
SWWM_CBOUNCY2 = "Por tu gran ayuda con el testeo y por dejar que suelte lore durante horas y estar ahí para escuchar. Eres un amigo maravilloso.";
SWWM_CSLEDGE2 = "Por ser grandes colegas, no solo conmigo si no con todos nosotros. Vuestro apoyo y ánimo es algo que valoro muchísimo, y no hay forma de agradecéroslo suficientemente.";
SWWM_CSPY2 = "Por el nivel de entusiasmo mostrado por todo en este mod, y por ser el adorable hermano menor que nunca tuve.";
SWWM_CINSP1 = "Combine Kegan, HyperUltra64, TerminusEst13, Yholl y amigos";
SWWM_CINSP2 = "Por servir de inspiración y por ser gente muy molona. Benditos seáis todos, seguid siendo fenomenales.";

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r512 \cu(Thu 27 May 10:55:44 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r512 \cu(2021-05-27 10:55:44)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r513 \cu(Sat 29 May 23:26:12 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r513 \cu(2021-05-29 23:26:12)\c-";

View file

@ -173,6 +173,8 @@ OptionMenu "SWWMOptionMenu"
//Option "$SWWM_SWAPWEAPONS", "swwm_swapweapons", "YesNo" // comment out until DLC1
StaticText " "
StaticText "$SWWM_ITITLE", "Blue"
Option "$SWWM_USETOPICKUP", "swwm_usetopickup", "YesNo"
Option "$SWWM_MELEEPICKUP", "swwm_meleepickup", "YesNo"
Option "$SWWM_ARMORUSE", "swwm_autousearmor", "YesNo"
Option "$SWWM_HEALTHUSE", "swwm_autousehealth", "YesNo"
Option "$SWWM_AMMOUSE", "swwm_autouseammo", "YesNo"

View file

@ -6,7 +6,6 @@ Model "GenericCube"
Skin 0 "PerfectlyGeneric.png"
Scale 0.04 0.04 0.04
ZOffset 16
PitchOffset 30
ROTATING
FrameIndex XZW1 A 0 0

View file

@ -1,4 +1,5 @@
// This should act as Bilinear filtering when texture filtering is disabled
// the algo is pretty much public domain, so no credit given
void SetupMaterial( inout Material mat )
{

View file

@ -1,3 +1,7 @@
// adapted from original "fuzz" filter devised in 2016
// PRNG replaced with noise texture sampling to compensate for odd patterning
// on intel hardware
float rnd( in vec2 sd )
{
//return cos(sd.y*3874.8674+sd.x*6783.5325)*2737.8474;

View file

@ -1,3 +1,7 @@
// adapted from original "fuzz" filter devised in 2016
// PRNG replaced with noise texture sampling to compensate for odd patterning
// on intel hardware
float rnd( in vec2 sd )
{
//return cos(sd.y*3874.8674+sd.x*6783.5325)*2737.8474;

View file

@ -1,3 +1,7 @@
// adapted from original "fuzz" filter devised in 2016
// PRNG replaced with noise texture sampling to compensate for odd patterning
// on intel hardware
float rnd( in vec2 sd )
{
//return cos(sd.y*3874.8674+sd.x*6783.5325)*2737.8474;

View file

@ -1,3 +1,7 @@
// adapted from original "fuzz" filter devised in 2016
// PRNG replaced with noise texture sampling to compensate for odd patterning
// on intel hardware
float rnd( in vec2 sd )
{
//return cos(sd.y*3874.8674+sd.x*6783.5325)*2737.8474;

View file

@ -1,3 +1,5 @@
// scrolling smoke with gradient fade
void SetupMaterial( inout Material mat )
{
vec3 base = getTexel(vTexCoord.st).rgb;

View file

@ -1,3 +1,5 @@
// emulate keycard blink cycle on hud model
void SetupMaterial( inout Material mat )
{
float mixfct = floor(mod(timer*35.,20.)/10.);

View file

@ -1,3 +1,5 @@
// animated SWWM GZ logo
#define overlay(a,b) (a<0.5)?(2.0*a*b):(1.0-(2.0*(1.0-a)*(1.0-b)))
const float pi = 3.14159265358979323846;

View file

@ -1,3 +1,5 @@
// mykradvo center sprite
const float pi = 3.14159265358979323846;
void SetupMaterial( inout Material mat )

View file

@ -1,3 +1,5 @@
// mykradvo rings
const float pi = 3.14159265358979323846;
void SetupMaterial( inout Material mat )

View file

@ -1,8 +1,17 @@
// perfectly generic cube fake shading
void SetupMaterial( inout Material mat )
{
mat.Base = getTexel(vTexCoord.st);
}
vec4 ProcessLight( Material mat, vec4 color )
{
vec3 light = vec3(-.6,.7,.8);
vec4 col = getTexel(vTexCoord.st);
col.rgb *= max(dot(normalize(vEyeNormal.xyz),light),.25);
col.rgb += vec3(.2)*pow(max(dot(normalize(vEyeNormal.xyz),light),0.),4.);
mat.Base = col;
float val = max(dot(normalize(vEyeNormal.xyz),light),.25);
val += .2*pow(max(dot(normalize(vEyeNormal.xyz),light),0.),4.);
float mixfct = mix(1.,.5,floor(abs(vTexCoord.s-.5)*2.133333));
mixfct = mix(mixfct,.5,floor(abs(vTexCoord.t-.5)*2.13333));
val *= mixfct;
return vec4(vec3(val),color.a);
}

View file

@ -1,3 +1,5 @@
// pseudo-matcap
void SetupMaterial( inout Material mat )
{
vec3 rnorm = normalize(vEyeNormal.xyz)*vec3(1,-1,1);

View file

@ -1,3 +1,5 @@
// pseudo-matcap + scrolling overlay
void SetupMaterial( inout Material mat )
{
vec3 rnorm = normalize(vEyeNormal.xyz)*vec3(1,-1,1);

View file

@ -1,3 +1,5 @@
// pseudo-matcap + ambient glow
void SetupMaterial( inout Material mat )
{
vec3 rnorm = normalize(vEyeNormal.xyz)*vec3(1,-1,1);

View file

@ -1,3 +1,5 @@
// basic texture + masked pseudo-matcap
void SetupMaterial( inout Material mat )
{
vec4 base = getTexel(vTexCoord.st);

View file

@ -1,3 +1,5 @@
// RAINBOWS
void SetupMaterial( inout Material mat )
{
vec4 base = getTexel(vTexCoord.st);

View file

@ -1,3 +1,5 @@
// scrolling smoke with gradient fade
void SetupMaterial( inout Material mat )
{
vec3 base = getTexel(vTexCoord.st).rgb;

View file

@ -1,3 +1,5 @@
// barrier shimmering warp overlay
void main()
{
vec2 uv = TexCoord;

View file

@ -1,3 +1,5 @@
// ghost artifact refraction bubble
void main()
{
vec2 uv = TexCoord;

View file

@ -1,3 +1,5 @@
// glitched screen shader
const float thr1 = 6.4;
const float thr2 = 8.6;
const float thr3 = 19.3;

View file

@ -1,3 +1,5 @@
// invinciball radial sharpening
vec3 sharpened( vec2 uv )
{
vec3 col = texture(InputTexture,uv).rgb*9.;

View file

@ -1,3 +1,6 @@
// underwater overlay adapted from original Hexmas sanity effect shader
// lava version
vec2 calcdist( vec2 duv )
{
vec2 uv = vec2(0.);

View file

@ -1,3 +1,5 @@
// RAGE
#define TWOPI 6.28318530718
void main()

View file

@ -1,3 +1,5 @@
// less eye-searing rage
#define TWOPI 6.28318530718
void main()

View file

@ -1,3 +1,5 @@
// simple scope overlay + bokeh blur
#define PI 3.14159265
void main()

View file

@ -1,3 +1,6 @@
// underwater overlay adapted from original Hexmas sanity effect shader
// slime version
vec2 calcdist( vec2 duv )
{
vec2 uv = vec2(0.);

View file

@ -1,3 +1,6 @@
// underwater overlay adapted from original Hexmas sanity effect shader
// water version
vec2 calcdist( vec2 duv )
{
vec2 uv = vec2(0.);

View file

@ -1,3 +1,5 @@
// zoom blur effect adapted from abort_m berserk pulse
void main()
{
vec2 p = CenterSpot-TexCoord;

View file

@ -38,16 +38,23 @@ Class CrossLineFinder : LineTracer
Mixin Class SWWMUseToPickup
{
bool bUsePickup;
// allow pickup by use
override bool Used( Actor user )
{
// no use through melee
if ( (user.player.ReadyWeapon is 'SWWMWeapon') && SWWMWeapon(user.player.ReadyWeapon).wallponch && !swwm_meleepickup )
return false;
Vector3 itempos = Vec3Offset(0,0,Height/2),
userpos = user.Vec2OffsetZ(0,0,user.player.viewz);
// test vertical range
Vector3 diff = level.Vec3Diff(user.Vec3Offset(0,0,user.Height/2),Vec3Offset(0,0,Height/2));
double rang = user.player?PlayerPawn(user.player.mo).UseRange:(user.Height/2);
if ( abs(diff.z) > rang ) return false;
bUsePickup = true;
Touch(user);
bUsePickup = false;
// we got picked up
if ( bDestroyed || Owner || !bSPECIAL )
{
@ -63,6 +70,13 @@ Mixin Class SWWMUseToPickup
}
return false;
}
override void Touch( Actor toucher )
{
if ( toucher.player && swwm_usetopickup && !bUsePickup )
return;
Super.Touch(toucher);
}
}
Mixin Class SWWMOverlapPickupSound

View file

@ -1206,6 +1206,26 @@ Class SWWMBulletTrail : LineTracer
}
}
// finds the first pickup-able item
Class SWWMItemTracer : LineTracer
{
override ETraceStatus TraceCallback()
{
if ( Results.HitType == TRACE_HitActor )
{
if ( (Results.HitActor is 'Inventory') && Results.HitActor.bSPECIAL ) return TRACE_Stop;
return TRACE_Skip;
}
else if ( (Results.HitType == TRACE_HitWall) && (Results.Tier == TIER_Middle) )
{
if ( !Results.HitLine.sidedef[1] || (Results.HitLine.Flags&(Line.ML_BlockUse|Line.ML_BlockEverything)) )
return TRACE_Stop;
return TRACE_Skip;
}
return TRACE_Stop;
}
}
// Blob shadows
Class SWWMShadow : Actor
{

View file

@ -69,6 +69,8 @@ Class Demolitionist : PlayerPawn
Actor froggy;
transient int lastuse, failcounter, failcooldown;
transient SWWMItemTracer itrace;
bool meleeuse;
Property DashFuel : dashfuel;
@ -559,6 +561,33 @@ Class Demolitionist : PlayerPawn
else d.HitSector.SetTexture(0,replacewith);
}
}
void CheckItemUsePickup()
{
if ( player.usedown )
return;
if ( !itrace ) itrace = new("SWWMItemTracer");
Vector3 x, y, z, dir;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = Vec2OffsetZ(0,0,player.viewz);
Sector os = level.PointInSector(origin.xy);
int rings = 1;
Array<Actor> ignoreme;
ignoreme.Clear();
for ( double i=0; i<.2; i+=.02 )
{
for ( int j=0; j<360; j+=(360/rings) )
{
dir = (x+y*cos(j)*i+z*sin(j)*i).unit();
itrace.Trace(origin,os,dir,UseRange,0);
if ( itrace.Results.HitType != TRACE_HitActor ) continue;
if ( ignoreme.Find(itrace.Results.HitActor) < ignoreme.Size() ) continue;
player.usedown = true; // we found an item, ignore further uses
if ( itrace.Results.HitActor.Used(self) ) return;
ignoreme.Push(itrace.Results.HitActor);
}
rings += 2;
}
}
void CheckUnderwaterAmb( bool restore = false )
{
Vector3 headpos = Vec3Offset(0,0,player.viewheight);
@ -729,6 +758,8 @@ Class Demolitionist : PlayerPawn
CheckDefaceTexture();
if ( !player.usedown && froggy )
player.usedown = froggy.Used(self);
// try to "use" the item closest to the crosshair
CheckItemUsePickup();
}
Super.PlayerThink();
if ( (gametic == lastuse) && IsActorPlayingSound(CHAN_VOICE,"*usefail") )

View file

@ -5,6 +5,7 @@ Class SWWMWeapon : Weapon abstract
Mixin SWWMRespawn;
bool wasused;
bool bUsePickup;
private int SWeaponFlags;
Class<Ammo> dropammotype;
@ -50,11 +51,16 @@ Class SWWMWeapon : Weapon abstract
}
return;
}
if ( toucher.player && swwm_usetopickup && !bUsePickup )
return;
Super.Touch(toucher);
}
// allow pickup by use + swap weapon support
override bool Used( Actor user )
{
// no use through melee
if ( (user.player.ReadyWeapon is 'SWWMWeapon') && SWWMWeapon(user.player.ReadyWeapon).wallponch && !swwm_meleepickup )
return false;
Vector3 itempos = Vec3Offset(0,0,Height/2),
userpos = user.Vec2OffsetZ(0,0,user.player.viewz);
// test vertical range
@ -88,7 +94,9 @@ Class SWWMWeapon : Weapon abstract
user.player.PendingWeapon = WP_NOCHANGE;
}
}
bUsePickup = true;
Touch(user);
bUsePickup = false;
// we got picked up
if ( bDestroyed || Owner || !bSPECIAL )
{