Skip to content

Instantly share code, notes, and snippets.

View Bananattack's full-sized avatar

Andrew G. Crowell Bananattack

View GitHub Profile
@Bananattack
Bananattack / ai_wander.wiz
Last active April 17, 2018 04:36
Top-down NES demo in Wiz, using the current work-in-progress of the language. There are some weird things in here, but hopefully some revisions will iron out some of the strange stuff.
import "ram";
import "entity";
import "directions";
import "random";
namespace ai_wander {
const direction_wait_base : [u8] = [60];
const direction_wait_random : [u8] = [60];
const wander_speed_lo : [u8] = [128];
const wander_speed_hi : [u8] = [0];
// Linearly interpolate between two values using progress as weight between them.
//
// Arguments:
// b = start (0 .. 255)
// c = end (0 .. 255)
// e = progress (0 .. 64),
// 0 = 100% start, 0% end
// 32 = 50% start, 50% end
// 64 = 0% start; 100% end
//
@Bananattack
Bananattack / unique_ptr.h
Created May 22, 2019 18:10
A Unique Pointer-like type that gets ensures inlining of most operations, so they work much closer in performance to a raw pointer.
#ifndef WIZ_UNIQUE_PTR_H
#define WIZ_UNIQUE_PTR_H
#include <cstddef>
#include <type_traits>
#ifdef _MSC_VER
#define WIZ_FORCE_INLINE __forceinline
#elif defined(__clang__) || defined(__GNUC__)
#define WIZ_FORCE_INLINE __attribute__((always_inline))
@Bananattack
Bananattack / CASTLEVANIA2 BELMONTS REVENGE.txt
Created July 9, 2019 00:39
wavedumper script for VBA-rr, along with some samples captured with it (incomplete dumps). public domain, use for whatever you want, no warranty/liability/etc.
CASTLEVANIA2 BEL
----------------
5 sample(s) captured.
Sample #1
---------
HEX: