Skip to content

Instantly share code, notes, and snippets.

View graphitemaster's full-sized avatar
🎩
Building my dream game

Dale Weiler graphitemaster

🎩
Building my dream game
View GitHub Profile
typedef struct {
size_t allocated;
size_t used;
} vector_metadata_t;
#define VEC_WILLGROW(X,Y) ( \
((!(X) || vec_meta(X)->used + Y >= vec_meta(X)->allocated)) ? \
(void) VEC_MAKEGROW(((void**)&X), (Y), sizeof(*X)) : \
(void) 0 \
)
module gmqcc_out
function CSQC_Init
1 locals:
i
liferanges:
i: float [local] locked @0 [13,30] [35,46]
call0: string [value] @0 [null]
call1: void [return] @0 [null]
call2: string [value] callparam @0 [3,4]
call3: void [return] @0 [null]
/*
* Copyright (C) 2013
* Dale Weiler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
This file has been truncated, but you can view the full file.
YldvD1veTwok7rHc4qhq3ubN5pseXBl94zAzenQabAgQPGSExJFqsbvfTYhzjR6nQEk41AdaIJ1hZTtV
k9LckEIDxAROGEoVwrU6U5Ol44IVxnG6qoJ8234CVQRhDue4iWR5FV7X14LF9P5xiCxkG8DgXsrRWtpD
PFIekNCjRVyYu2bEPLUXW84O0VttJ6HYMtGj3y8WufRw90AYJc4pj6Djc4atpPUhdBkbKHUxgQ4gbazD
emwlxdL2CCAzZfgCoRm8gG3Mg70FixRKjNezOe9Yp87SnIGE2NsQEwYCCE9dYqycUvy4VwBcOyscAuz2
AOE7wQHAXsgLoIpiFwmkqvCtDp15m3EAFL6daE8QtTC9HuOBf62aRESc3TfqXtykC5OkUA8yNIFFgQun
SVCfxogQRUvLTeXW0IlUQuSlCh1q6tdWOnBJZsi1MbMpDrJD9gYz8JBoK1uEdOaQasySazm9JaNAtYIy
EqvN969S61ehC7z43Pc2CmLk7UdfmauaVFjaO9gPlLmySm2U9fWJPq3WIf94DciIJGeTu1EFoCgYDAhq
e1FS4jkhqmuObAirn9kozcYd8lnqZSrutVdZJPTo4MWu7dev0bWWFeF2SoSHaLB3kNLBY9Gsd8zGmtFN
Pj1zdUl3lMMuPIckeoJl29NA9bu2qFPaqQXRsISccpW27kjv1VvBq3KRxKGAjoyLPybsaEf4EkByS40v
zBl2TCxnS8UG4ZUXBK7PzAdhLZ9OZ4NinO90JuQPOhUyEyTPGZmDjNu2x2QU4mBs8KsRFGrvLXAH1XVa
@graphitemaster
graphitemaster / chip8.cfg
Created July 19, 2013 22:30
Cubescript Magic
emu_rom = [
0x22 0xFC 0x6B 0x0C 0x6C 0x3F 0x6D 0x0C 0xA2 0xEA 0xDA 0xB6 0xDC 0xD6 0x6E 0x00 0x22 0xD4 0x66 0x03 0x68
0x02 0x60 0x60 0xF0 0x15 0xF0 0x07 0x30 0x00 0x12 0x1A 0xC7 0x17 0x77 0x08 0x69 0xFF 0xA2 0xF0 0xD6 0x71
0xA2 0xEA 0xDA 0xB6 0xDC 0xD6 0x60 0x01 0xE0 0xA1 0x7B 0xFE 0x60 0x04 0xE0 0xA1 0x7B 0x02 0x60 0x1F 0x8B
0x02 0xDA 0xB6 0x60 0x0C 0xE0 0xA1 0x7D 0xFE 0x60 0x0D 0xE0 0xA1 0x7D 0x02 0x60 0x1F 0x8D 0x02 0xDC 0xD6
0xA2 0xF0 0xD6 0x71 0x86 0x84 0x87 0x94 0x60 0x3F 0x86 0x02 0x61 0x1F 0x87 0x12 0x46 0x00 0x12 0x78 0x46
0x3F 0x12 0x82 0x47 0x1F 0x69 0xFF 0x47 0x00 0x69 0x01 0xD6 0x71 0x12 0x2A 0x68 0x02 0x63 0x01 0x80 0x70
0x80 0xB5 0x12 0x8A 0x68 0xFE 0x63 0x0A 0x80 0x70 0x80 0xD5 0x3F 0x01 0x12 0xA2 0x61 0x02 0x80 0x15 0x3F
0x01 0x12 0xBA 0x80 0x15 0x3F 0x01 0x12 0xC8 0x80 0x15 0x3F 0x01 0x12 0xC2 0x60 0x20 0xF0 0x18 0x22 0xD4
0x8E 0x34 0x22 0xD4 0x66 0x3E 0x33 0x01 0x66 0x03 0x68 0xFE 0x33 0x01 0x68 0x02 0x12 0x16 0x79 0xFF 0x49
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <stdint.h>
#include <pthread.h>
#include <unistd.h> // sleep()
struct Point {
// church numerals and lambda calculus in C++ using meta-template
// programming, everything evaluated at compile-time. This code should
// never be used in the real world. If I catch people using this for
// real-world code just because it's awesome I will track said people
// down and have a length discussion on why their existance is the
// reason I need to question the ethics of writing this code in the
// first place.
// all code is licensed under MIT under one condition, never actually
// use this code in real world programs, you can share it, and modify it
@graphitemaster
graphitemaster / cyclic.h
Created January 24, 2014 19:31
How to prevent cyclic includes in C/C++
#if NAME_HDR == 1
# warning "Cyclic include"
#endif
#ifndef NAME_HDR
#define NAME_HDR 1
put_stuff_here;
#undef NAME_HDR
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@graphitemaster
graphitemaster / gist:f8e6666c48fbedf6e554
Last active January 21, 2023 21:22
Engine achievements
Achievement Engine/Game Why it's bad
storing world space positions in gbuffer STALKER, F.E.A.R. Depth buffer can be used to derive position saving a lot of memory bandwidth
uploaded texture upside down Various engines, mostly Quake derived. Difficult to debug with tools like apitrace, nsight, pix, renderdoc, etc