This commit is contained in:
Miloslav Číž 2020-11-10 16:43:27 +01:00
commit 5aeebc8caf
14 changed files with 147 additions and 722 deletions

View File

@ -7,6 +7,7 @@ These are some ideas about what you can do with this game:
- Hack it, break it. - Hack it, break it.
- Package it, reupload it, share it. - Package it, reupload it, share it.
- Port it to your favorite platform. - Port it to your favorite platform.
- Localize it to another language.
- Port to VR :) - Port to VR :)
- Port to GBA. - Port to GBA.
- Add OpenGL (or other accelerated) rendering, with true 3D, true color, - Add OpenGL (or other accelerated) rendering, with true 3D, true color,

View File

@ -170,17 +170,9 @@ Because this "modern" technology is an extremely bad choice for building long-la
This game is suppost to be accessible, i.e. require only as many resources as necessarily needed, in order to run and compile even on "weak" and minimal computers, and to run long in the future, which is ensured by dropping dependencies and only relying on a C compiler, which will probably always be the highest priority piece of SW. After the technological collapse a C compiler will be the first SW we'll have to write, and with it this game will basically immediately be compilable. This game is suppost to be accessible, i.e. require only as many resources as necessarily needed, in order to run and compile even on "weak" and minimal computers, and to run long in the future, which is ensured by dropping dependencies and only relying on a C compiler, which will probably always be the highest priority piece of SW. After the technological collapse a C compiler will be the first SW we'll have to write, and with it this game will basically immediately be compilable.
### How long did this take you to make?
Depends from where you count. From my [first experiments with raycasting on Pokitto](https://talk.pokitto.com/t/pokitto-is-on-the-way-what-games-should-i-make/1266/64?u=drummyfish) it's some two years of relaxed evening programming, with taking quite long breaks.
### I can make this in "Unity" in a week.
Firstly that's not a question and secondly you misunderstand the essence of this project. Your game will merely *look* the same, it will be an insult to good programming, efficient technology, users' freedom, it won't offer the same independence, portability, performance, beauty, it will probably die along with your "Unity", it will be encoumbered by licenses of your asset store, it won't carry the important messages.
### But you're using python scripts, Javascript for the web port, the PC port depends on SDL etc. Don't you contradict yourself? ### But you're using python scripts, Javascript for the web port, the PC port depends on SDL etc. Don't you contradict yourself?
No, all these are optional. The core doesn't have any dependencies other than a C99 compiler. Frontends do depend on external libraries, but I've designed the frontend interface so that it's extremely easy to write one, so if let's say SDL dies, it's no problem to write a new frontend using another library. No, all of these are optional. The core doesn't have any dependencies other than a C99 compiler. Frontends do depend on external libraries, but I've designed the frontend interface so that it's extremely easy to write one, so if let's say SDL dies, it's no problem to write a new frontend using another library.
Python scripts are only simple helpers for converting resources, which aren't required during compilation or code modification. In case python ceases to exist, the scripts can easily be rewritten to another languages, they're fairly simple. Python scripts are only simple helpers for converting resources, which aren't required during compilation or code modification. In case python ceases to exist, the scripts can easily be rewritten to another languages, they're fairly simple.
@ -188,6 +180,18 @@ Python scripts are only simple helpers for converting resources, which aren't re
Because assembly isn't portable and even a "portable assembly" (bytecode) would make it too difficult to write a game of this complexity, and still probably wouldn't be as portable as C. C is about the minimum required abstraction. Because assembly isn't portable and even a "portable assembly" (bytecode) would make it too difficult to write a game of this complexity, and still probably wouldn't be as portable as C. C is about the minimum required abstraction.
### I can make this in "Unity" in a week.
Firstly that's not a question and secondly you misunderstand the essence of this project. Your game will merely *look* the same, it will be an insult to good programming, efficient technology, users' freedom, it won't offer the same independence, portability, performance, beauty, it will probably die along with your "Unity", it will be encoumbered by licenses of your asset store, it won't carry the important messages.
### How long did this take you to make?
Depends from where you count. From my [first experiments with raycasting on Pokitto](https://talk.pokitto.com/t/pokitto-is-on-the-way-what-games-should-i-make/1266/64?u=drummyfish) it's some two years of relaxed evening programming, with taking quite long breaks.
### What tools did you use to make this game?
Only free software, preferably suckless tools: Vim text editor on Devuan GNU/Linux, mostly on a librebooted Lenovo X200 laptop. GIMP was used to make images and maps, python for small scripts and data conversions. Audacity and Blender and other programs were also used for making the trailer etc.
### So I can do anything with this for free? Even like sell it and stuff? ### So I can do anything with this for free? Even like sell it and stuff?
Basically yes, since I have given up all my IP rights, legally you can do anything with this **which is not otherwise illegal** (see the next paragraph), without needing any permission from me, which means you can play this, modify this, sell this, or do anything else without even crediting me. That is all legal, however that doesn't mean it's automatically moral or that I endorse anything you do. As an anarchist I don't want laws preventing your freedom to do anything with a copy of information. It is your responsibility to decide what is moral behavior. Basically yes, since I have given up all my IP rights, legally you can do anything with this **which is not otherwise illegal** (see the next paragraph), without needing any permission from me, which means you can play this, modify this, sell this, or do anything else without even crediting me. That is all legal, however that doesn't mean it's automatically moral or that I endorse anything you do. As an anarchist I don't want laws preventing your freedom to do anything with a copy of information. It is your responsibility to decide what is moral behavior.

View File

@ -8,7 +8,7 @@
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */
@ -208,7 +208,7 @@
*/ */
#define SFG_BASE_SPRITE_SIZE RCL_UNITS_PER_SQUARE #define SFG_BASE_SPRITE_SIZE RCL_UNITS_PER_SQUARE
// ---------------------------- // -----------------------------------------------------------------------------
// derived constants // derived constants
#define SFG_GAME_RESOLUTION_X \ #define SFG_GAME_RESOLUTION_X \
@ -414,7 +414,7 @@
#define SFG_HUD_BAR_HEIGHT \ #define SFG_HUD_BAR_HEIGHT \
(SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1) (SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1)
// ---------------------------- // -----------------------------------------------------------------------------
// monsters // monsters
#define SFG_MONSTER_ATTACK_MELEE 0 #define SFG_MONSTER_ATTACK_MELEE 0
@ -465,7 +465,7 @@ uint16_t SFG_monsterAttributeTable[SFG_MONSTERS_TOTAL] =
/* explod. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_EXPLODE,255,36,1) /* explod. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_EXPLODE,255,36,1)
}; };
// ---------------------------- // -----------------------------------------------------------------------------
// weapons and projectiles // weapons and projectiles
#define SFG_WEAPON_KNIFE 0 #define SFG_WEAPON_KNIFE 0

587
demo.h
View File

@ -1,587 +0,0 @@
/**
@file demo.h
Simple demo support for Anarch, intended just for testing. This file is not
needed for the game, it's just an extra helper.
by drummyfish, released under CC0 1.0 (public domain)
*/
#ifndef _DEMO_H
#define _DEMO_H
#include <stdio.h>
#define UINT32_MAX_VALUE 0xffffffff
typedef struct
{
uint32_t frame; // UINT32_MAX_VALUE is the terminating record
uint16_t keyStates;
int16_t mouseOffset[2];
} DemoRecord;
#define DEMO_MAX_RECORDS 1000000
DemoRecord demoRec[DEMO_MAX_RECORDS];
uint32_t demoRecLength = 0;
// --------- RECORDING ----------
void demoRecordStep()
{
DemoRecord record;
record.keyStates = 0;
uint32_t mask = 1;
for (int i = 0; i < SFG_KEY_COUNT; ++i)
{
record.keyStates |= SFG_keyPressed(i) ? mask : 0;
mask <<= 1;
}
record.mouseOffset[0] = 0;
record.mouseOffset[1] = 0;
record.frame = SFG_game.frame;
record.mouseOffset[0] = SFG_game.mouseOffset[0];
record.mouseOffset[1] = SFG_game.mouseOffset[1];
if (demoRecLength < DEMO_MAX_RECORDS)
{
if (
(demoRecLength == 0) ||
(
(record.keyStates != demoRec[demoRecLength - 1].keyStates) ||
(record.mouseOffset[0] != demoRec[demoRecLength - 1].mouseOffset[0]) ||
(record.mouseOffset[1] != demoRec[demoRecLength - 1].mouseOffset[1])
))
{
demoRec[demoRecLength] = record;
demoRecLength++;
}
}
else
printf("max demo records reached!\n");
}
// ---------- PLAYING -----------
static const DemoRecord demoPlay[] =
{
{0,0,{0,0}},{63,16,{0,0}},{67,0,{0,0}},{78,16,{0,0}},
{83,0,{0,0}},{147,4,{0,0}},{153,516,{0,0}},{174,516,{10,-2}},
{175,516,{5,-2}},{176,516,{3,-1}},{177,516,{3,0}},{178,516,{20,-2}},
{179,516,{21,0}},{180,516,{42,1}},{181,516,{19,1}},{182,516,{26,3}},
{182,512,{26,3}},{183,512,{46,5}},{184,512,{21,3}},{185,512,{20,1}},
{186,512,{34,6}},{187,512,{54,7}},{188,512,{18,3}},{189,512,{20,1}},
{190,512,{0,0}},{192,512,{0,-1}},{193,513,{0,0}},{195,513,{-2,-7}},
{196,513,{-4,-8}},{197,513,{-4,-6}},{198,513,{-14,-19}},{199,513,{-10,-14}},
{200,513,{-19,-22}},{201,513,{-17,-15}},{202,1,{-21,-17}},{203,1,{-20,-17}},
{204,1,{-25,-16}},{205,1,{-22,-15}},{206,1,{-33,-19}},{207,1,{-81,-49}},
{208,1,{-50,-28}},{209,1,{-56,-30}},{210,1,{-123,-59}},{211,1,{-62,-31}},
{212,257,{-104,-56}},{213,257,{-61,-31}},{215,257,{-125,-62}},{216,257,{-59,-28}},
{217,257,{-58,-28}},{218,257,{-109,-58}},{219,257,{-34,-22}},{220,257,{-16,-11}},
{220,289,{-16,-11}},{221,289,{-45,-31}},{222,289,{-33,-19}},{223,289,{-7,-7}},
{225,289,{-1,-1}},{227,289,{0,0}},{228,417,{0,0}},{230,417,{-1,0}},
{230,161,{-1,0}},{231,161,{1,-1}},{232,161,{0,-1}},{233,385,{0,-1}},
{234,385,{0,-4}},{236,385,{-5,-12}},{236,257,{-5,-12}},{237,257,{-1,-3}},
{238,257,{0,-1}},{239,257,{0,0}},{240,257,{0,-3}},{241,257,{1,-3}},
{242,257,{0,0}},{243,1,{7,-4}},{243,33,{7,-4}},{244,33,{23,-5}},
{245,33,{19,-2}},{246,33,{27,0}},{247,33,{11,0}},{248,33,{3,0}},
{249,33,{12,0}},{250,33,{7,0}},{251,33,{45,1}},{252,33,{36,2}},
{253,33,{40,2}},{254,33,{48,3}},{255,33,{28,0}},{256,32,{21,1}},
{257,32,{54,0}},{258,32,{28,0}},{259,32,{71,-5}},{260,32,{32,-3}},
{261,32,{34,0}},{262,32,{55,-3}},{263,32,{23,0}},{264,32,{16,0}},
{265,0,{25,0}},{266,0,{16,-2}},{267,0,{13,-2}},{268,0,{42,-2}},
{269,0,{21,-2}},{270,0,{42,-2}},{271,0,{7,-2}},{272,0,{18,-2}},
{273,0,{37,-2}},{274,0,{21,-4}},{275,0,{9,-3}},{276,0,{3,-1}},
{277,0,{0,0}},{278,0,{0,-1}},{279,0,{0,0}},{280,0,{-3,1}},
{281,0,{0,-1}},{282,0,{0,-2}},{282,1,{0,-2}},{283,1,{0,-1}},
{285,1,{-1,-1}},{286,1,{-1,-2}},{287,1,{-1,-1}},{288,1,{0,-1}},
{289,1,{-1,0}},{290,1,{0,0}},{291,1,{2,-2}},{292,1,{16,-4}},
{293,1,{22,0}},{294,1,{73,6}},{295,1,{47,2}},{296,257,{36,2}},
{297,257,{91,8}},{298,257,{53,4}},{299,257,{56,4}},{299,385,{56,4}},
{300,385,{58,2}},{301,385,{64,2}},{302,385,{61,0}},{302,384,{61,0}},
{303,384,{111,2}},{304,384,{60,0}},{305,384,{59,0}},{306,385,{102,4}},
{307,385,{67,0}},{308,385,{71,4}},{309,385,{146,4}},{310,385,{74,4}},
{311,385,{76,2}},{312,385,{151,4}},{313,385,{77,2}},{314,385,{75,2}},
{314,384,{75,2}},{315,384,{162,4}},{316,384,{0,0}},{317,384,{62,3}},
{318,384,{82,2}},{319,384,{83,4}},{320,384,{80,2}},{321,384,{118,2}},
{322,384,{72,2}},{323,384,{76,4}},{324,384,{178,12}},{325,384,{93,7}},
{326,384,{91,7}},{327,384,{157,14}},{328,128,{80,7}},{329,128,{84,7}},
{330,128,{170,14}},{330,0,{170,14}},{331,0,{85,7}},{332,0,{84,9}},
{333,0,{85,9}},{333,512,{85,9}},{334,512,{61,6}},{335,512,{77,9}},
{336,512,{59,6}},{337,512,{65,6}},{338,0,{157,16}},{339,0,{84,12}},
{340,0,{79,12}},{341,0,{140,21}},{342,0,{72,9}},{343,0,{45,8}},
{344,0,{130,16}},{345,0,{40,6}},{346,0,{24,2}},{347,0,{0,0}},
{348,0,{2,0}},{349,0,{-6,1}},{350,0,{0,0}},{352,0,{1,-5}},
{353,0,{0,0}},{354,0,{-9,-10}},{355,0,{-13,-10}},{356,0,{-13,-12}},
{357,0,{-38,-22}},{358,0,{-18,-9}},{359,0,{-46,-27}},{359,256,{-46,-27}},
{360,256,{-31,-15}},{361,256,{-30,-14}},{362,256,{-60,-26}},{363,256,{-33,-15}},
{364,256,{-28,-12}},{365,256,{-61,-27}},{366,256,{-36,-17}},{368,257,{-36,-17}},
{369,257,{-27,-14}},{370,257,{-30,-21}},{371,257,{0,0}},{372,257,{-3,-3}},
{373,257,{0,0}},{374,129,{-1,-1}},{374,161,{-1,-1}},{375,161,{0,-1}},
{376,161,{21,-12}},{377,161,{26,-4}},{378,161,{26,0}},{379,161,{44,3}},
{380,161,{13,1}},{381,161,{5,1}},{382,33,{22,1}},{383,33,{8,1}},
{384,33,{13,0}},{385,33,{66,4}},{386,1,{36,6}},{387,1,{29,5}},
{388,0,{46,5}},{389,0,{0,0}},{391,0,{-13,1}},{392,0,{0,0}},
{393,0,{0,-1}},{394,0,{3,0}},{395,0,{11,1}},{396,0,{26,9}},
{397,0,{14,8}},{398,0,{19,10}},{399,4,{16,9}},{400,4,{1,2}},
{401,4,{4,4}},{402,4,{17,15}},{403,4,{13,13}},{404,4,{15,13}},
{405,4,{58,42}},{406,4,{43,24}},{407,4,{52,25}},{407,260,{52,25}},
{408,260,{62,23}},{409,260,{64,23}},{409,256,{64,23}},{410,256,{141,50}},
{411,256,{78,26}},{412,256,{68,21}},{413,256,{139,45}},{414,256,{76,21}},
{415,256,{83,19}},{416,256,{153,38}},{417,256,{69,14}},{418,256,{155,36}},
{419,256,{76,19}},{420,256,{80,19}},{421,256,{88,22}},{422,256,{177,41}},
{423,384,{88,22}},{424,384,{178,44}},{425,384,{86,19}},{426,384,{76,21}},
{427,384,{66,17}},{427,388,{66,17}},{428,388,{86,22}},{429,388,{85,22}},
{430,388,{82,19}},{431,388,{174,44}},{432,388,{80,24}},{433,132,{154,43}},
{434,132,{83,24}},{435,132,{80,21}},{436,132,{172,46}},{437,132,{86,24}},
{437,644,{86,24}},{438,644,{167,46}},{439,644,{78,23}},{440,644,{86,22}},
{441,644,{81,23}},{442,644,{146,43}},{443,644,{78,22}},{444,644,{137,37}},
{445,644,{71,16}},{446,644,{73,19}},{447,640,{144,35}},{448,640,{73,18}},
{449,640,{74,21}},{450,640,{69,18}},{451,640,{100,31}},{452,640,{30,12}},
{453,640,{2,1}},{454,640,{-4,-1}},{455,640,{-24,1}},{456,640,{0,0}},
{456,129,{0,0}},{457,129,{-1,-3}},{458,129,{-3,-5}},{459,385,{-22,-17}},
{460,385,{-18,-13}},{461,385,{-22,-13}},{462,385,{-52,-36}},{463,385,{-32,-22}},
{464,385,{0,0}},{465,385,{-33,-20}},{466,385,{-100,-50}},{467,385,{-53,-26}},
{468,385,{-103,-46}},{469,385,{-49,-21}},{470,385,{-55,-26}},{471,385,{-58,-23}},
{472,385,{-64,-26}},{473,385,{-133,-55}},{474,385,{-79,-30}},{475,385,{-82,-32}},
{476,385,{-84,-35}},{477,385,{-173,-72}},{478,385,{-90,-38}},{479,385,{-89,-38}},
{480,385,{-179,-73}},{481,385,{-85,-35}},{482,385,{-89,-40}},{483,385,{-193,-86}},
{483,129,{-193,-86}},{484,129,{-98,-48}},{485,129,{-209,-95}},{486,129,{-107,-48}},
{487,129,{-102,-46}},{488,129,{-176,-86}},{489,129,{-93,-43}},{490,129,{-85,-45}},
{491,641,{-172,-90}},{492,641,{-81,-44}},{493,641,{-77,-42}},{494,641,{-166,-87}},
{495,640,{-83,-43}},{496,640,{-81,-42}},{497,640,{-85,-43}},{498,640,{-86,-46}},
{499,640,{-155,-79}},{500,640,{-62,-34}},{501,640,{-64,-36}},{502,640,{0,0}},
{503,640,{-70,-37}},{504,640,{-67,-34}},{505,640,{-138,-62}},{506,640,{-70,-27}},
{507,896,{-53,-21}},{508,384,{-122,-40}},{509,384,{-66,-22}},{510,384,{-72,-20}},
{511,384,{-77,-22}},{512,384,{-74,-22}},{513,384,{-66,-19}},{514,384,{-61,-19}},
{514,388,{-61,-19}},{515,388,{-72,-22}},{516,388,{-156,-42}},{517,388,{-87,-23}},
{518,388,{-87,-25}},{519,388,{-154,-49}},{520,388,{-77,-25}},{521,388,{-72,-27}},
{522,388,{-144,-53}},{523,388,{-50,-28}},{524,388,{-29,-23}},{525,384,{-8,-8}},
{526,384,{-4,-5}},{527,384,{0,-2}},{528,384,{20,-31}},{529,384,{18,-19}},
{530,128,{41,-29}},{530,640,{41,-29}},{531,640,{117,-54}},{532,640,{71,-24}},
{533,640,{83,-23}},{533,641,{83,-23}},{534,641,{166,-37}},{535,641,{91,-13}},
{536,641,{199,-13}},{537,641,{106,-3}},{538,641,{102,-3}},{539,641,{108,0}},
{540,641,{95,2}},{541,641,{97,0}},{542,641,{96,2}},{543,129,{216,7}},
{544,129,{121,5}},{544,385,{121,5}},{545,385,{117,5}},{546,385,{208,10}},
{547,385,{91,4}},{548,385,{108,5}},{549,385,{195,9}},{550,385,{104,4}},
{551,385,{108,5}},{552,385,{205,10}},{553,385,{109,5}},{554,385,{221,12}},
{555,385,{111,7}},{556,385,{108,7}},{557,385,{192,12}},{558,385,{105,5}},
{558,384,{105,5}},{559,384,{119,7}},{560,384,{258,12}},{561,384,{125,5}},
{562,384,{103,7}},{563,384,{207,17}},{564,384,{93,7}},{565,384,{90,7}},
{566,384,{219,17}},{567,384,{118,10}},{568,384,{119,12}},{569,384,{209,27}},
{570,896,{100,12}},{571,896,{204,24}},{572,640,{105,12}},{573,640,{107,12}},
{574,640,{108,15}},{575,640,{199,32}},{576,640,{102,14}},{577,640,{88,14}},
{578,640,{0,0}},{579,640,{102,14}},{580,640,{99,14}},{581,640,{98,14}},
{582,640,{120,22}},{582,641,{120,22}},{583,641,{16,4}},{584,641,{0,0}},
{585,385,{-29,0}},{586,385,{-11,2}},{587,385,{-5,4}},{588,384,{-1,-1}},
{589,384,{-17,-7}},{590,384,{-56,-22}},{591,384,{-41,-15}},{592,384,{-47,-18}},
{593,384,{-53,-21}},{594,384,{-132,-52}},{595,384,{-76,-32}},{596,384,{-72,-27}},
{597,384,{-153,-54}},{598,384,{-67,-22}},{599,384,{-69,-24}},{600,384,{-129,-47}},
{601,384,{-77,-27}},{602,384,{-80,-27}},{603,384,{-172,-54}},{604,384,{-76,-24}},
{605,384,{-136,-50}},{606,384,{-67,-24}},{607,384,{-76,-27}},{608,384,{-142,-48}},
{609,384,{-77,-22}},{610,384,{-75,-22}},{610,385,{-75,-22}},{611,385,{-135,-43}},
{612,385,{-62,-24}},{613,385,{-42,-20}},{614,385,{-26,-22}},{615,385,{0,0}},
{616,385,{18,17}},{617,385,{-4,-4}},{618,385,{0,0}},{619,129,{0,0}},
{620,129,{-1,-1}},{621,129,{0,0}},{622,129,{0,-2}},{623,129,{2,-3}},
{624,129,{8,-9}},{625,129,{0,0}},{626,129,{1,-2}},{627,129,{0,-1}},
{628,129,{4,-4}},{629,129,{14,-9}},{630,129,{47,-10}},{631,129,{31,-4}},
{632,129,{16,-2}},{633,129,{52,-2}},{634,129,{45,4}},{635,129,{56,4}},
{636,129,{142,16}},{637,641,{80,9}},{638,641,{169,24}},{639,641,{90,14}},
{640,641,{100,20}},{641,641,{111,22}},{642,641,{250,56}},{643,641,{120,25}},
{644,641,{106,35}},{645,641,{14,6}},{646,129,{2,1}},{647,129,{-43,-9}},
{648,129,{-17,1}},{648,385,{-17,1}},{649,385,{-1,3}},{650,385,{-36,-29}},
{651,385,{-47,-25}},{652,385,{0,0}},{653,385,{-165,-92}},{654,385,{-90,-48}},
{655,385,{-88,-48}},{656,385,{-190,-92}},{657,385,{-96,-43}},{658,385,{-93,-40}},
{658,384,{-93,-40}},{659,384,{-185,-78}},{660,384,{-93,-40}},{661,384,{-98,-46}},
{662,384,{-193,-83}},{663,384,{-99,-41}},{664,384,{-96,-36}},{665,384,{-170,-67}},
{666,384,{-91,-33}},{667,384,{-65,-31}},{668,384,{-136,-65}},{669,385,{-75,-34}},
{670,385,{-63,-31}},{671,385,{-95,-56}},{672,385,{-26,-20}},{673,385,{-5,-5}},
{674,385,{34,33}},{675,385,{0,7}},{676,129,{3,-6}},{677,129,{56,-21}},
{678,641,{37,-5}},{679,641,{53,2}},{680,641,{67,11}},{681,641,{68,14}},
{682,641,{163,29}},{683,641,{89,14}},{684,641,{91,17}},{685,641,{184,32}},
{686,641,{90,17}},{687,641,{93,19}},{688,641,{178,39}},{689,641,{91,19}},
{690,641,{0,0}},{691,641,{85,16}},{692,641,{205,45}},{693,641,{77,21}},
{694,641,{143,33}},{695,641,{46,13}},{696,641,{53,11}},{697,641,{130,23}},
{698,129,{62,9}},{699,129,{68,9}},{700,129,{24,3}},{701,129,{0,0}},
{702,129,{6,-1}},{703,129,{-6,6}},{704,129,{6,-15}},{705,129,{2,-13}},
{706,129,{-5,-14}},{706,385,{-5,-14}},{707,385,{-9,-22}},{708,385,{-44,-50}},
{709,385,{-41,-36}},{710,385,{-44,-35}},{711,385,{-120,-86}},{712,385,{-71,-44}},
{713,385,{-76,-39}},{714,385,{-166,-82}},{715,385,{-84,-40}},{716,385,{-80,-39}},
{717,385,{-160,-74}},{718,384,{-79,-37}},{719,384,{-170,-70}},{720,384,{-84,-35}},
{721,384,{-156,-66}},{722,384,{-64,-29}},{723,384,{-69,-31}},{724,384,{-109,-60}},
{725,384,{-52,-30}},{725,385,{-52,-30}},{726,385,{-40,-27}},{727,385,{-34,-26}},
{728,385,{16,16}},{729,385,{0,0}},{730,385,{-12,-15}},{731,385,{-5,-5}},
{732,385,{0,-1}},{733,129,{0,0}},{734,129,{0,-1}},{735,129,{33,-16}},
{736,129,{44,-9}},{737,129,{107,-12}},{738,129,{36,0}},{739,641,{56,4}},
{740,641,{134,14}},{741,641,{85,14}},{742,641,{92,19}},{743,641,{185,37}},
{744,641,{87,17}},{745,641,{76,16}},{746,641,{146,31}},{747,641,{70,14}},
{747,129,{70,14}},{748,129,{57,13}},{749,129,{62,11}},{750,129,{0,0}},
{751,129,{1,-1}},{752,129,{-15,10}},{753,129,{4,-10}},{754,129,{0,-21}},
{755,385,{-22,-64}},{756,385,{-19,-38}},{757,385,{-29,-37}},{758,385,{-78,-85}},
{759,385,{-56,-46}},{760,385,{-119,-84}},{761,385,{-65,-41}},{762,385,{-71,-44}},
{763,385,{-146,-90}},{764,385,{-79,-47}},{765,385,{0,0}},{766,385,{-72,-39}},
{766,129,{-72,-39}},{767,129,{-142,-82}},{768,129,{-43,-34}},{768,641,{-43,-34}},
{769,641,{-17,-19}},{770,641,{-6,-5}},{771,641,{0,-1}},{772,641,{3,12}},
{773,641,{4,-9}},{774,641,{21,-22}},{775,641,{38,-26}},{776,641,{111,-32}},
{777,641,{74,-5}},{778,641,{159,4}},{779,641,{89,4}},{780,641,{85,7}},
{781,641,{124,13}},{782,129,{33,1}},{783,129,{6,1}},{784,129,{0,0}},
{785,129,{-10,1}},{786,385,{-16,10}},{787,385,{-2,-3}},{788,385,{-3,-3}},
{789,385,{-41,-20}},{790,385,{-74,-30}},{791,385,{-45,-20}},{792,385,{-56,-24}},
{793,385,{-68,-27}},{794,385,{-159,-64}},{795,385,{-93,-38}},{796,385,{-92,-35}},
{797,385,{-179,-67}},{798,385,{-85,-33}},{799,385,{-169,-62}},{800,385,{-87,-30}},
{801,385,{-87,-35}},{802,385,{0,0}},{803,385,{-185,-74}},{804,385,{-96,-38}},
{805,385,{-84,-35}},{806,385,{-173,-67}},{807,385,{-76,-32}},{808,385,{-128,-60}},
{809,385,{-73,-29}},{810,385,{-145,-56}},{811,897,{-67,-27}},{812,897,{-69,-26}},
{813,641,{-73,-25}},{814,641,{-152,-56}},{815,641,{-75,-30}},{816,641,{-153,-51}},
{817,641,{-75,-27}},{817,640,{-75,-27}},{818,640,{-75,-24}},{819,640,{-77,-27}},
{820,640,{-77,-22}},{822,640,{-78,-22}},{823,640,{-145,-41}},{824,640,{-74,-22}},
{825,640,{-75,-20}},{826,640,{-156,-39}},{827,640,{-141,-34}},{828,640,{-75,-17}},
{828,644,{-75,-17}},{829,644,{-60,-14}},{830,644,{-71,-10}},{831,644,{-140,-22}},
{832,644,{-77,-10}},{832,132,{-77,-10}},{833,132,{-81,-13}},{834,388,{-138,-24}},
{835,388,{-74,-15}},{836,388,{-146,-27}},{837,388,{-71,-12}},{837,384,{-71,-12}},
{838,384,{-71,-10}},{839,384,{-71,-12}},{840,384,{-53,-11}},{841,384,{-68,-15}},
{842,384,{-55,-12}},{843,384,{-110,-28}},{844,384,{-57,-16}},{845,384,{-73,-26}},
{846,384,{-18,-9}},{847,384,{0,0}},{848,385,{-6,-6}},{849,385,{4,3}},
{850,385,{0,0}},{851,129,{-1,-1}},{852,129,{6,-11}},{853,129,{15,-11}},
{854,129,{52,-24}},{855,129,{34,-9}},{856,129,{34,-5}},{857,129,{96,-5}},
{858,129,{45,-3}},{859,129,{58,-3}},{860,129,{129,-3}},{861,129,{73,0}},
{862,129,{67,0}},{863,129,{124,0}},{864,129,{43,2}},{865,129,{62,2}},
{866,129,{133,9}},{866,641,{133,9}},{867,641,{64,4}},{868,641,{65,4}},
{869,641,{129,13}},{870,641,{65,4}},{871,641,{59,6}},{871,129,{59,6}},
{872,129,{111,6}},{873,129,{29,1}},{874,129,{26,1}},{875,129,{71,-2}},
{876,129,{53,0}},{877,129,{56,0}},{878,129,{59,1}},{879,129,{68,4}},
{880,129,{50,2}},{881,129,{47,0}},{882,129,{39,0}},{883,129,{23,1}},
{884,129,{1,0}},{885,129,{-3,0}},{886,129,{-8,1}},{887,129,{-2,1}},
{888,129,{-3,-1}},{888,385,{-3,-1}},{889,385,{-10,-2}},{890,385,{-42,-6}},
{891,385,{-39,-9}},{891,384,{-39,-9}},{892,384,{-52,-12}},{893,384,{-125,-26}},
{894,384,{-63,-14}},{895,384,{-64,-12}},{896,384,{-61,-15}},{897,384,{-73,-13}},
{898,384,{-71,-10}},{899,384,{-151,-24}},{900,384,{-74,-12}},{901,384,{-68,-12}},
{902,384,{-131,-21}},{903,384,{-67,-12}},{904,384,{-110,-21}},{905,384,{-60,-12}},
{906,384,{-52,-12}},{907,384,{-103,-23}},{908,384,{-58,-16}},{909,384,{-46,-14}},
{910,384,{-103,-27}},{911,384,{-56,-19}},{912,384,{-60,-24}},{913,384,{-11,-8}},
{913,385,{-11,-8}},{914,385,{0,0}},{915,385,{3,2}},{916,385,{0,0}},
{917,129,{19,-6}},{918,129,{37,-7}},{919,129,{50,-3}},{920,129,{53,8}},
{921,129,{59,13}},{922,129,{62,16}},{923,129,{140,38}},{924,641,{69,14}},
{925,641,{58,13}},{926,641,{13,3}},{927,641,{29,3}},{928,641,{101,13}},
{929,641,{61,9}},{930,641,{64,11}},{931,641,{150,28}},{932,641,{74,14}},
{933,641,{74,12}},{934,641,{72,18}},{935,641,{24,5}},{936,641,{2,1}},
{937,641,{-33,-4}},{938,641,{-8,0}},{939,129,{-7,-7}},{940,385,{-27,-23}},
{941,385,{-43,-30}},{942,385,{-126,-76}},{943,385,{-83,-46}},{944,385,{-85,-48}},
{945,385,{-162,-84}},{946,385,{-82,-38}},{947,385,{-78,-37}},{948,385,{-124,-65}},
{949,385,{-46,-30}},{950,385,{-46,-35}},{951,385,{-32,-28}},{952,385,{-43,-37}},
{953,385,{-45,-34}},{954,129,{-31,-22}},{955,129,{-32,-25}},{956,129,{-22,-20}},
{957,129,{-2,-2}},{958,641,{0,0}},{959,641,{0,-2}},{960,641,{0,0}},
{961,641,{46,-33}},{962,641,{32,-15}},{963,641,{102,-18}},{964,641,{58,0}},
{965,641,{66,0}},{966,641,{67,0}},{967,641,{77,4}},{968,641,{82,4}},
{969,641,{173,12}},{970,641,{85,4}},{971,641,{63,4}},{972,641,{88,6}},
{973,641,{65,2}},{974,641,{53,2}},{975,641,{154,9}},{976,641,{81,9}},
{977,641,{84,7}},{978,641,{119,11}},{979,641,{68,4}},{980,641,{69,4}},
{981,641,{31,0}},{982,641,{37,0}},{983,641,{32,-4}},{984,641,{7,-2}},
{985,641,{1,-1}},{986,129,{-15,6}},{987,129,{-2,-7}},{988,129,{-11,-20}},
{989,129,{-18,-28}},{990,129,{-22,-26}},{991,129,{0,0}},{991,385,{0,0}},
{992,385,{-63,-53}},{993,385,{-43,-32}},{994,385,{-93,-64}},{995,385,{-51,-33}},
{996,385,{-51,-30}},{997,385,{-107,-65}},{998,385,{-59,-36}},{999,385,{-53,-35}},
{1000,129,{-93,-63}},{1001,129,{-29,-25}},{1001,641,{-29,-25}},{1002,641,{-5,-5}},
{1003,641,{-2,-2}},{1004,641,{6,8}},{1005,641,{0,0}},{1006,641,{24,-16}},
{1007,641,{32,-15}},{1008,641,{94,-16}},{1009,641,{50,-3}},{1010,641,{47,0}},
{1011,641,{56,2}},{1012,641,{112,13}},{1012,129,{112,13}},{1013,129,{30,3}},
{1014,129,{7,1}},{1015,129,{0,0}},{1016,385,{-1,0}},{1017,385,{-7,3}},
{1018,385,{0,0}},{1019,385,{-1,-2}},{1021,385,{-23,-15}},{1022,385,{-22,-11}},
{1023,385,{-33,-13}},{1024,385,{-88,-40}},{1025,385,{-55,-23}},{1026,385,{-58,-24}},
{1027,385,{-59,-26}},{1028,385,{-41,-16}},{1029,385,{-29,-17}},{1029,641,{-29,-17}},
{1030,641,{-54,-32}},{1031,641,{-18,-13}},{1032,641,{-1,0}},{1033,641,{11,11}},
{1034,641,{1,3}},{1035,641,{7,-6}},{1036,641,{78,-22}},{1037,641,{48,-9}},
{1038,641,{45,-5}},{1039,641,{99,0}},{1040,641,{56,2}},{1041,641,{67,6}},
{1042,641,{85,8}},{1043,641,{0,0}},{1044,129,{-14,4}},{1045,129,{-8,10}},
{1046,129,{-2,-6}},{1047,385,{-34,-21}},{1048,385,{-44,-20}},{1049,385,{-118,-30}},
{1050,385,{-67,-15}},{1051,385,{-63,-14}},{1052,385,{-121,-24}},{1053,385,{-46,-11}},
{1054,385,{-52,-12}},{1055,385,{-100,-27}},{1055,257,{-100,-27}},{1056,257,{-48,-13}},
{1057,257,{-59,-15}},{1058,257,{-104,-30}},{1059,257,{-42,-11}},{1060,1,{-63,-21}},
{1061,1,{-25,-10}},{1062,1,{-13,-7}},{1062,0,{-13,-7}},{1063,0,{-10,-5}},
{1064,0,{0,0}},{1065,0,{7,9}},{1066,0,{-2,-4}},{1067,0,{-1,-1}},
{1068,0,{0,0}},{1069,0,{0,-2}},{1070,0,{0,-4}},{1071,0,{3,-4}},
{1072,0,{25,-19}},{1073,0,{27,-14}},{1074,1,{36,-11}},{1075,1,{41,-11}},
{1076,1,{6,-2}},{1077,1,{5,-3}},{1078,1,{6,-3}},{1079,1,{9,-3}},
{1080,1,{14,-5}},{1081,1,{48,-12}},{1082,1,{40,-7}},{1083,1,{51,-5}},
{1084,1,{95,-9}},{1085,1,{28,-4}},{1086,1,{11,-2}},{1087,1,{42,-7}},
{1088,257,{34,-7}},{1089,257,{83,-9}},{1090,257,{45,-5}},{1091,257,{38,-5}},
{1092,257,{57,-10}},{1093,257,{21,-8}},{1094,257,{13,-5}},{1095,257,{9,-3}},
{1096,257,{26,-6}},{1097,257,{29,-4}},{1098,257,{77,-5}},{1099,257,{34,-3}},
{1100,256,{34,-3}},{1102,256,{11,0}},{1103,256,{31,-4}},{1104,256,{18,-4}},
{1105,256,{33,-5}},{1106,256,{18,-4}},{1107,256,{26,-2}},{1108,256,{33,-6}},
{1109,256,{16,-2}},{1110,256,{7,-2}},{1111,256,{2,-1}},{1112,256,{7,-2}},
{1113,260,{3,-1}},{1114,260,{5,-2}},{1115,260,{8,0}},{1116,260,{3,0}},
{1117,260,{30,-2}},{1118,260,{21,-2}},{1119,256,{47,-2}},{1120,256,{25,-2}},
{1121,256,{28,-4}},{1122,256,{61,-4}},{1123,256,{39,-3}},{1124,256,{37,0}},
{1125,256,{80,-5}},{1126,256,{21,-2}},{1127,256,{35,-4}},{1128,256,{16,-4}},
{1129,256,{5,-3}},{1130,256,{25,-6}},{1131,260,{18,-4}},{1132,260,{15,-2}},
{1133,260,{13,-1}},{1134,260,{5,-2}},{1135,260,{9,-1}},{1136,260,{0,0}},
{1139,260,{-1,0}},{1140,260,{0,0}},{1140,4,{0,0}},{1145,4,{-1,-1}},
{1146,4,{-3,-1}},{1147,516,{-3,-1}},{1148,516,{-2,-1}},{1149,516,{-1,0}},
{1150,516,{0,0}},{1152,516,{-1,-2}},{1153,516,{0,-2}},{1154,516,{-1,0}},
{1155,516,{-1,-4}},{1155,4,{-1,-4}},{1156,4,{0,0}},{1157,4,{0,-1}},
{1157,260,{0,-1}},{1158,260,{0,-2}},{1159,260,{0,-3}},{1162,260,{0,-7}},
{1163,260,{0,-3}},{1164,4,{0,-6}},{1165,4,{4,-13}},{1166,4,{2,-6}},
{1166,260,{2,-6}},{1167,260,{7,-16}},{1168,260,{3,-5}},{1169,260,{3,-6}},
{1170,260,{1,-4}},{1171,260,{5,-9}},{1172,260,{3,-5}},{1173,4,{3,-5}},
{1174,4,{0,0}},{1175,4,{10,-9}},{1176,4,{2,-3}},{1176,260,{2,-3}},
{1177,260,{3,-5}},{1178,260,{-1,-2}},{1178,256,{-1,-2}},{1179,256,{-4,-8}},
{1180,256,{-6,-8}},{1181,256,{-13,-12}},{1182,256,{-9,-9}},{1183,256,{-9,-6}},
{1184,256,{-54,-34}},{1185,256,{-45,-25}},{1186,256,{-107,-56}},{1187,384,{-47,-23}},
{1188,384,{-38,-17}},{1189,384,{-37,-22}},{1190,384,{-12,-6}},{1191,384,{-15,-9}},
{1192,384,{-7,-4}},{1193,384,{0,0}},{1195,384,{0,-1}},{1196,384,{-3,-3}},
{1197,384,{-2,-1}},{1198,384,{0,0}},{1201,384,{13,0}},{1202,384,{82,15}},
{1203,384,{54,11}},{1204,384,{78,21}},{1205,384,{38,12}},{1206,384,{40,12}},
{1207,384,{120,39}},{1208,384,{68,23}},{1209,384,{76,26}},{1210,384,{64,23}},
{1211,388,{48,19}},{1212,388,{42,16}},{1213,388,{63,23}},{1214,388,{117,45}},
{1215,388,{62,23}},{1216,388,{64,23}},{1216,644,{64,23}},{1217,644,{128,49}},
{1218,644,{71,24}},{1219,644,{119,48}},{1220,644,{63,23}},{1221,644,{59,22}},
{1222,644,{131,49}},{1223,644,{71,26}},{1224,644,{78,29}},{1225,644,{151,58}},
{1226,644,{75,26}},{1227,644,{69,26}},{1228,644,{137,54}},{1229,644,{69,25}},
{1230,644,{69,26}},{1231,644,{144,52}},{1232,644,{69,26}},{1233,644,{132,47}},
{1234,644,{63,23}},{1235,644,{71,26}},{1236,644,{143,52}},{1237,640,{70,23}},
{1238,640,{71,26}},{1239,640,{76,23}},{1240,640,{146,42}},{1241,640,{79,21}},
{1242,640,{77,21}},{1243,640,{140,38}},{1244,640,{74,21}},{1245,640,{117,39}},
{1246,640,{59,18}},{1247,640,{19,12}},{1248,897,{0,0}},{1249,897,{-9,-6}},
{1250,385,{-6,-4}},{1251,385,{-5,-5}},{1252,385,{-4,-5}},{1253,384,{-4,-1}},
{1254,384,{-13,-2}},{1255,384,{-25,-6}},{1256,384,{-67,-23}},{1257,384,{-47,-16}},
{1259,384,{-103,-27}},{1260,384,{-44,-9}},{1261,384,{-101,-21}},{1262,384,{-55,-10}},
{1263,384,{-60,-12}},{1264,384,{-127,-28}},{1265,384,{-66,-15}},{1266,384,{-67,-15}},
{1267,384,{-126,-24}},{1268,384,{-66,-12}},{1269,384,{-62,-12}},{1270,384,{-128,-21}},
{1271,384,{-64,-12}},{1272,384,{-66,-15}},{1273,384,{-131,-26}},{1274,384,{-61,-12}},
{1275,384,{-127,-29}},{1276,384,{-52,-12}},{1277,384,{-58,-14}},{1278,384,{-83,-26}},
{1279,384,{-24,-10}},{1280,384,{-22,-11}},{1280,385,{-22,-11}},{1281,385,{-21,-15}},
{1282,385,{-5,-4}},{1283,385,{5,4}},{1284,385,{0,0}},{1287,385,{37,-20}},
{1288,385,{29,-8}},{1289,128,{36,-3}},{1290,128,{99,15}},{1291,128,{56,15}},
{1292,640,{120,41}},{1293,640,{70,26}},{1294,640,{68,26}},{1295,640,{140,52}},
{1296,640,{73,26}},{1297,640,{68,26}},{1298,640,{134,49}},{1299,640,{62,23}},
{1300,640,{57,20}},{1301,640,{118,41}},{1302,640,{58,21}},{1303,640,{60,18}},
{1304,640,{133,44}},{1305,640,{65,21}},{1306,640,{73,23}},{1307,641,{150,47}},
{1308,641,{73,23}},{1309,641,{65,21}},{1310,641,{124,42}},{1311,641,{52,15}},
{1312,641,{54,18}},{1313,641,{115,36}},{1314,641,{60,18}},{1315,641,{118,34}},
{1316,641,{40,14}},{1317,641,{46,11}},{1318,129,{34,8}},{1319,129,{0,0}},
{1321,129,{-2,0}},{1322,129,{0,0}},{1322,385,{0,0}},{1323,385,{0,-1}},
{1324,385,{0,-2}},{1325,385,{-3,-12}},{1326,385,{-12,-23}},{1327,385,{-41,-57}},
{1328,385,{-28,-33}},{1329,385,{-56,-62}},{1330,385,{-30,-28}},{1331,385,{-33,-33}},
{1332,385,{-70,-63}},{1333,385,{-32,-28}},{1334,385,{-35,-29}},{1335,385,{-76,-67}},
{1336,385,{-35,-29}},{1337,385,{-69,-56}},{1338,385,{-35,-26}},{1339,385,{-43,-32}},
{1340,385,{-39,-28}},{1341,385,{-75,-49}},{1342,385,{-37,-24}},{1343,385,{-37,-26}},
{1344,385,{-74,-54}},{1345,385,{-38,-31}},{1346,385,{-70,-57}},{1347,385,{-35,-28}},
{1348,385,{-24,-22}},{1349,385,{-32,-26}},{1350,385,{-34,-26}},{1351,385,{-35,-28}},
{1352,385,{-75,-55}},{1353,385,{-35,-24}},{1354,385,{-35,-26}},{1355,385,{-74,-50}},
{1356,385,{-34,-26}},{1357,385,{-70,-49}},{1358,385,{-37,-26}},{1359,385,{-37,-24}},
{1360,385,{-34,-23}},{1361,385,{-36,-26}},{1362,385,{-19,-13}},{1363,385,{-35,-24}},
{1364,385,{-63,-42}},{1365,385,{-33,-26}},{1366,385,{-32,-24}},{1367,385,{-66,-49}},
{1368,129,{-24,-22}},{1369,129,{-18,-14}},{1370,129,{-29,-31}},{1371,129,{-13,-16}},
{1372,129,{-10,-14}},{1373,129,{-1,-1}},{1374,129,{0,0}},{1374,641,{0,0}},
{1375,641,{3,-8}},{1376,641,{19,-11}},{1377,641,{63,-14}},{1378,641,{34,0}},
{1379,641,{45,4}},{1380,641,{44,5}},{1381,641,{3,0}},{1382,129,{0,0}},
{1383,129,{-2,0}},{1383,385,{-2,0}},{1384,385,{-3,1}},{1385,385,{0,0}},
{1386,385,{-1,-3}},{1387,385,{-2,-4}},{1388,385,{-15,-18}},{1389,385,{-19,-15}},
{1390,385,{-24,-20}},{1391,385,{-57,-43}},{1392,385,{-29,-21}},{1393,385,{-25,-16}},
{1394,385,{-36,-25}},{1395,385,{-24,-20}},{1396,385,{-37,-24}},{1397,385,{-29,-23}},
{1398,385,{-30,-23}},{1399,385,{-35,-26}},{1400,129,{-58,-50}},{1401,129,{-17,-19}},
{1402,129,{-20,-22}},{1403,129,{-18,-16}},{1404,129,{0,0}},{1404,641,{0,0}},
{1405,641,{-1,-2}},{1406,641,{0,-7}},{1407,641,{9,-29}},{1408,641,{9,-13}},
{1409,641,{6,-7}},{1410,641,{27,-20}},{1411,641,{22,-12}},{1412,641,{24,-12}},
{1412,129,{24,-12}},{1413,129,{40,-16}},{1414,129,{16,-9}},{1415,129,{10,-6}},
{1416,129,{6,-7}},{1417,129,{13,-16}},{1418,129,{9,-12}},{1418,385,{9,-12}},
{1419,385,{5,-7}},{1420,385,{1,-4}},{1421,385,{6,-9}},{1422,385,{3,-5}},
{1423,385,{2,-6}},{1424,385,{11,-18}},{1425,385,{7,-15}},{1426,385,{7,-13}},
{1426,897,{7,-13}},{1427,641,{3,-7}},{1428,641,{10,-19}},{1429,641,{3,-5}},
{1430,641,{8,-13}},{1431,641,{6,-5}},{1432,641,{7,-9}},{1433,641,{13,-14}},
{1434,641,{15,-12}},{1435,641,{0,0}},{1436,641,{31,-19}},{1437,641,{14,-9}},
{1438,641,{17,-7}},{1439,641,{33,-16}},{1440,641,{6,-6}},{1441,641,{0,-1}},
{1442,641,{0,0}},{1443,641,{5,-7}},{1443,640,{5,-7}},{1444,640,{0,-1}},
{1446,640,{-1,-2}},{1447,640,{-3,-8}},{1448,640,{-32,-47}},{1449,640,{-29,-35}},
{1450,640,{-33,-33}},{1451,640,{-74,-74}},{1452,640,{-32,-30}},{1452,896,{-32,-30}},
{1453,896,{-16,-16}},{1454,896,{-55,-49}},{1455,896,{-38,-34}},{1456,640,{-72,-55}},
{1457,640,{-38,-26}},{1458,640,{-47,-31}},{1459,640,{-86,-47}},{1460,640,{-41,-20}},
{1461,640,{-36,-19}},{1462,640,{-56,-32}},{1462,512,{-56,-32}},{1463,512,{-28,-16}},
{1464,512,{-42,-20}},{1465,512,{-72,-34}},{1466,512,{-40,-20}},{1467,512,{-37,-20}},
{1467,768,{-37,-20}},{1468,768,{-28,-16}},{1469,768,{-7,-6}},{1470,768,{-4,-4}},
{1471,768,{-7,-6}},{1472,768,{0,0}},{1473,768,{-3,-3}},{1474,768,{-5,-5}},
{1475,257,{-1,-1}},{1476,257,{-3,-3}},{1477,257,{-1,-1}},{1478,257,{0,-4}},
{1479,257,{1,-6}},{1480,385,{11,-13}},{1481,385,{7,-9}},{1482,385,{13,-12}},
{1483,385,{28,-24}},{1484,385,{21,-11}},{1485,385,{24,-10}},{1486,385,{62,-15}},
{1487,385,{34,-7}},{1488,385,{29,-4}},{1488,384,{29,-4}},{1489,384,{31,-6}},
{1490,384,{31,-4}},{1491,384,{34,-5}},{1492,384,{38,-6}},{1493,384,{25,-2}},
{1494,384,{13,-4}},{1495,384,{45,-6}},{1496,384,{26,-4}},{1497,384,{26,-6}},
{1498,384,{45,-6}},{1498,388,{45,-6}},{1499,388,{18,-2}},{1500,388,{32,-2}},
{1501,388,{16,-2}},{1502,388,{7,0}},{1503,388,{15,-2}},{1504,644,{9,-2}},
{1505,644,{17,0}},{1506,644,{6,0}},{1507,644,{3,0}},{1508,644,{0,-1}},
{1509,644,{0,0}},{1510,644,{-3,1}},{1511,644,{0,0}},{1512,644,{-3,-1}},
{1513,644,{-4,-1}},{1514,644,{-12,-5}},{1515,644,{-20,-9}},{1516,644,{-80,-37}},
{1517,644,{-54,-24}},{1518,644,{-58,-21}},{1519,644,{-112,-39}},{1520,644,{-52,-16}},
{1521,644,{-51,-14}},{1522,644,{-117,-32}},{1523,644,{-69,-20}},{1524,644,{0,0}},
{1525,644,{-159,-49}},{1526,644,{-84,-25}},{1527,644,{-149,-46}},{1528,644,{-78,-22}},
{1529,644,{-68,-22}},{1530,644,{-151,-44}},{1531,644,{-72,-20}},{1532,644,{-63,-21}},
{1533,644,{-152,-39}},{1533,900,{-152,-39}},{1534,900,{-80,-22}},{1535,900,{-80,-20}},
{1536,900,{-155,-32}},{1537,388,{-66,-15}},{1538,388,{-77,-15}},{1539,388,{-138,-29}},
{1540,388,{-72,-17}},{1541,388,{-78,-20}},{1542,388,{-149,-36}},{1543,388,{-81,-20}},
{1544,388,{-159,-35}},{1545,388,{-78,-17}},{1546,388,{-55,-16}},{1546,384,{-55,-16}},
{1547,384,{-49,-13}},{1548,384,{-72,-17}},{1549,384,{-72,-22}},{1550,384,{-78,-22}},
{1551,384,{-107,-34}},{1552,384,{-58,-19}},{1553,384,{-67,-19}},{1554,384,{-91,-29}},
{1555,384,{-49,-16}},{1556,384,{-36,-13}},{1557,384,{-38,-13}},{1558,384,{-50,-14}},
{1559,384,{-29,-10}},{1559,256,{-29,-10}},{1560,256,{-38,-18}},{1561,256,{0,0}},
{1562,513,{4,3}},{1563,513,{2,5}},{1564,513,{12,-10}},{1565,513,{32,-18}},
{1566,513,{19,-7}},{1567,513,{16,-4}},{1568,513,{35,-3}},{1569,513,{45,0}},
{1570,513,{53,2}},{1571,513,{116,6}},{1572,513,{59,2}},{1573,641,{48,4}},
{1574,641,{93,6}},{1575,641,{43,2}},{1576,641,{36,4}},{1577,641,{44,3}},
{1578,641,{11,1}},{1579,641,{2,0}},{1580,641,{0,0}},{1581,641,{-1,0}},
{1581,129,{-1,0}},{1582,129,{-4,2}},{1583,257,{-1,-1}},{1584,257,{0,0}},
{1585,257,{-11,-4}},{1586,257,{-52,-21}},{1587,257,{-41,-13}},{1588,257,{-49,-16}},
{1589,257,{-112,-39}},{1590,257,{-42,-16}},{1591,257,{-98,-36}},{1592,257,{-48,-18}},
{1593,257,{-47,-18}},{1594,257,{-85,-35}},{1595,257,{-36,-17}},{1596,257,{-13,-8}},
{1597,257,{-7,-7}},{1598,257,{-2,-2}},{1599,257,{2,5}},{1600,257,{2,-3}},
{1601,1,{38,-18}},{1602,1,{23,-4}},{1603,1,{28,-4}},{1603,129,{28,-4}},
{1604,129,{34,-5}},{1605,129,{90,-5}},{1606,129,{50,0}},{1607,129,{59,0}},
{1608,641,{122,4}},{1609,641,{58,2}},{1610,641,{51,4}},{1611,641,{96,4}},
{1612,641,{47,2}},{1613,641,{55,2}},{1614,641,{81,4}},{1615,641,{20,0}},
{1616,641,{37,-3}},{1617,641,{11,-3}},{1618,641,{1,-2}},{1619,641,{0,0}},
{1619,385,{0,0}},{1622,385,{0,-1}},{1623,385,{-10,-24}},{1624,385,{-13,-16}},
{1625,385,{-22,-22}},{1626,385,{-68,-61}},{1627,385,{-41,-34}},{1628,385,{-83,-63}},
{1629,385,{-40,-27}},{1630,385,{-32,-21}},{1631,385,{-67,-40}},{1632,385,{-39,-22}},
{1633,385,{-39,-24}},{1634,385,{-95,-48}},{1635,385,{-42,-25}},{1636,385,{-87,-45}},
{1637,385,{-18,-13}},{1638,385,{-21,-15}},{1639,385,{-21,-13}},{1640,385,{-10,-11}},
{1641,385,{-7,-6}},{1642,385,{-15,-12}},{1643,385,{-5,-5}},{1645,385,{-2,-2}},
{1646,385,{0,0}},{1647,385,{2,-6}},{1648,385,{42,-22}},{1649,385,{37,-11}},
{1650,385,{92,-9}},{1651,385,{53,0}},{1652,385,{65,2}},{1653,385,{143,14}},
{1654,385,{79,11}},{1655,385,{73,11}},{1656,385,{102,13}},{1657,385,{26,3}},
{1658,385,{0,0}},{1659,385,{25,2}},{1660,385,{128,11}},{1661,385,{67,6}},
{1662,385,{72,9}},{1663,385,{54,9}},{1664,257,{59,6}},{1665,257,{87,10}},
{1666,257,{52,6}},{1667,257,{33,1}},{1668,257,{23,1}},{1668,256,{23,1}},
{1669,256,{41,1}},{1670,256,{29,-2}},{1671,256,{31,-9}},{1672,256,{35,-13}},
{1673,256,{37,-11}},{1674,256,{68,-21}},{1674,257,{68,-21}},{1675,257,{39,-11}},
{1676,257,{38,-11}},{1677,257,{79,-17}},{1678,257,{34,-5}},{1679,257,{45,-7}},
{1680,257,{78,-9}},{1681,257,{40,-5}},{1682,385,{34,-7}},{1683,385,{33,-9}},
{1684,384,{5,-3}},{1685,384,{7,-4}},{1686,384,{37,-11}},{1687,384,{23,-6}},
{1688,384,{26,-6}},{1689,384,{30,-5}},{1690,384,{24,-2}},{1691,384,{16,-2}},
{1692,384,{11,0}},{1693,384,{20,1}},{1694,384,{39,8}},{1695,384,{16,4}},
{1696,384,{0,0}},{1696,388,{0,0}},{1697,388,{16,7}},{1698,388,{18,11}},
{1699,388,{0,0}},{1701,388,{2,2}},{1702,388,{9,10}},{1703,388,{13,11}},
{1704,388,{15,11}},{1705,388,{46,33}},{1706,644,{28,18}},{1707,644,{42,21}},
{1708,644,{4,6}},{1709,644,{0,0}},{1710,644,{1,1}},{1711,644,{0,0}},
{1712,644,{0,3}},{1713,644,{0,2}},{1714,644,{-3,7}},{1715,644,{-3,2}},
{1716,644,{-2,2}},{1717,644,{-22,16}},{1718,644,{-17,8}},{1719,644,{-17,6}},
{1720,644,{-47,16}},{1721,644,{-29,5}},{1722,644,{-31,1}},{1723,644,{-75,1}},
{1724,644,{-48,-5}},{1725,644,{-55,-7}},{1726,644,{-111,-25}},{1727,644,{-57,-12}},
{1728,644,{-104,-28}},{1729,644,{-43,-13}},{1730,644,{-58,-19}},{1731,644,{-50,-18}},
{1732,644,{-65,-27}},{1733,644,{-25,-12}},{1734,644,{-5,-4}},{1735,644,{0,0}},
{1736,644,{3,3}},{1737,644,{0,0}},{1739,644,{0,-2}},{1740,644,{32,-21}},
{1740,900,{32,-21}},{1741,900,{25,-6}},{1742,900,{38,-5}},{1743,900,{31,-2}},
{1744,900,{48,0}},{1745,900,{34,2}},{1746,900,{68,6}},{1747,900,{34,2}},
{1748,900,{45,8}},{1748,644,{45,8}},{1749,644,{112,22}},{1750,644,{62,11}},
{1751,644,{64,13}},{1752,644,{117,25}},{1753,644,{60,13}},{1754,644,{115,30}},
{1755,644,{57,13}},{1756,644,{62,18}},{1757,644,{125,39}},{1758,644,{62,18}},
{1759,644,{51,17}},{1760,644,{109,34}},{1761,644,{54,15}},{1762,644,{57,16}},
{1763,132,{122,39}},{1764,132,{59,16}},{1765,132,{59,18}},{1766,132,{104,26}},
{1767,132,{53,15}},{1768,132,{51,15}},{1769,132,{63,20}},{1770,132,{12,6}},
{1771,132,{0,0}},{1771,164,{0,0}},{1772,164,{-10,-7}},{1773,164,{2,4}},
{1774,676,{3,4}},{1775,676,{0,3}},{1776,676,{0,0}},{1778,676,{4,9}},
{1779,676,{5,8}},{1780,676,{6,6}},{1781,676,{17,14}},{1782,644,{7,3}},
{1783,640,{33,11}},{1784,640,{22,5}},{1785,640,{32,2}},{1786,640,{62,3}},
{1787,640,{42,0}},{1788,640,{45,0}},{1789,640,{82,-3}},{1790,768,{39,0}},
{1792,769,{63,0}},{1793,257,{30,0}},{1794,257,{25,1}},{1795,257,{54,3}},
{1796,257,{23,0}},{1797,769,{16,1}},{1798,769,{42,5}},{1799,769,{26,1}},
{1800,769,{29,5}},{1801,769,{55,11}},{1802,257,{21,3}},{1803,257,{5,2}},
{1804,257,{40,8}},{1805,257,{20,3}},{1806,257,{23,3}},{1807,257,{7,1}},
{1808,257,{0,0}},{1809,385,{1,0}},{1810,385,{13,1}},{1811,385,{9,1}},
{1812,384,{16,2}},{1813,384,{13,1}},{1814,384,{9,1}},{1815,384,{17,2}},
{1816,384,{4,2}},{1817,384,{3,1}},{1818,384,{0,0}},{1819,896,{0,0}},
{1824,896,{-1,0}},{1825,640,{-2,0}},{1826,640,{0,0}},{1830,640,{9,-2}},
{1831,640,{15,-4}},{1832,640,{34,-3}},{1833,640,{98,-7}},{1834,640,{59,-3}},
{1835,640,{53,-3}},{1836,640,{115,-7}},{1837,641,{54,-5}},{1838,641,{124,-10}},
{1839,513,{67,-5}},{1840,513,{70,-3}},{1841,513,{110,-7}},{1842,1,{28,-4}},
{1842,257,{28,-4}},{1843,257,{1,-1}},{1844,257,{0,0}},{1845,257,{-14,3}},
{1846,257,{-8,3}},{1847,257,{-2,1}},{1848,257,{-1,-1}},{1849,256,{-15,-7}},
{1850,256,{-46,-17}},{1851,256,{-28,-10}},{1852,256,{-66,-19}},{1853,256,{-47,-11}},
{1854,256,{-45,-11}},{1855,256,{-107,-19}},{1856,256,{-57,-7}},{1857,256,{-46,-11}},
{1858,256,{-78,-17}},{1859,256,{-33,-9}},{1860,256,{-99,-21}},{1861,256,{-49,-12}},
{1862,256,{-95,-20}},{1863,256,{-42,-9}},{1864,256,{-32,-8}},{1865,256,{-25,-10}},
{1866,256,{-54,-18}},{1867,256,{-23,-10}},{1868,256,{-63,-27}},{1869,257,{-15,-7}},
{1870,257,{-24,-10}},{1871,257,{-24,-8}},{1872,257,{-39,-16}},{1873,257,{-20,-8}},
{1874,257,{-10,-8}},{1875,257,{-2,-2}},{1876,257,{-8,-8}},{1877,257,{-5,-5}},
{1878,257,{-3,-3}},{1880,257,{0,0}},{1881,385,{0,0}},{1882,385,{22,-12}},
{1883,385,{27,-8}},{1884,385,{0,0}},{1885,385,{26,-8}},{1886,385,{18,-4}},
{1887,385,{28,-4}},{1888,385,{106,2}},{1889,385,{70,7}},{1890,385,{76,7}},
{1891,385,{142,16}},{1892,385,{45,6}},{1893,385,{51,6}},{1894,385,{65,11}},
{1895,385,{73,11}},{1896,385,{85,19}},{1897,385,{169,38}},{1898,385,{82,21}},
{1899,384,{59,13}},{1900,384,{132,27}},{1901,384,{73,11}},{1902,384,{77,12}},
{1903,384,{85,14}},{1904,256,{85,14}},{1905,256,{164,31}},{1906,256,{72,14}},
{1907,256,{43,12}},{1908,256,{102,26}},{1909,256,{57,15}},{1910,256,{37,16}},
{1911,256,{61,30}},{1912,256,{10,7}},{1913,0,{0,1}},{1914,0,{-11,-8}},
{1915,0,{-7,-6}},{1916,0,{0,0}},{1917,0,{-4,8}},{1918,0,{-6,7}},
{1919,0,{0,0}},{1920,0,{-10,8}},{1921,0,{-26,19}},{1922,0,{-6,3}},
{1923,0,{-19,11}},{1924,0,{-18,6}},{1925,0,{-20,8}},{1926,0,{-41,14}},
{1927,0,{-27,7}},{1928,0,{-30,7}},{1929,0,{-29,4}},{1930,0,{-1,0}},
{1931,0,{-2,0}},{1932,0,{0,0}},{1933,16384,{0,0}},{1934,16384,{0,1}},
{1940,0,{0,1}},{1968,4,{0,1}},{1970,0,{0,1}},{1975,4,{0,1}},
{1978,0,{0,1}},{1984,4,{0,1}},{1986,0,{0,1}},{1992,4,{0,1}},
{1995,0,{0,1}},{2000,4,{0,1}},{2003,0,{0,1}},{2006,4,{0,1}},
{2011,0,{0,1}},{2019,16,{0,1}},{4294967295,0,{0,0}}
};
DemoRecord playRecord;
uint32_t playRecordIndex = 0;
int8_t playEnd = 0;
void demoPlayStep()
{
if (playRecordIndex == 0)
playRecord = demoPlay[playRecordIndex];
if (playEnd)
return;
DemoRecord nextRecord = demoPlay[playRecordIndex + 1];
playEnd = nextRecord.frame == UINT32_MAX_VALUE;
if (playEnd)
{
puts("demo end reached");
}
else if (SFG_game.frame >= nextRecord.frame)
{
playRecord = nextRecord;
playRecordIndex++;
}
}
int8_t demoKeyPressed(uint8_t key)
{
return (playRecord.keyStates & (((uint16_t) 0x01) << key)) != 0;
}
void demoGetMouseOffset(int16_t *x, int16_t *y)
{
*x = playRecord.mouseOffset[0];
*y = playRecord.mouseOffset[1];
}
void demoRecordPrint()
{
printf("recorded demo:");
for (uint32_t i = 0; i < demoRecLength; ++i)
{
DemoRecord record = demoRec[i];
if (i % 4 == 0)
putchar('\n');
printf("{%lu,%d,{%d,%d}},",record.frame,record.keyStates,record.mouseOffset[0],record.mouseOffset[1]);
}
printf("{%lu,0,{0,0}}",UINT32_MAX_VALUE); // terminate demo
}
#endif // guard

88
game.h
View File

@ -4,7 +4,7 @@
Main source file of Anarch the game that puts together all the pieces. main Main source file of Anarch the game that puts together all the pieces. main
game logic is implemented here. game logic is implemented here.
Physics notes (you can break this when messing with constants): physics notes (you can break this when messing around with game constants):
- Lowest ceiling under which player can fit is 4 height steps. - Lowest ceiling under which player can fit is 4 height steps.
- Widest hole over which player can run without jumping is 1 square. - Widest hole over which player can run without jumping is 1 square.
@ -85,11 +85,11 @@
int8_t SFG_keyPressed(uint8_t key); int8_t SFG_keyPressed(uint8_t key);
/** /**
Optinal function for mouse/joystick/analog controls, gets mouse x and y offset Optional function for mouse/joystick/analog controls, gets mouse x and y
in pixels from the game screen center (to achieve classic FPS mouse controls offset in pixels from the game screen center (to achieve classic FPS mouse
the platform should center the mouse after this call). If the platform isn't controls the platform should center the mouse after this call). If the
using a mouse, this function can simply return [0,0] offset at each call, or platform isn't using a mouse, this function can simply return [0,0] offset at
even do nothing at all (leave the variables as are). each call, or even do nothing at all (leave the variables as are).
*/ */
void SFG_getMouseOffset(int16_t *x, int16_t *y); void SFG_getMouseOffset(int16_t *x, int16_t *y);
@ -390,15 +390,15 @@ struct
The save contains game settings, game progress and a The save contains game settings, game progress and a
saved position. The format is as follows: saved position. The format is as follows:
0 4b highest level that has been reached 0 4b (less signif.) highest level that has been reached
0 4b level number of the saved position (15: no save) 0 4b (more signif.) level number of the saved position (15: no save)
1 8b game settings (SFG_game.settings) 1 8b game settings (SFG_game.settings)
2 8b health at saved position 2 8b health at saved position
3 8b bullet ammo at saved position 3 8b bullet ammo at saved position
4 8b rocket ammo at saved position 4 8b rocket ammo at saved position
5 8b plasma ammo at saved position 5 8b plasma ammo at saved position
6 32b little endian total play time, in 10ths of sec 6 32b little endian total play time, in 10ths of sec
10 16b little endian total enemies killed from start */ 10 16b little endian total enemies killed from start */
uint8_t continues; ///< Whether the game continues or was exited. uint8_t continues; ///< Whether the game continues or was exited.
} SFG_game; } SFG_game;
@ -414,26 +414,26 @@ struct
int8_t squarePosition[2]; int8_t squarePosition[2];
RCL_Vector2D direction; RCL_Vector2D direction;
RCL_Unit verticalSpeed; RCL_Unit verticalSpeed;
RCL_Unit previousVerticalSpeed; /**< Vertical speed in previous frame, needed RCL_Unit previousVerticalSpeed; /**< Vertical speed in previous frame, needed
for determining whether player is in the for determining whether player is in the
air. */ air. */
uint16_t headBobFrame; uint16_t headBobFrame;
uint8_t weapon; ///< currently selected weapon uint8_t weapon; ///< currently selected weapon
uint8_t health; uint8_t health;
uint32_t weaponCooldownFrames; ///< frames left for weapon cooldow uint32_t weaponCooldownFrames; ///< frames left for weapon cooldown
uint32_t lastHurtFrame; uint32_t lastHurtFrame;
uint32_t lastItemTakenFrame; uint32_t lastItemTakenFrame;
uint8_t ammo[SFG_AMMO_TOTAL]; uint8_t ammo[SFG_AMMO_TOTAL];
uint8_t cards; /**< Lowest 3 bits say which access cards uint8_t cards; /**< Lowest 3 bits say which access cards
have been taken., the next 3 bits say have been taken, the next 3 bits say
which cards should be blinking in the HUD, which cards should be blinking in the HUD,
the last 2 bits are a blink reset counter. */ the last 2 bits are a blink reset counter. */
uint8_t justTeleported; uint8_t justTeleported;
int8_t previousWeaponDirection; ///< Direction (+/0/-) of previous weapon. int8_t previousWeaponDirection; ///< Direction (+/0/-) of previous weapon.
} SFG_player; } SFG_player;
/** /**
Stores the current level and helper precomputed vaues for better performance. Stores the current level and helper precomputed values for better performance.
*/ */
struct struct
{ {
@ -442,7 +442,7 @@ struct
const uint8_t* textures[7]; ///< textures the level is using const uint8_t* textures[7]; ///< textures the level is using
uint32_t timeStart; uint32_t timeStart;
uint32_t frameStart; uint32_t frameStart;
uint32_t completionTime10sOfS; ///< completion time in 10th of second uint32_t completionTime10sOfS; ///< completion time in 10ths of second
uint8_t floorColor; uint8_t floorColor;
uint8_t ceilingColor; uint8_t ceilingColor;
@ -550,7 +550,7 @@ static const uint8_t SFG_ditheringPatterns[] =
*/ */
/** /**
Returns a pseudorandom byte. This is a very simple congrent generator, its Returns a pseudorandom byte. This is a very simple congruent generator, its
parameters have been chosen so that each number (0-255) is included in the parameters have been chosen so that each number (0-255) is included in the
output exactly once! output exactly once!
*/ */
@ -695,9 +695,6 @@ void SFG_levelEnds()
SFG_game.save[11] += SFG_currentLevel.monstersDead / 256; SFG_game.save[11] += SFG_currentLevel.monstersDead / 256;
} }
SFG_game.save[0] =
(SFG_game.save[0] & 0x0f) | ((SFG_currentLevel.levelNumber + 1) << 4);
SFG_game.save[2] = SFG_player.health; SFG_game.save[2] = SFG_player.health;
SFG_game.save[3] = SFG_player.ammo[0]; SFG_game.save[3] = SFG_player.ammo[0];
SFG_game.save[4] = SFG_player.ammo[1]; SFG_game.save[4] = SFG_player.ammo[1];
@ -1059,9 +1056,7 @@ void SFG_blitImage(
posY += scale * SFG_TEXTURE_SIZE; posY += scale * SFG_TEXTURE_SIZE;
y1 = posY >= 0 ? y1 = posY >= 0 ? (posY <= limitY ? posY : limitY) : 0;
(posY <= limitY ? posY : limitY)
: 0;
if (y1 >= SFG_GAME_RESOLUTION_Y) if (y1 >= SFG_GAME_RESOLUTION_Y)
y1 = SFG_GAME_RESOLUTION_Y - 1; y1 = SFG_GAME_RESOLUTION_Y - 1;
@ -1356,14 +1351,12 @@ void SFG_initPlayer()
SFG_player.squarePosition[1] = SFG_player.squarePosition[1] =
SFG_player.camera.position.y / RCL_UNITS_PER_SQUARE; SFG_player.camera.position.y / RCL_UNITS_PER_SQUARE;
SFG_player.camera.height = SFG_player.camera.height = SFG_floorHeightAt(
SFG_floorHeightAt(
SFG_currentLevel.levelPointer->playerStart[0], SFG_currentLevel.levelPointer->playerStart[0],
SFG_currentLevel.levelPointer->playerStart[1]) + SFG_currentLevel.levelPointer->playerStart[1]) +
RCL_CAMERA_COLL_HEIGHT_BELOW; RCL_CAMERA_COLL_HEIGHT_BELOW;
SFG_player.camera.direction = SFG_player.camera.direction = SFG_currentLevel.levelPointer->playerStart[2] *
SFG_currentLevel.levelPointer->playerStart[2] *
(RCL_UNITS_PER_SQUARE / 256); (RCL_UNITS_PER_SQUARE / 256);
SFG_recomputePLayerDirection(); SFG_recomputePLayerDirection();
@ -1723,7 +1716,7 @@ void SFG_init()
for (uint16_t i = 0; i < SFG_SAVE_SIZE; ++i) for (uint16_t i = 0; i < SFG_SAVE_SIZE; ++i)
SFG_game.save[i] = 0; SFG_game.save[i] = 0;
SFG_game.save[0] = 0; SFG_game.save[0] = 0xf0;
SFG_game.save[1] = SFG_game.settings; SFG_game.save[1] = SFG_game.settings;
SFG_gameLoad(); // attempt to load settings SFG_gameLoad(); // attempt to load settings
@ -1750,7 +1743,7 @@ void SFG_init()
} }
/** /**
Adds new projectile to the current level, return 1 if added, 0 if not (max Adds new projectile to the current level, returns 1 if added, 0 if not (max
count reached). count reached).
*/ */
uint8_t SFG_createProjectile(SFG_ProjectileRecord projectile) uint8_t SFG_createProjectile(SFG_ProjectileRecord projectile)
@ -2479,7 +2472,7 @@ uint8_t SFG_projectileCollides(SFG_ProjectileRecord *projectile,
/** /**
Updates a frame of the currently loaded level, i.e. enemies, projectiles, Updates a frame of the currently loaded level, i.e. enemies, projectiles,
aimations etc., with the exception of player. animations etc., with the exception of player.
*/ */
void SFG_updateLevel() void SFG_updateLevel()
{ {
@ -3444,12 +3437,12 @@ void SFG_gameStepPlaying()
SFG_processEvent(SFG_EVENT_PLAYER_TELEPORTS,0); SFG_processEvent(SFG_EVENT_PLAYER_TELEPORTS,0);
break; break;
} } // if teleporterNumber == 0
} } // for level items
} } // if eliminate
} } // if item collides
} } // if element != 0
} // item collision check } // for, item collision check
if (!collidesWithTeleporter) if (!collidesWithTeleporter)
SFG_player.justTeleported = 0; SFG_player.justTeleported = 0;
@ -3936,6 +3929,9 @@ void SFG_gameStep()
if (SFG_keyIsDown(SFG_KEY_RIGHT) && SFG_game.saved != SFG_CANT_SAVE) if (SFG_keyIsDown(SFG_KEY_RIGHT) && SFG_game.saved != SFG_CANT_SAVE)
{ {
// save the current position // save the current position
SFG_game.save[0] =
(SFG_game.save[0] & 0x0f) | (SFG_currentLevel.levelNumber << 4);
SFG_gameSave(); SFG_gameSave();
SFG_game.saved = 1; SFG_game.saved = 1;
} }
@ -4239,7 +4235,7 @@ void SFG_drawWeapon(int16_t bobOffset)
if (fireType == SFG_WEAPON_FIRE_TYPE_MELEE) if (fireType == SFG_WEAPON_FIRE_TYPE_MELEE)
{ {
bobOffset = shotAnimationFrame < animationLength / 2 ? 0 : bobOffset = shotAnimationFrame < animationLength / 2 ? 0 :
2 * SFG_WEAPONBOB_OFFSET_PIXELS ; 2 * SFG_WEAPONBOB_OFFSET_PIXELS;
} }
else else
{ {
@ -4288,7 +4284,7 @@ static inline uint16_t
void SFG_drawMenu() void SFG_drawMenu()
{ {
#define BACKGROUND_SCALE (SFG_GAME_RESOLUTION_X / (4 * SFG_TEXTURE_SIZE ) ) #define BACKGROUND_SCALE (SFG_GAME_RESOLUTION_X / (4 * SFG_TEXTURE_SIZE))
#if BACKGROUND_SCALE == 0 #if BACKGROUND_SCALE == 0
#undef BACKGROUND_SCALE #undef BACKGROUND_SCALE

View File

@ -12,7 +12,7 @@
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */
@ -39,7 +39,7 @@ static inline uint8_t SFG_getTexel(const uint8_t *texture, uint8_t x, uint8_t y)
x &= 0x1f; x &= 0x1f;
y &= 0x1f; y &= 0x1f;
return SFG_PROGRAM_MEMORY_U8 (texture + return SFG_PROGRAM_MEMORY_U8(texture +
((SFG_PROGRAM_MEMORY_U8(texture + 16 + (x * SFG_TEXTURE_SIZE + y) / 2) >> ((SFG_PROGRAM_MEMORY_U8(texture + 16 + (x * SFG_TEXTURE_SIZE + y) / 2) >>
(4 * (y % 2 == 0))) & 0x0f)); (4 * (y % 2 == 0))) & 0x0f));
} }
@ -1338,7 +1338,7 @@ uint8_t SFG_charToFontIndex(char c)
} }
} }
#define SFG_FONT_CHARACTER_SIZE 4 #define SFG_FONT_CHARACTER_SIZE 4 ///< width (= height) of font char. in pixels
/** /**
4x4 font, each character stored as 16 bits. 4x4 font, each character stored as 16 bits.

View File

@ -38,9 +38,9 @@
ul ul
{ {
width: 90%; width: 75%;
margin: auto; margin: 20px auto;
padding: 0; padding: 10px;
background-color: rgb(28,24,22); background-color: rgb(28,24,22);
} }
@ -51,6 +51,7 @@
margin: 10px 0; margin: 10px 0;
padding: 0; padding: 0;
text-align: center; text-align: center;
vertical-align: top;
} }
.logo .logo
@ -90,13 +91,14 @@
{ {
font-size: 25px; font-size: 25px;
text-align: center; text-align: center;
margin: 80px 0 25px; margin: 70px 0 25px;
color: white; color: white;
} }
.site-subtitle .subtitle
{ {
display: block; display: block;
margin: 20px;
text-align: center; text-align: center;
padding-bottom: 20px; padding-bottom: 20px;
} }
@ -104,6 +106,7 @@
.wow .wow
{ {
display: block; display: block;
width: 100%;
font-weight: bold; font-weight: bold;
font-size: 45px; font-size: 45px;
text-align: center; text-align: center;
@ -112,6 +115,19 @@
text-shadow: 0px 0px 60px red; text-shadow: 0px 0px 60px red;
} }
.wow::before, .wow::after
{
content: "";
width: 30px;
height: 30px;
display: inline-block;
margin: 0 30px;
position: relative;
top: 4px;
background: url(https://upload.wikimedia.org/wikipedia/commons/e/e1/Anarcho_pacifism_animation_2_inverted.gif) no-repeat;
background-size: contain;
}
.description .description
{ {
display: block; display: block;
@ -134,16 +150,6 @@
text-align: center; text-align: center;
} }
.love
{
margin: 40px 0 0;
display: block;
text-align: center;
color: #ee0033;
font-size: 25px;
font-weight: bold;
}
img img
{ {
display: block; display: block;
@ -166,6 +172,11 @@
{ {
width: 70%; width: 70%;
} }
.ap
{
width: 30px;
}
</style> </style>
</head> </head>
@ -174,17 +185,28 @@
<span class="subtitle"><i>suckless, anticapitalist, public domain game for everyone</i></span> <span class="subtitle"><i>suckless, anticapitalist, public domain game for everyone</i></span>
<span class="wow">THIS IS SPECIAL</span>
<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" src="https://peertube.mastodon.host/videos/embed/6c901037-b68b-45ac-8714-18903f34354c" frameborder="0" allowfullscreen></iframe> <iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" src="https://peertube.mastodon.host/videos/embed/6c901037-b68b-45ac-8714-18903f34354c" frameborder="0" allowfullscreen></iframe>
<span class="wow">THIS IS SPECIAL</span>
<ul>
<li>needs only <b>200 KB</b>, <b>32 KB RAM</b>, <b>40 MHz CPU</b>!</li>
<li><b>suckless</b>, pure C, <b>no dependencies</b>, no FPU, GPU or file I/O needed</li>
<li>10 levels, 6 weapons, 7 enemy types, 3 ammo types</li>
<li>varying floor/ceiling oldschool SW ray casting engine with mouse support</li>
<li><b>100% pubic domain</b> CC0 free software and culture</li>
<li>100% original work, no third party assets</li>
<li>well documented, hackable, <b>extremely portable</b></li>
<li>completely <b>gratis</b>, without ads, DRM or similar bullshit</li>
</ul>
<p class="description"> <p class="description">
This isn't a 90s style retro shooter, this <b>is</b> a 90s shooter. It's all yours. This isn't a 90s style retro shooter, this <b>is</b> a 90s shooter.
</p> </p>
<p class="description"> <p class="description">
This game runs everywhere and adheres to great <a href="https://suckless.org">simplicity</a>. This game runs everywhere and adheres to great <a href="https://suckless.org">simplicity</a>.
It is much more efficient and portable that Doom. It is much more efficient and portable than Doom.
It has completely <b>no dependencies</b> and doesn't even It has completely <b>no dependencies</b> and doesn't even
use floating point in case your computer doesn't have the HW unit. It can use floating point in case your computer doesn't have the HW unit. It can
fit into <b>200 KB</b> (including assets!) and runs with just fit into <b>200 KB</b> (including assets!) and runs with just
@ -230,16 +252,16 @@
profit. This is made out of <b>love</b>, for you and for the greater good. profit. This is made out of <b>love</b>, for you and for the greater good.
</p> </p>
<h2><a href="https://gitlab.com/drummyfish/anarch#faq">FAQ</a></h2>
<h2>Download</h2> <h2>Download</h2>
<ul> <ul>
<li><a href="">64b GNU/Linux</a></li> <li><a href="">GNU/Linux SDL</a></li>
<li><a href="">GNU/Linux CSFML</a></li>
<li><a href="">play in browser</a></li> <li><a href="">play in browser</a></li>
<li><a href="">Pokitto</a></li> <li><a href="">Pokitto</a></li>
<li><a href="">GB Meta</a></li> <li><a href="">GB Meta</a></li>
<li><a href="">M$ Win$hit</a></li> <li><a href="">M$ Win$hit XP SDL</a></li>
<li><a href="">source code</a></li>
</ul> </ul>
<h2>Explore</h2> <h2>Explore</h2>
@ -251,20 +273,7 @@
<li><a href="">OGA assets</a></li> <li><a href="">OGA assets</a></li>
</ul> </ul>
<h2>Better Society</h2> <h2><a href="https://gitlab.com/drummyfish/anarch#faq">FAQ in readme</a></h2>
<ul>
<li>support social anarchism</li>
<li>support pacifism</li>
<li>support free software</li>
<li>support free culture</li>
<li>reject capitalism</li>
<li>reject intellectual proeprty</li>
</ul>
<span class="love">love and peace &lt;3</span>
<img alt="anarcho-pacifism animation" src="https://upload.wikimedia.org/wikipedia/commons/e/e1/Anarcho_pacifism_animation_2_inverted.gif">
<p class="footer"> <p class="footer">
This page and the presented game, both made by drummyfish, are released under This page and the presented game, both made by drummyfish, are released under

View File

@ -6,7 +6,7 @@
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */
@ -17,8 +17,7 @@
#define SFG_MAP_SIZE 64 #define SFG_MAP_SIZE 64
#define SFG_TILE_DICTIONARY_SIZE 64 #define SFG_TILE_DICTIONARY_SIZE 64
typedef uint16_t SFG_TileDefinition; /**
/**<
Defines a single game map tile. The format is following: Defines a single game map tile. The format is following:
MSB aaabbbbb cccddddd LSB MSB aaabbbbb cccddddd LSB
@ -29,6 +28,7 @@ typedef uint16_t SFG_TileDefinition;
ccc: floor texture index, 111 means completely transparent texture ccc: floor texture index, 111 means completely transparent texture
ddddd: floor height ddddd: floor height
*/ */
typedef uint16_t SFG_TileDefinition;
#define SFG_TILE_CEILING_MAX_HEIGHT 31 #define SFG_TILE_CEILING_MAX_HEIGHT 31
#define SFG_TILE_TEXTURE_TRANSPARENT 7 #define SFG_TILE_TEXTURE_TRANSPARENT 7
@ -104,11 +104,11 @@ typedef struct
#define SFG_LEVEL_ELEMENT_CARD2 0x0f #define SFG_LEVEL_ELEMENT_CARD2 0x0f
#define SFG_LEVEL_ELEMENT_LOCK0 0x10 /**< Special level element that must be #define SFG_LEVEL_ELEMENT_LOCK0 0x10 /**< Special level element that must be
placed on a tile with door. This door is placed on a tile with door. This door is
then unlocked by taking the corresponding then locked until taking the corresponding
access card. */ access card. */
#define SFG_LEVEL_ELEMENT_LOCK1 0x11 #define SFG_LEVEL_ELEMENT_LOCK1 0x11
#define SFG_LEVEL_ELEMENT_LOCK2 0x12 #define SFG_LEVEL_ELEMENT_LOCK2 0x12
#define SFG_LEVEL_ELEMENT_BLOCKER 0x13 ///< Invisible wall. #define SFG_LEVEL_ELEMENT_BLOCKER 0x13 ///< invisible wall
#define SFG_LEVEL_ELEMENT_MONSTER_SPIDER 0x20 #define SFG_LEVEL_ELEMENT_MONSTER_SPIDER 0x20
#define SFG_LEVEL_ELEMENT_MONSTER_DESTROYER 0x21 #define SFG_LEVEL_ELEMENT_MONSTER_DESTROYER 0x21
@ -143,7 +143,7 @@ typedef struct
uint8_t ceilingColor; uint8_t ceilingColor;
uint8_t playerStart[3]; /**< Player starting location: square X, square Y, uint8_t playerStart[3]; /**< Player starting location: square X, square Y,
direction (fourths of RCL_Unit). */ direction (fourths of RCL_Unit). */
uint8_t backgroundImage; /** Index of level background image. */ uint8_t backgroundImage; ///< Index of level background image.
SFG_LevelElement elements[SFG_MAX_LEVEL_ELEMENTS]; SFG_LevelElement elements[SFG_MAX_LEVEL_ELEMENTS];
} SFG_Level; } SFG_Level;
@ -173,6 +173,9 @@ static inline SFG_TileDefinition SFG_getMapTile
NOTE: Initially the levels were stored sequentially in one big array, but that NOTE: Initially the levels were stored sequentially in one big array, but that
caused some issues with Arduino's PROGMEM, so now we store each level in a caused some issues with Arduino's PROGMEM, so now we store each level in a
separate variable and eventually create an array of pointers to these. separate variable and eventually create an array of pointers to these.
Levels can be designed using bitmap editor and converted to the struct format
with provided tools.
*/ */
SFG_PROGRAM_MEMORY SFG_Level SFG_level0 = SFG_PROGRAM_MEMORY SFG_Level SFG_level0 =
@ -1796,7 +1799,6 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level9 =
{SFG_LEVEL_ELEMENT_NONE, {0,0}},{SFG_LEVEL_ELEMENT_NONE, {0,0}} {SFG_LEVEL_ELEMENT_NONE, {0,0}},{SFG_LEVEL_ELEMENT_NONE, {0,0}}
}, // elements }, // elements
} // level } // level
; ;
static const SFG_Level * SFG_levels[SFG_NUMBER_OF_LEVELS] = static const SFG_Level * SFG_levels[SFG_NUMBER_OF_LEVELS] =

