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
@graphitemaster
graphitemaster / def.c
Created May 14, 2012 20:12
Deferred Renderer - 350LOC
/*
* A simple deferred renderer using OpenGL, C90 and SDL, plugin and use
* with no issue at all. All code is public domain -- Dale Weiler 2012
* a.k.a graphitemaster
*/
#include <SDL.h>
#include <SDL/SDL_opengl.h>
typedef struct {
GLuint fbo;
GLuint diffuse_target, diffuse_texture;
#if FOO_H == 1
#error Cyclic include
#endif
#ifndef FOO_H
#define FOO_H 1
stuff;
#undef FOO_H
#define FOO_H 0
This file has been truncated, but you can view the full file.
DEBUG: [COM] starting ...
Mode: progs.src
src: defs.qc
src: subs.qc
src: fight.qc
src: ai.qc
src: combat.qc
src: items.qc
src: weapons.qc
src: world.qc
#include <string.h>
#define BLOCK_ITEMS 16 /* largest alloc 262272 bytes */
/*
* This is a blockade allocator, a new idea in the world of allocators for small short
* lived objects. This allocator creates a table of BLOCK_ITEM chunks, which all contain
* pieces of memory that are allocated for N instances (by blockade_init(N)). Unlike a
* traditional block allocator we use integer log base 2 to map the byte-size to a linear
* sequence: e.g
* 8 bytes = 0
* 16 bytes = 1
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]
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 {
@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