Skip to content

Instantly share code, notes, and snippets.

View eevee's full-sized avatar
🦊

Eevee eevee

🦊
View GitHub Profile
@eevee
eevee / decorate-thoughts.lua
Created June 20, 2016 23:04
some thoughts on augmenting zdoom's DECORATE with lua
ZombieMan = define_actor{
name = "ZombieMan",
health = 20,
radius = 20,
height = 56,
speed = 8,
-- Why is this an integer out of 256 instead of just a float chance?
pain_chance = 0.78125,
monster, -- TODO These property bundles are really weird
floorclip = true,
0xc2 0xa0 0xc2 0xac, 0xc2 0xae 0xc2 0xbf, 0xc3 0x80 0xc3 0xbf, 0xe2 0x86 0x90 0xe2 0x87 0xbf, 0xe2 0x98 0x80 0xe2 0x9b 0xbf, 0xe2 0x9c 0x80 0xe2 0x9e 0xbf, 0xe3 0x80 0x81 0xe3 0x80 0x9c, 0xe3 0x81 0x81 0xe3 0x82 0x94, 0xe3 0x82 0xa1 0xe3 0x83 0xbe
@eevee
eevee / pokemon.yaml
Last active August 13, 2016 02:02
first iteration of ww-red/pokemon.yaml
%TAG !dex! tag:veekun.com,2005:pokedex/
--- !!omap
- bulbasaur: !dex!pokemon
name:
de: BISASAM
en: BULBASAUR
es: BULBASAUR
fr: BULBIZARRE
it: BULBASAUR
types:
@eevee
eevee / scope.lua
Created August 29, 2016 17:33
Lua scope is weird man
-- This works: "bar()" references a global by default, and the next block sets
-- a global variable.
function foo()
bar()
end
function bar()
print("bar")
end
-- This DOESN'T work: "bar()" references a global because Lua hasn't seen
@eevee
eevee / 3dfloors-notes.md
Created September 21, 2016 00:25
notes on remaining work on 3d floors
  • 3d floors
    • somewhat critical problem: ordering 3d floors by height means that the selection changes if you mousewheel the height above/below another floor
      • maybe i should get rid of the duplicated extra_floor_t struct and instead give each sector just a list of the control sectors, then identify by those instead of index?
      • could still stay sorted, even
      • it IS possible to have the same control sector mapped to two 3d floors, though. but is that ever useful??
      • i really wish i had faux flat/wall objects
        • i REALLY WISH i could just pass around sector pointers and bail if they're bogus??
    • can't highlight or select an inner flat of a 3d floor
    • mousewheel to change a regular ceiling height is super slow in my dump3 map; i think the full mapspecials thing is too expensive
  • may need to do actual incremental updates in this branch, right now! OH NO
@eevee
eevee / value.py
Created November 11, 2016 22:28
intercepting attribute assignment
class InterceptableAttribute:
def __init__(self, name, *twiddles):
self.twiddles = twiddles
# NOTE: this call and the 'name' arg will no longer be necessary in
# Python 3.6
self.__set_name__(None, name)
def __set_name__(self, owner, name):
self.name = name
@eevee
eevee / twitterbugs.md
Last active December 15, 2016 00:45
Twitter bugs and inconsistencies and general weirdness

Twitter bugs and inconsistencies and general weirdness

Derived in part from my attempt at a comprehensive list of the rules, which is probably out of date by now: https://eev.ee/blog/2016/02/20/twitters-missing-manual/

Tweets and replies

  • Poll options on web Twitter do not render emoji with Twemoji. They're left as plain text.

  • On web Twitter, typing several capital letters in a row tends to bring up a user suggestion dropdown. I guess the idea is that a word starting with a capital letter is likely to be a name, but the behavior seems erratic and unpredictable. It has never once been useful to me — if I want to mention someone, the first thing I type is @.

@eevee
eevee / untitled.md
Created December 15, 2016 20:29
Find the nearest/furthest actor from a source in ZDoom DECORATE

I needed a monster to set the nearest corpse as its target, but the same idea could be adapted to anything else easily enough.

  1. Clear the source's target. Set some user var on the source, user_closest_target, to a null-ish value like -1.

  2. Use A_RadiusGive from the source to give a dummy inventory item to every candidate actor.

  3. From the inventory item, call an ACS script.

  4. In the ACS script (where the candidate is the activator), check the distance from the candidate to the source via GetActorX, GetActorY, and VectorLength. If that distance is closer than user_closest_target (or user_closest_target is -1, meaning this is the first candidate checked), update user_closest_target and set the source's target to this candidate.

@eevee
eevee / busted.rs
Created March 14, 2017 03:12
weird-ass rust problem
enum IResult<I, O, E = u32> {
Done(I, O),
Error(E),
}
fn foo(input: &[u8]) {
if let IResult::Done(i, o) = IResult::Done(input, input) {}
}
@eevee
eevee / collision.lua
Created March 19, 2017 07:41
tile-based pico8 collision i wrote in like an hour or two
platscene = {
xaccel = 0.5,
xmax = 2,
gravity = 0.5,
ymax = 16,
}
function platscene:switch()
self.mapbbox = {0, 0, 16, 16}
self.playerbbox = {
0, 0,