View File

@ -15,7 +15,7 @@
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */

View File

@ -7,7 +7,7 @@
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */

View File

@ -5,9 +5,8 @@
compile a native executable or a transpiled JS browser version with compile a native executable or a transpiled JS browser version with
emscripten. emscripten.
This front end is pretty feature rich, allowing testing etc. A much more This frontend is not strictly minimal, it could be reduced a lot. If you want
minimal could be made. If you want a learning example of front end, look at a learning example of frontend, look at another, simpler one, e.g. terminal.
another, simpler one, e.g. the terminal.
To compile with emscripten run: To compile with emscripten run:
@ -16,7 +15,7 @@
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */
@ -26,10 +25,10 @@
#endif #endif
// #define SFG_START_LEVEL 1 // #define SFG_START_LEVEL 1
// #define SFG_IMMORTAL 1 #define SFG_IMMORTAL 1
#define SFG_UNLOCK_DOOR 1 #define SFG_UNLOCK_DOOR 1
// #define SFG_REVEAL_MAP 1 // #define SFG_REVEAL_MAP 1
#define SFG_INFINITE_AMMO 1 // #define SFG_INFINITE_AMMO 1
// #define SFG_TIME_MULTIPLIER 512 // #define SFG_TIME_MULTIPLIER 512
// #define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent); // #define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);

