Skip to content

Instantly share code, notes, and snippets.

View caligari87's full-sized avatar

Sterling Parker caligari87

View GitHub Profile
This was generated by ChatGPT, given a list of 100 commit messages and a prompt
@caligari87
caligari87 / cvarinfo.txt
Last active May 11, 2023 16:34
A simple implementation of a debug logging system, which can filter messages based on the a bitfield cvar
server int MyMod_DebugFilter = 0;
@caligari87
caligari87 / keycheck.zsc
Last active July 23, 2022 22:17
Small GZDoom zscript function for checking input buttons
// ----------------------------------------
// the default pointer is "self" for use in a custom player class.
// For an inventory item it would be owner, etc.
// if (KeyCheck(BT_ATTACK, KPT_JUSTPRESSED)) { console.printf("just pressed Attack!"); }
// ----------------------------------------
bool KeyCheck(int toCheck, int checkType = KPT_PRESSING, PlayerPawn pointer = null) {
if (pointer == null) { pointer = PlayerPawn(self); } // default fallback
if (!pointer) { return; } // nullcheck just to be safe
int b = pointer.player.cmd.buttons; int ob = pointer.player.oldbuttons;
switch (checkType) {
@caligari87
caligari87 / string-builder.cs
Last active April 29, 2022 13:41
A simple string variation builder (GZDoom / ZScript)
// Make a string from a variable template
static string BuildVariableString(string msg){
// some input example strings:
// "an empty {beer|soda|wine|champagne} bottle. {It is {cracked|broken|unlabeled}.}"
// "a {small|large|||} plush {emoji|cacodemon|teddy bear|furbie} toy."
// Collapse substrings, repeat until no more { }
while(true){
int LeftBrace = msg.RightIndexOf("{"); // find the rightmost left-brace {
int RightBrace = msg.IndexOf("}",LeftBrace+1); // find the nearest matching right-brace }
@caligari87
caligari87 / paintdrops.bas
Last active November 8, 2021 06:35
Paint droplet splatter generator for QB64 (qb64.org)
Type DropDef
Active As Integer
XPos As Single
YPos As Single
ZPos As Single
XVel As Single
YVel As Single
ZVel As Single
Radius As Single
Color As Long
@caligari87
caligari87 / nitevis.fp
Last active September 13, 2021 22:14
Custom nightvision shader for Hideous Destructor. Put the nitevis.fp file into a .pk3 and load after HD.
// (C) 2019 Sterling Parker (aka "Caligari87")
// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
//
// The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
// Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
// This notice may not be removed or altered from any source distribution.
//
// zlib License: https://opensource.org/licenses/Zlib
@caligari87
caligari87 / yt-duration-hover.css
Last active September 10, 2021 05:14
Hide the YouTube video duration overlay unless hovering the thumbnail. For a user-style addon, like Stylus. Demo video: https://streamable.com/ykhtls
ytd-thumbnail-overlay-time-status-renderer {
opacity: 0.0!important;
transition: opacity 0.1s!important;
}
.ytd-thumbnail:hover ytd-thumbnail-overlay-time-status-renderer {
opacity: 1.0!important;
transition: opacity 0.5s!important;
z-index: 2!important;
}
@caligari87
caligari87 / modlist.md
Last active May 24, 2021 19:43
List of the mods I commonly use with Hideous Destructor

List of the mods I commonly use with Hideous Destructor. Crossed-out mods are ones I don't use much anymore but might appear from time to time. Using some of these may require knowledge of GZDoom modding and/or packing pk3/wad files.

Gameplay

Visuals

@caligari87
caligari87 / simplerogue.bas
Created May 13, 2021 17:36
A QB64 roguelike in 50 lines
NewGame: SCREEN 0: RANDOMIZE TIMER: WIDTH 80, 60: HP = 100: XP = 0: Level = 1: _FULLSCREEN
NewLevel:
CLS: NewCave = 0: Col = 40: Row = 30: TYPE MonDef: X AS INTEGER: Y AS INTEGER: END TYPE: DIM Monsters(15) AS MonDef: DIM SHARED K$
FOR X = 2 TO 79: FOR Y = 2 TO 59: COLOR 8: LOCATE Y, X: PRINT "#";: NEXT: NEXT
FOR X = 5 TO 76: FOR Y = 5 TO 56: COLOR 8: LOCATE Y, X: PRINT ".";: NEXT: NEXT
FOR i = 0 TO (80 * 60 / 8): COLOR 8: LOCATE INT(52 * RND + 5), INT(72 * RND + 5): PRINT "#";: NEXT: LOCATE 1, 40: PRINT "Step 1+"; i; " ": KEYDELAY 1
FOR i = 1 TO 5: FOR X = 5 TO 75: FOR Y = 5 TO 55
IF RND < .15 AND (SCREEN(Y - 1, X) = 35 OR SCREEN(Y + 1, X) = 35 OR SCREEN(Y, X + 1) = 35 OR SCREEN(Y, X - 1) = 35) THEN COLOR 8: LOCATE Y, X: PRINT "#";
IF SCREEN(Y, X) = 35 AND (SCREEN(Y - 1, X) = 46 AND SCREEN(Y + 1, X) = 46 AND SCREEN(Y, X + 1) = 46 AND SCREEN(Y, X - 1) = 46) THEN COLOR 8: LOCATE Y, X: PRINT ".";
IF RND < .005 AND SCREEN(Y, X) = 46 THEN COLOR 14: LOCATE Y, X: PRINT "*";
@caligari87
caligari87 / zscript.txt
Last active November 30, 2020 15:51
Example Ugly as Sin food addon. Place in a .pk3 file and load after Ugly as Sin.
version "4.5"
// Food items that can be directly eaten
class ExampleMod_RedApple : UaS_Consumable {
default {
UaS_Consumable.Calories 95; // Calories
UaS_Consumable.Fluid 85; // Millilitres (remember most non-dehydrated foods have a lot of water in them)
UaS_Consumable.Bulk 10; // influences number of "bites" it takes to consume foods.
UaS_Consumable.Description "A medium-sized red apple.";
// UaS_Consumable.OpenMessage1 ""; // Random messages on opening packaged items