Skip to content

Instantly share code, notes, and snippets.

@sapper-trle
sapper-trle / SAVEGAME.C
Created May 8, 2020 09:37
Extract from CreateSaveGameInfo() where buffer is written to
/* Save out all the other bits and bobs that are needed per level */
WriteSG(&flip_status, sizeof(int));
/* Flipped map flags */
for (i=0; i<MAX_FLIPMAPS; i++)
{
tflag = (flipmap[i] >> 8);
WriteSG(&tflag, sizeof(char));
}
@sapper-trle
sapper-trle / zipreader.py
Last active May 18, 2019 04:32
Python zip file reader
#Python 2.7
import zipfile
import os
def read_zip_file(filepath):
zfile = zipfile.ZipFile(filepath)
for finfo in zfile.infolist():
print finfo.filename
f,ext = os.path.splitext(finfo.filename)
if ext.lower()== ".mqo":
@sapper-trle
sapper-trle / zipfile.pas
Last active May 18, 2019 04:33
Delphi TZipFile example
//Delphi 10.2
uses System.Zip;
procedure TForm1.FormCreate(Sender: TObject);
var
zipfile :TZipFile;
i : integer;
s : string;
found : Boolean;
m : TStream;
@sapper-trle
sapper-trle / Unit1.pas
Last active May 6, 2019 06:20
Moves the mouse cursor (by 0 pixels) at regular interval.
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.ComCtrls,
System.Actions, Vcl.ActnList, Vcl.StdActns;
type
@sapper-trle
sapper-trle / trw2xna2.py
Created May 21, 2018 06:11
Script to extract TRLE animation frames to XNALara poses modified by Karlito who added root bone translation
#python 2.5
# copy this python file to your XNALara pose folder and run from there
# since pose files are written to the same folder the python file runs from.
# This script copies all keyframes of a TRW file to a pose file each.
#WARNING: will overwrite files of the same name
import os, shutil
import os.path, sys
from tkFileDialog import askopenfilename as tkFileGet
@sapper-trle
sapper-trle / matrix.pas
Created May 4, 2018 02:53
Delphi System.Math.Vectors TMatrix3D example
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,math,math.vectors;
procedure writeMatrix(m:TMatrix3D);
@sapper-trle
sapper-trle / quaternion.pas
Last active May 7, 2018 01:53
Shows how to use Delphi System.Math.Vectors TQuaternion3D in skeletal animation
procedure export_mesh(var slv:TStringList;vc:integer;var slf:TStringList; var m:tmesh_list; nmesh:integer; x,y,z:glfloat;quat:TQuaternion3D;var usedmats:array of integer;scale:glfloat=1);
var
k,mat:integer;
x1,y1,z1 :glfloat;
texture:word;
mx1,my1,mx2,my2,mx3,my3,mx4,my4:single;
p1,p2,p3,p4 : integer;
q1,q2,q:TQuaternion3D;
pp:Tpoint3d;
fs:TFormatSettings;
@sapper-trle
sapper-trle / snip.py
Created June 22, 2017 08:14
Debugging a Python GIMP plug-in
import sys
sys.stderr = open(“F:/python-fu-output.txt”, “a”)
sys.stdout=sys.stderr
@sapper-trle
sapper-trle / plugin.py
Created June 22, 2017 08:11
A typical Python GIMP plug-in
from gimpfu import *
def plugin_func(image, drawable, args):
# do what plugins do best
register(
"procedure_name", # procedure name for PDB
"blurb",
"help message",
"author",
@sapper-trle
sapper-trle / minimal.fbx
Created April 19, 2017 06:34
Minimal FBX ASCII 7300 (2013) file format
; FBX 7.3.0 project file ; Required for Metasequoia
; Created by StrPix 3.9.5 Rev18
; Based on ASCII FBX201300 generated by Metasequoia 4.5.8
; May not fully comply with FBX specification
FBXHeaderExtension: {
FBXHeaderVersion: 1003
FBXVersion: 7300
Creator: "FBX SDK" ; Required for Autodesk's FBX 2013.3 Viewer
}