Skip to content

Instantly share code, notes, and snippets.

@gamefreak
gamefreak / Antares LOC
Created February 20, 2011 19:22
CLOC results for the Ares, Xsera, Hera, and Athena
yggdrasil:Antares-Source-0.3.1 scott$cloc --exclude-dir=ext --by-file-by-lang ./
202 text files.
200 unique files.
909 files ignored.
http://cloc.sourceforge.net v 1.51 T=1.0 s (189.0 files/s, 52817.0 lines/s)
-------------------------------------------------------------------------------------------
File blank comment code
-------------------------------------------------------------------------------------------
./src/NetSetupScreen.cpp 354 285 2653
FSCatalogInfo catInfo;
FSGetCatalogInfo(&fileRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL);
FileInfo *info = (FileInfo*)catInfo.finderInfo;
info->fileCreator = 'ar12';
info->fileType = 'rsrc';
FSSetCatalogInfo(&fileRef, kFSCatInfoFinderInfo, &catInfo);
a zipped/gzipped directory called "data" with the extension: .xsscenario
./data.lua
data = {
objects = {…};
scenarios = {…};
races = {…};
};
media = {
sounds = {…};
sprites = {
@gamefreak
gamefreak / 99bottles.frag
Created May 8, 2011 19:43
Fragment shader for 99 bottles of beer in the wall.
#extension GL_EXT_gpu_shader4 : enable
const int A = 0x23c7;
const int B = 0xe953;
const int C = 0xc207;
const int D = 0xe853;
const int E = 0xc287;
const int F = 0x0287;
const int G = 0xe307;
const int H = 0x23c4;
@gamefreak
gamefreak / gist:1180869
Created August 30, 2011 13:26
Athena TODO
HIGH: blocking V1
* spritesheet import
* spritesheet export
* image browser
* image import
* image export
- finish condition editor
* select object sprites
* sound browser
* sound import
@gamefreak
gamefreak / gist:1180877
Created August 30, 2011 13:31
Athena command line options
Athena --base/file [--force-dl] [-l/--list] [-c/--check] [--format ares/xsera/lua/dump/antares outfile]
Conversion:
infile: optional may use base data, may need retrieve from web [forceable]
outformat
ares
xsera
lua
antares
dump
//gcc -framework Cocoa ./hdsize.m && ./a.out
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
const int width = 100+75;
const int height = 400000+100;
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(NULL, width, height, 5, 2 * width, cs, kCGImageAlphaNoneSkipFirst);
CGContextSetRGBFillColor(ctx, 0.0f, 0.0f, 0.0f, 1.0f);
@gamefreak
gamefreak / pictdecoder.cpp
Created October 1, 2011 22:16
Partial PICT decoder for eventual use in Athena
//
// main.cpp
// pictdecoder
//
// Created by Scott McClaugherty on 9/30/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include <fstream>
@gamefreak
gamefreak / gist:1261537
Created October 4, 2011 12:40
Failed MMX attempt.
static uint32_t pixel_magnitude(uint32 pixel, uint32 color) {
_m_empty();
__m64 null_ = _m_from_int(0x00000000);
__m64 pixel_ = _m_from_int(pixel);
pixel_ = _mm_unpacklo_pi8(pixel_, null_);
__m64 color_ = _m_from_int(color);
color_ = _mm_unpacklo_pi8(color_, null_);
pixel_ = _mm_sub_pi16(color_, pixel_);
pixel_ = _mm_madd_pi16(pixel_, pixel_);
color_ = _mm_srli_si64(pixel_, 32);
@gamefreak
gamefreak / gist:1261559
Created October 4, 2011 12:48
Pixel Magnitude function
#define SLICE(value, shift) (int16_t)((value & (0xff << shift)) >> shift)
static inline uint32_t pixel_magnitude(uint32 pixel, uint32 color) {
int16_t r = SLICE(pixel, 24) - SLICE(color, 24);
int16_t g = SLICE(pixel, 16) - SLICE(color, 16);
int16_t b = SLICE(pixel, 8) - SLICE(color, 8);
return (r*r+g*g+b*b);
}
#undef SLICE