Skip to content

Instantly share code, notes, and snippets.

View nezvers's full-sized avatar

Agnis Aldiņš "NeZvērs" nezvers

View GitHub Profile
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@fenbf
fenbf / BasicParticles.cpp
Created April 27, 2014 05:47
Basic Particle classes design. Used as a starting point for my particle system. More details http://www.bfilipek.com
#include "particles.h"
#include <assert.h>
#include <algorithm>
namespace particles
{
void ParticleData::generate(size_t maxSize)
{
m_count = maxSize;
m_countAlive = 0;
@maxtruxa
maxtruxa / Makefile
Last active May 12, 2024 21:49
Generic makefile for C/C++ with automatic dependency generation, support for deep source file hierarchies and custom intermediate directories.
# output binary
BIN := test
# source files
SRCS := \
test.cpp
# files included in the tarball generated by 'make dist' (e.g. add LICENSE file)
DISTFILES := $(BIN)
@brunosxs
brunosxs / savenload.gd
Last active July 9, 2020 22:30
Godot Quick Tips 02: Simple save and load methods for godot engine with dir and file handling
# Created by BrunoSXS
# LICENSED UNDER MIT
var save_slot = 0 # Just like classic JRPs, change the slot to save in a different place
var current_save_game # This is the contents of the save file, for now we just declare it
var default_save = {"money":0,"powers":null} # The default save contents, if there is no save file to load, then, the current_save_game gets its contents from this variable and then creates a save file with it
func _ready():
current_save_game = load_game(save_slot) if typeof(load_game(save_slot)) == TYPE_DICTIONARY else default_save # This is the first loading, when the game starts.
@mairod
mairod / Webgl shader Hue Shift function
Last active April 26, 2024 07:12
Optimised Hue shift function in GLSL
vec3 hueShift( vec3 color, float hueAdjust ){
const vec3 kRGBToYPrime = vec3 (0.299, 0.587, 0.114);
const vec3 kRGBToI = vec3 (0.596, -0.275, -0.321);
const vec3 kRGBToQ = vec3 (0.212, -0.523, 0.311);
const vec3 kYIQToR = vec3 (1.0, 0.956, 0.621);
const vec3 kYIQToG = vec3 (1.0, -0.272, -0.647);
const vec3 kYIQToB = vec3 (1.0, -1.107, 1.704);
@sketchpunk
sketchpunk / catenary.js
Last active January 19, 2023 06:26
Catenary Curve for 2D / 3D in Javascript
// How to increment using the slope and offset comes from tasaboia's example but did not have a solution for A
// But found a way to calc for A from a ruby Wire Tool plugin, but it's incrementing did not work as well as tasaboia
// So mixing the two results in a good implementation of the Catenary Curve. All Credit belongs to those two developers.
// All I did is mash the code together and fixed / optimized it - SketchpunkLabs
// https://github.com/tasaboia/Procedural-Rope-Generator/blob/master/Assets/CatenaryTeste/Scripts/Catenary.cs
// http://rhin.crai.archi.fr/rld/plugin_details.php?id=990
function catenary(a, x){ return a * Math.cosh( x / a ); }
catenary.MAX_TRIES = 100;
catenary.getA = function(vecLen, maxLen){
@noidexe
noidexe / RoundRobinPlayer.gd
Created September 9, 2019 07:00
RoundRobinPlayer node for Godot Engine with sequence, random, and shuffle modes extending AudioStreamPlayer
tool
extends AudioStreamPlayer #exactly the same code should work for extending 2D and 3D versions
class_name RoundRobinPlayer
export(int, "sequence", "random", "shuffle") var queue_mode = 0
export(Array, AudioStream) var playlist = [] setget _set_playlist, _get_playlist
export(bool) var round_robin_playing = false setget _set_playing, _is_playing # can't override properties so use this for animations
var playlist_index = -1 # current position in the playlist
var shuffled_indices = [] # Array<int> of shuffled playlist indices
@NovemberDev
NovemberDev / godot_async_scene_loader.gd
Last active February 10, 2024 22:57
Asynchronously loads scenes in godot
# Loads a scene in the background using a seperate thread and a queue.
# Foreach new scene there will be an instance of ResourceInteractiveLoader
# that will raise an on_scene_loaded event once the scene has been loaded.
# Hooking the on_progress event will give you the current progress of any
# scene that is being processed in realtime. The loader also uses caching
# to avoid duplicate loading of scenes and it will prevent loading the
# same scene multiple times concurrently.
#
# Sample usage:
#
@EricEzaM
EricEzaM / flex_grid_container.gd
Last active April 22, 2024 17:43
A responsive grid container for GD script. Updates columns as you change the width.
tool
class_name FlexGridContainer
extends Container
var columns: int = 1 setget set_columns
func _notification(p_what):
match p_what:
@SteelPh0enix
SteelPh0enix / wave.c
Last active June 15, 2024 20:46
Simple parser for WAV files, written in C
#include "wave.h"
#include <stdio.h>
#include <string.h>
// Convert 32-bit unsigned little-endian value to big-endian from byte array
static inline uint32_t little2big_u32(uint8_t const* data) {
return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
}
// Convert 16-bit unsigned little-endian value to big-endian from byte array