View File

@ -1,7 +1,9 @@
/** /**
@file main_test.c @file main_test.c
This is a front end that serves as a basic automatic test of the game. This is a front end that serves as a basic automatic test of the game. At this
point it's very simple and basically just checks if anything really
substantial wasn't broken.
This fronted tries to play the game and see if it behaves how expected. If you This fronted tries to play the game and see if it behaves how expected. If you
change anything substantial in the game, this test may start to fail and you change anything substantial in the game, this test may start to fail and you

View File

@ -11,7 +11,7 @@
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */
@ -38,7 +38,7 @@
integers and rounding errors can occur soon, so don't set this to extreme integers and rounding errors can occur soon, so don't set this to extreme
values (try to keep between 20 to 100). FPS also determines the game values (try to keep between 20 to 100). FPS also determines the game
simulation step length, so different FPS values may result in very slight simulation step length, so different FPS values may result in very slight
differences in game behavior (not noticeable but affecting demos etc.). differences in game behavior (not very noticeable but affecting demos etc.).
*/ */
#ifndef SFG_FPS #ifndef SFG_FPS
#define SFG_FPS 60 #define SFG_FPS 60
@ -46,7 +46,7 @@
/** /**
On platforms with mouse this sets its horizontal sensitivity. 128 means 1 On platforms with mouse this sets its horizontal sensitivity. 128 means 1
RCL_Unit per mouse pixel travelled. RCL_Unit turn angle per mouse pixel travelled.
*/ */
#ifndef SFG_MOUSE_SENSITIVITY_HORIZONTAL #ifndef SFG_MOUSE_SENSITIVITY_HORIZONTAL
#define SFG_MOUSE_SENSITIVITY_HORIZONTAL 32 #define SFG_MOUSE_SENSITIVITY_HORIZONTAL 32
@ -62,17 +62,15 @@
/** /**
Width of the screen in pixels. Set this to ACTUAL resolution. If you want the Width of the screen in pixels. Set this to ACTUAL resolution. If you want the
game to run at smaller resolution (with bigger pixels), do his using game to run at smaller resolution (with bigger pixels), do this using
SFG_RESOLUTION_SCALEDOWN; SFG_RESOLUTION_SCALEDOWN.
*/ */
#ifndef SFG_SCREEN_RESOLUTION_X #ifndef SFG_SCREEN_RESOLUTION_X
#define SFG_SCREEN_RESOLUTION_X 800 #define SFG_SCREEN_RESOLUTION_X 800
#endif #endif
/** /**
Height of the screen in pixels. Set this to ACTUAL resolution. If you want the Like SFG_SCREEN_RESOLUTION_X, but for y resolution.
game to run at smaller resolution (with bigger pixels), do his using
SFG_RESOLUTION_SCALEDOWN;
*/ */
#ifndef SFG_SCREEN_RESOLUTION_Y #ifndef SFG_SCREEN_RESOLUTION_Y
#define SFG_SCREEN_RESOLUTION_Y 600 #define SFG_SCREEN_RESOLUTION_Y 600
@ -88,7 +86,6 @@
/** /**
Horizontal FOV (field of vision) in RCL_Units (1024 means 360 degrees). Horizontal FOV (field of vision) in RCL_Units (1024 means 360 degrees).
*/ */
#ifndef SFG_FOV_HORIZONTAL #ifndef SFG_FOV_HORIZONTAL
#define SFG_FOV_HORIZONTAL 256 #define SFG_FOV_HORIZONTAL 256
#endif #endif
@ -129,7 +126,7 @@
#endif #endif
/** /**
Hint as to whether run in fullscreen, if the platform allows it. Hint as to whether to run in fullscreen, if the platform allows it.
*/ */
#ifndef SFG_FULLSCREEN #ifndef SFG_FULLSCREEN
#define SFG_FULLSCREEN 0 #define SFG_FULLSCREEN 0
@ -289,8 +286,9 @@
#endif #endif
/** /**
Says the intensity of background image blur. 0 means no blur, improves Says the intensity of background image blur. 0 means no blur, which improves
performance and lowers memory usage. performance and lowers memory usage. Blur doesn't look very good in small
resolutions.
*/ */
#ifndef SFG_BACKGROUND_BLUR #ifndef SFG_BACKGROUND_BLUR
#define SFG_BACKGROUND_BLUR 0 #define SFG_BACKGROUND_BLUR 0

