diff --git a/animdefs.misc b/animdefs.misc index b06d2f36b..d492f931c 100644 --- a/animdefs.misc +++ b/animdefs.misc @@ -1 +1,2 @@ cameratexture LOGOFADE 64 64 +canvastexture SHEENLED 128 128 diff --git a/gldefs.sheenhmg b/gldefs.sheenhmg index 476a779b8..372f8e211 100644 --- a/gldefs.sheenhmg +++ b/gldefs.sheenhmg @@ -1,5 +1,6 @@ HardwareShader Texture "models/SheenLED.png" { Shader "shaders/glsl/Subpixel.fp" + Texture "scrtex" "SHEENLED" Texture "pixtex" "textures/subpixel.png" } diff --git a/language.version b/language.version index 7e93cd81f..9f5ce2e04 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r214 \cu(Mon 25 Jul 02:04:56 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r214 \cu(2022-07-25 02:04:56)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r215 \cu(Mon 25 Jul 02:07:07 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r215 \cu(2022-07-25 02:07:07)\c-"; diff --git a/models/SheenLED.png b/models/SheenLED.png index 43598bf9e..9a66e8823 100644 Binary files a/models/SheenLED.png and b/models/SheenLED.png differ diff --git a/models/SheenLED.xcf b/models/SheenLED.xcf deleted file mode 100644 index 8775c6bf1..000000000 Binary files a/models/SheenLED.xcf and /dev/null differ diff --git a/models/SheenLEDBar.png b/models/SheenLEDBar.png new file mode 100644 index 000000000..092adacd2 Binary files /dev/null and b/models/SheenLEDBar.png differ diff --git a/models/SheenLEDBase.png b/models/SheenLEDBase.png new file mode 100644 index 000000000..c637bd363 Binary files /dev/null and b/models/SheenLEDBase.png differ diff --git a/models/SheenLEDNums.png b/models/SheenLEDNums.png new file mode 100644 index 000000000..1156a0104 Binary files /dev/null and b/models/SheenLEDNums.png differ diff --git a/models/SheenLEDSpeed.png b/models/SheenLEDSpeed.png new file mode 100644 index 000000000..fca4d12ba Binary files /dev/null and b/models/SheenLEDSpeed.png differ diff --git a/shaders/glsl/Subpixel.fp b/shaders/glsl/Subpixel.fp index 23cbfced7..f0776c1ff 100644 --- a/shaders/glsl/Subpixel.fp +++ b/shaders/glsl/Subpixel.fp @@ -7,7 +7,7 @@ void SetupMaterial( inout Material mat ) { - mat.Base = getTexel(vTexCoord.st); + mat.Base = texture(scrtex,vec2(vTexCoord.s,1.-vTexCoord.t)); // canvas textures are upside-down when used by models vec2 uv = (vTexCoord.st*vec2(textureSize(tex,0)))/GRIDSZ; mat.Base *= 1.5*texture(pixtex,uv); mat.Normal = ApplyNormalMap(vTexCoord.st); diff --git a/zscript/dlc1/swwm_heavymahsheengun.zsc b/zscript/dlc1/swwm_heavymahsheengun.zsc index 47edd997a..b5dc9a772 100644 --- a/zscript/dlc1/swwm_heavymahsheengun.zsc +++ b/zscript/dlc1/swwm_heavymahsheengun.zsc @@ -12,6 +12,35 @@ Class HeavyMahSheenGun : SWWMWeapon transient ui SmoothDynamicValueInterpolator HeatInter; transient SpreadSlugTracer st; + transient ui Canvas AmmoLed; + ui TextureID AmmoLedBase, AmmoLedBar, AmmoLedSpeed, AmmoLedNums, AmmoLedCam; + + override void RenderTexture( RenderEvent e ) + { + if ( !AmmoLed ) AmmoLed = TexMan.GetCanvas("SHEENLED"); + if ( !AmmoLedBase ) AmmoLedBase = TexMan.CheckForTexture("models/SheenLEDBase.png",TexMan.Type_Any); + if ( !AmmoLedBar ) AmmoLedBar = TexMan.CheckForTexture("models/SheenLEDBar.png",TexMan.Type_Any); + if ( !AmmoLedSpeed ) AmmoLedSpeed = TexMan.CheckForTexture("models/SheenLEDSpeed.png",TexMan.Type_Any); + if ( !AmmoLedNums ) AmmoLedNums = TexMan.CheckForTexture("models/SheenLEDNums.png",TexMan.Type_Any); + int d1 = Ammo1.Amount%10; + int d2 = (Ammo1.Amount/10)%10; + int d3 = (Ammo1.Amount/100)%10; + AmmoLed.DrawTexture(AmmoLedBase,false,0,0); + AmmoLed.DrawTexture(AmmoLedSpeed,false,16,16,DTA_SrcHeight,16,DTA_DestHeight,16,DTA_Color,(firespeed==0)?0xFFFFFFFF:0xFF808080,DTA_LegacyRenderStyle,STYLE_Add); + AmmoLed.DrawTexture(AmmoLedSpeed,false,48,16,DTA_SrcY,16,DTA_SrcHeight,16,DTA_DestHeight,16,DTA_Color,(firespeed==1)?0xFFFFFFFF:0xFF808080,DTA_LegacyRenderStyle,STYLE_Add); + AmmoLed.DrawTexture(AmmoLedSpeed,false,80,16,DTA_SrcY,32,DTA_SrcHeight,16,DTA_DestHeight,16,DTA_Color,(firespeed==2)?0xFFFFFFFF:0xFF808080,DTA_LegacyRenderStyle,STYLE_Add); + if ( incooldown ) + AmmoLed.DrawTexture(AmmoLedNums,false,16,32,DTA_SrcX,64,DTA_SrcY,64,DTA_SrcWidth,96,DTA_SrcHeight,64,DTA_DestWidth,96,DTA_DestHeight,64,DTA_Color,((gametic%8)>=4)?0xFFFF0000:0xFF800000,DTA_LegacyRenderStyle,STYLE_Add); + else + { + AmmoLed.DrawTexture(AmmoLedNums,false,16,32,DTA_SrcX,(d3%8)*32,DTA_SrcY,(d3/8)*64,DTA_SrcWidth,32,DTA_SrcHeight,64,DTA_DestWidth,32,DTA_DestHeight,64,DTA_Color,(!d3)?0xFF808080:0xFFFFFFFF,DTA_LegacyRenderStyle,STYLE_Add); + AmmoLed.DrawTexture(AmmoLedNums,false,48,32,DTA_SrcX,(d2%8)*32,DTA_SrcY,(d2/8)*64,DTA_SrcWidth,32,DTA_SrcHeight,64,DTA_DestWidth,32,DTA_DestHeight,64,DTA_Color,(!d3&&!d2)?0xFF808080:0xFFFFFFFF,DTA_LegacyRenderStyle,STYLE_Add); + AmmoLed.DrawTexture(AmmoLedNums,false,80,32,DTA_SrcX,(d1%8)*32,DTA_SrcY,(d1/8)*64,DTA_SrcWidth,32,DTA_SrcHeight,64,DTA_DestWidth,32,DTA_DestHeight,64,DTA_Color,(!d3&&!d2&&!d1)?0xFF808080:0xFFFFFFFF,DTA_LegacyRenderStyle,STYLE_Add); + } + double ht = barrelheat*.96; + AmmoLed.DrawTexture(AmmoLedBar,false,16,100,DTA_SrcWidth,ht,DTA_DestWidthF,ht,DTA_LegacyRenderStyle,STYLE_Add); + } + override void HudTick() { Super.HudTick(); @@ -266,6 +295,7 @@ Class HeavyMahSheenGun : SWWMWeapon Weapon.AmmoType1 "SheenAmmo"; Weapon.AmmoGive1 30; SWWMWeapon.DropAmmoType "SheenAmmo"; + +SWWMWEAPON.HASSCRTEX; Stamina 100000; Radius 30; Height 28; diff --git a/zscript/swwm_handler.zsc b/zscript/swwm_handler.zsc index a42e763a0..4fee7946e 100644 --- a/zscript/swwm_handler.zsc +++ b/zscript/swwm_handler.zsc @@ -245,8 +245,12 @@ Class SWWMHandler : EventHandler sswl.Destroy(); } // weapon underlays - if ( players[consoleplayer].ReadyWeapon is 'SWWMWeapon' ) - SWWMWeapon(players[consoleplayer].ReadyWeapon).RenderUnderlay(e); + let sw = SWWMWeapon(players[consoleplayer].ReadyWeapon); + if ( sw ) + { + sw.RenderUnderlay(e); + if ( sw.bHASSCRTEX ) sw.RenderTexture(e); + } if ( !statusbar || !(statusbar is 'SWWMStatusBar') ) return; SWWMStatusBar(statusbar).viewpos = e.viewpos; SWWMStatusBar(statusbar).viewrot = (e.viewangle,e.viewpitch,e.viewroll); diff --git a/zscript/weapons/swwm_baseweapon.zsc b/zscript/weapons/swwm_baseweapon.zsc index f21eee589..0d3ca10ab 100644 --- a/zscript/weapons/swwm_baseweapon.zsc +++ b/zscript/weapons/swwm_baseweapon.zsc @@ -19,6 +19,7 @@ Class SWWMWeapon : Weapon abstract FlagDef NoFirstGive : SWeaponFlags, 0; // don't give ammo on first pickup (for weapons with a clip count) FlagDef HideInMenu : SWeaponFlags, 1; // don't show in inventory menu (usually for sister weapons) FlagDef NoSwapWeapon : SWeaponFlags, 2; // weapon is not affected by slot swapping + FlagDef HasScrTex : SWeaponFlags, 3; // weapon model has a scripted texture (calls RenderTexture() from Event Handler) bool IsSwapWeapon( Inventory i ) const { @@ -355,6 +356,10 @@ Class SWWMWeapon : Weapon abstract virtual ui void HudTick() { } + // updating a scripted texture in the model + virtual ui void RenderTexture( RenderEvent e ) + { + } // animations action void A_PlayerFire() {