summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/quake/modelgen.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2018-02-11 15:34:30 -0500
committerFranklin Wei <git@fwei.tk>2019-07-19 22:37:40 -0400
commit5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4 (patch)
tree84406e21639529a185556a33e5de7f43cffc277b /apps/plugins/sdl/progs/quake/modelgen.h
parentb70fecf21ddc21877ec1ae7888d9c18a979e37ad (diff)
downloadrockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.tar.gz
rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.zip
Quake!
This ports id Software's Quake to run on the SDL plugin runtime. The source code originated from id under the GPLv2 license. I used https://github.com/ahefner/sdlquake as the base of my port. Performance is, unsurprisingly, not on par with what you're probably used to on PC. I average about 10FPS on ipod6g, but it's still playable. Sound works well enough, but in-game music is not supported. I've written ARM assembly routines for the inner sound loop. Make sure you turn the "brightness" all the way down, or colors will look funky. To run, extract Quake's data files to /.rockbox/quake. Have fun! Change-Id: I4285036e967d7f0722802d43cf2096c808ca5799
Diffstat (limited to 'apps/plugins/sdl/progs/quake/modelgen.h')
-rw-r--r--apps/plugins/sdl/progs/quake/modelgen.h137
1 files changed, 137 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/quake/modelgen.h b/apps/plugins/sdl/progs/quake/modelgen.h
new file mode 100644
index 0000000000..631232f76e
--- /dev/null
+++ b/apps/plugins/sdl/progs/quake/modelgen.h
@@ -0,0 +1,137 @@
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20//
21// modelgen.h: header file for model generation program
22//
23
24// *********************************************************
25// * This file must be identical in the modelgen directory *
26// * and in the Quake directory, because it's used to *
27// * pass data from one to the other via model files. *
28// *********************************************************
29
30#ifdef INCLUDELIBS
31
32#include <stdlib.h>
33#include <stdio.h>
34#include <math.h>
35#include <string.h>
36
37#include "cmdlib.h"
38#include "scriplib.h"
39#include "trilib.h"
40#include "lbmlib.h"
41#include "mathlib.h"
42
43#endif
44
45#define ALIAS_VERSION 6
46
47#define ALIAS_ONSEAM 0x0020
48
49// must match definition in spritegn.h
50#ifndef SYNCTYPE_T
51#define SYNCTYPE_T
52typedef int synctype_t;
53enum {ST_SYNC=0, ST_RAND };
54#endif
55
56typedef int aliasframetype_t;
57enum { ALIAS_SINGLE=0, ALIAS_GROUP };
58
59typedef int aliasskintype_t;
60enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP };
61
62typedef struct {
63 int ident;
64 int version;
65 vec3_t scale;
66 vec3_t scale_origin;
67 float boundingradius;
68 vec3_t eyeposition;
69 int numskins;
70 int skinwidth;
71 int skinheight;
72 int numverts;
73 int numtris;
74 int numframes;
75 synctype_t synctype;
76 int flags;
77 float size;
78} mdl_t;
79
80// TODO: could be shorts
81
82typedef struct {
83 int onseam;
84 int s;
85 int t;
86} stvert_t;
87
88typedef struct dtriangle_s {
89 int facesfront;
90 int vertindex[3];
91} dtriangle_t;
92
93#define DT_FACES_FRONT 0x0010
94
95// This mirrors trivert_t in trilib.h, is present so Quake knows how to
96// load this data
97
98typedef struct {
99 byte v[3];
100 byte lightnormalindex;
101} trivertx_t;
102
103typedef struct {
104 trivertx_t bboxmin; // lightnormal isn't used
105 trivertx_t bboxmax; // lightnormal isn't used
106 char name[16]; // frame name from grabbing
107} daliasframe_t;
108
109typedef struct {
110 int numframes;
111 trivertx_t bboxmin; // lightnormal isn't used
112 trivertx_t bboxmax; // lightnormal isn't used
113} daliasgroup_t;
114
115typedef struct {
116 int numskins;
117} daliasskingroup_t;
118
119typedef struct {
120 float interval;
121} daliasinterval_t;
122
123typedef struct {
124 float interval;
125} daliasskininterval_t;
126
127typedef struct {
128 aliasframetype_t type;
129} daliasframetype_t;
130
131typedef struct {
132 aliasskintype_t type;
133} daliasskintype_t;
134
135#define IDPOLYHEADER (('O'<<24)+('P'<<16)+('D'<<8)+'I')
136 // little-endian "IDPO"
137