View File

@ -2,19 +2,20 @@
@file assets.h @file assets.h
This file containts sounds and music that can optionally be used by the game This file containts sounds and music that can optionally be used by the game
front end. Every sound effect has 2048 samples, is stored in 8kHz mono format frontend. Every sound effect has 2048 samples, is stored as 8kHz mono format
with 4 bit quantization, meaning every sound effect takes 1024 bytes. Sounds with 4 bit quantization, meaning every sound effect takes 1024 bytes. Sounds
can be converted using a provided python script like this: can be converted using a provided python script like this:
python snd2array.py sound.raw python snd2array.py sound.raw
Music is based on bytebeat (procedural waveforms generated by short bitwise
operation formulas). The formulas were NOT copied from anywhere, they were
discovered from scratch.
by Miloslav Ciz (drummyfish), 2019 by Miloslav Ciz (drummyfish), 2019
Music is based on bytebeat (procedural waveforms generated by short bitwise
operation formulas).
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is plus a waiver of all other intellectual property. The goal of this work is to
be and remain completely in the public domain forever, available for any use be and remain completely in the public domain forever, available for any use
whatsoever. whatsoever.
*/ */
@ -26,7 +27,7 @@
#define SFG_SFX_SIZE (SFG_SFX_SAMPLE_COUNT / 2) #define SFG_SFX_SIZE (SFG_SFX_SAMPLE_COUNT / 2)
/** /**
Gets a 8-bit sound sample. Gets an 8bit sound sample.
*/ */
#define SFG_GET_SFX_SAMPLE(soundIndex,sampleIndex) \ #define SFG_GET_SFX_SAMPLE(soundIndex,sampleIndex) \
((SFG_PROGRAM_MEMORY_U8(SFG_sounds + soundIndex * SFG_SFX_SIZE \ ((SFG_PROGRAM_MEMORY_U8(SFG_sounds + soundIndex * SFG_SFX_SIZE \
@ -43,7 +44,7 @@ SFG_PROGRAM_MEMORY uint8_t SFG_musicTrackAverages[SFG_TRACK_COUNT] =
{14,7,248,148,6,8}; {14,7,248,148,6,8};
struct struct
{ // all should be initialized to 0 { // all should be initialized to 0 by default
uint8_t track; uint8_t track;
uint32_t t; // time variable/parameter uint32_t t; // time variable/parameter
uint32_t t2; // stores t squared, for better performance uint32_t t2; // stores t squared, for better performance
@ -70,7 +71,7 @@ uint8_t SFG_getNextMusicSample()
uint32_t result; uint32_t result;
#define S SFG_MusicState.t // can't use "T" because of a C++ template #define S SFG_MusicState.t // can't use "T" because of a C++ template
#define S2 SFG_MusicState.t2 #define S2 SFG_MusicState.t2
#define N11S SFG_MusicState.n11t #define N11S SFG_MusicState.n11t