Update GB FE

This commit is contained in:
Miloslav Číž 2020-10-31 19:18:08 +01:00
parent d0b98840c1
commit 8ca0912bbb
15 changed files with 12996 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// Pokitto config required by PokittoLib
//#define PROJ_SHOW_FPS_COUNTER
#define PROJ_SCREENMODE 13
#define PROJ_MODE13 1
#define PROJ_ENABLE_SOUND 1

582
main_gbmeta/constants.h Normal file
View File

@ -0,0 +1,582 @@
/**
@file constants.h
This file contains definitions of game constants that are not considered
part of game settings and whose change can ffect the game balance and
playability, e.g. physics constants.
by Miloslav Ciz (drummyfish), 2019
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
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#ifndef _SFG_CONSTANTS_H
#define _SFG_CONSTANTS_H
/**
How quickly player moves, in squares per second.
*/
#define SFG_PLAYER_MOVE_SPEED 7
/**
Gravity acceleration in squares / (second^2).
*/
#define SFG_GRAVITY_ACCELERATION 30
/**
Initial upwards speed of player's jump, in squares per second.
*/
#define SFG_PLAYER_JUMP_SPEED 5
/**
Melee and close-up attack range, in RCL_Units.
*/
#define SFG_MELEE_RANGE 1600
/**
When a projectile is shot, it'll be offset by this distance (in RCL_Units)
from the shooter.
*/
#define SFG_PROJECTILE_SPAWN_OFFSET 256
/**
Player's melee hit range, in RCL_Units (RCL_UNITS_PER_SQUARE means full angle,
180 degrees to both sides).
*/
#define SFG_PLAYER_MELEE_ANGLE 512
/**
How quickly elevators and squeezers move, in RCL_Unit per second.
*/
#define SFG_MOVING_WALL_SPEED 1024
/**
How quickly doors open and close, in RCL_Unit per second.
*/
#define SFG_DOOR_OPEN_SPEED 2048
/**
Helper special state value.
*/
#define SFG_CANT_SAVE 255
/**
Says the distance in RCL_Units at which level elements (items, monsters etc.)
are active.
*/
#define SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE (12 * 1024)
/**
Rate at which AI will be updated, which also affects how fast enemies will
appear.
*/
#define SFG_AI_FPS 4
/**
Says a probability (0 - 255) of the AI changing its state during one update
step.
*/
#define SFG_AI_RANDOM_CHANGE_PROBABILITY 40
/**
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
square).
*/
#define SFG_ELEMENT_COLLISION_RADIUS 1800
/**
Height, in RCL_Units, at which collisions happen with level elements
(sprites).
*/
#define SFG_ELEMENT_COLLISION_HEIGHT 1024
/**
Distance at which explosion does damage and throws away the player, in
RCL_Units. Should be higher than SFG_ELEMENT_COLLISION_RADIUS so that
exploded rockets also hurt the target.
*/
#define SFG_EXPLOSION_RADIUS 2000
/**
Distance in RCL_Units which the player is pushed away by an explosion. Watch
out, a slightly higher value can make player go through walls. Rather keep
this under RCL_UNITS_PER_SQUARE;
*/
#define SFG_EXPLOSION_PUSH_AWAY_DISTANCE 1023
/**
How much damage triggers a barrel explosion.
*/
#define SFG_BARREL_EXPLOSION_DAMAGE_THRESHOLD 3
/**
Maximum player health.
*/
#define SFG_PLAYER_MAX_HEALTH 125
/**
Start health of player.
*/
#define SFG_PLAYER_START_HEALTH 100
/**
At which value health indicator shows a warning (red color).
*/
#define SFG_PLAYER_HEALTH_WARNING_LEVEL 20
/**
Amount of health that is increased by taking a health kit.
*/
#define SFG_HEALTH_KIT_VALUE 20
/**
How much randomness (positive and negative) will be added to damage
(e.g. by weapons, explosions, ...). This constant is is 0 to 255, 255 meaning
100% of the base value.
*/
#define SFG_DAMAGE_RANDOMNESS 64
/**
Height of monster collision BBox in RCL_Units.
*/
#define SFG_MONSTER_COLLISION_HEIGHT 1024
/**
Specifies key repeat delay, in ms.
*/
#define SFG_KEY_REPEAT_DELAY 500
/**
Specifies key repeat period, in ms.
*/
#define SFG_KEY_REPEAT_PERIOD 150
/**
Angle in which multiple projectiles are spread, RCL_Units.
*/
#define SFG_PROJECTILE_SPREAD_ANGLE 100
#define SFG_MAX_MONSTERS 64
#define SFG_MAX_PROJECTILES 12
#define SFG_MAX_DOORS 32
#define SFG_AMMO_BULLETS 0
#define SFG_AMMO_ROCKETS 1
#define SFG_AMMO_PLASMA 2
#define SFG_AMMO_TOTAL 3
#define SFG_AMMO_NONE SFG_AMMO_TOTAL
#define SFG_AMMO_INCREASE_BULLETS 10
#define SFG_AMMO_INCREASE_ROCKETS 5
#define SFG_AMMO_INCREASE_PLASMA 8
#define SFG_AMMO_MAX_BULLETS 200
#define SFG_AMMO_MAX_ROCKETS 100
#define SFG_AMMO_MAX_PLASMA 150
/**
Duration of story text (intro/outro) in ms.
*/
#define SFG_STORYTEXT_DURATION 15000
/**
Time in ms of the player death animation.
*/
#define SFG_LOSE_ANIMATION_DURATION 2000
/**
Time in ms of the level win animation.
*/
#define SFG_WIN_ANIMATION_DURATION 2500
/**
Time in ms of the level start stage.
*/
#define SFG_LEVEL_START_DURATION 1500
/**
Vertical sprite size, in RCL_Units.
*/
#define SFG_BASE_SPRITE_SIZE RCL_UNITS_PER_SQUARE
// ----------------------------
// derived constants
#define SFG_GAME_RESOLUTION_X \
(SFG_SCREEN_RESOLUTION_X / SFG_RESOLUTION_SCALEDOWN)
#define SFG_GAME_RESOLUTION_Y \
(SFG_SCREEN_RESOLUTION_Y / SFG_RESOLUTION_SCALEDOWN)
#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS
#if SFG_MS_PER_FRAME == 0
#undef SFG_MS_PER_FRAME
#define SFG_MS_PER_FRAME 1
#endif
#define SFG_KEY_REPEAT_DELAY_FRAMES \
(SFG_KEY_REPEAT_DELAY / SFG_MS_PER_FRAME)
#if SFG_KEY_REPEAT_DELAY_FRAMES == 0
#undef SFG_KEY_REPEAT_DELAY_FRAMES
#define SFG_KEY_REPEAT_DELAY_FRAMES 1
#endif
#define SFG_KEY_REPEAT_PERIOD_FRAMES \
(SFG_KEY_REPEAT_PERIOD / SFG_MS_PER_FRAME)
#if SFG_KEY_REPEAT_PERIOD_FRAMES == 0
#undef SFG_KEY_REPEAT_PERIOD_FRAMES
#define SFG_KEY_REPEAT_PERIOD_FRAMES 1
#endif
#define SFG_WEAPON_IMAGE_SCALE \
(SFG_GAME_RESOLUTION_X / (SFG_TEXTURE_SIZE * 5))
#if SFG_WEAPON_IMAGE_SCALE == 0
#undef SFG_WEAPON_IMAGE_SCALE
#define SFG_WEAPON_IMAGE_SCALE 1
#endif
#define SFG_WEAPONBOB_OFFSET_PIXELS \
(SFG_WEAPONBOB_OFFSET * SFG_WEAPON_IMAGE_SCALE)
#define SFG_WEAPON_IMAGE_POSITION_X \
(SFG_GAME_RESOLUTION_X / 2 - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE) / 2)
#if SFG_GAME_RESOLUTION_Y > 70
#define SFG_WEAPON_IMAGE_POSITION_Y \
(SFG_GAME_RESOLUTION_Y - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE))
#elif SFG_GAME_RESOLUTION_Y > 50
#define SFG_WEAPON_IMAGE_POSITION_Y (SFG_GAME_RESOLUTION_Y \
- ((SFG_WEAPON_IMAGE_SCALE * 3 * SFG_TEXTURE_SIZE) / 4))
#else
#define SFG_WEAPON_IMAGE_POSITION_Y \
(SFG_GAME_RESOLUTION_Y - SFG_TEXTURE_SIZE / 2)
#endif
#define SFG_PLAYER_TURN_UNITS_PER_FRAME \
((SFG_PLAYER_TURN_SPEED * RCL_UNITS_PER_SQUARE) / (360 * SFG_FPS))
#if SFG_PLAYER_TURN_UNITS_PER_FRAME == 0
#undef SFG_PLAYER_TURN_UNITS_PER_FRAME
#define SFG_PLAYER_TURN_UNITS_PER_FRAME 1
#endif
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME \
((SFG_PLAYER_MOVE_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS)
#if SFG_PLAYER_MOVE_UNITS_PER_FRAME == 0
#undef SFG_PLAYER_MOVE_UNITS_PER_FRAME
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME 1
#endif
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME \
((SFG_GRAVITY_ACCELERATION * RCL_UNITS_PER_SQUARE) / (SFG_FPS * SFG_FPS))
#if SFG_GRAVITY_SPEED_INCREASE_PER_FRAME == 0
#undef SFG_GRAVITY_SPEED_INCREASE_PER_FRAME
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME 1
#endif
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME \
(((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) \
- SFG_GRAVITY_SPEED_INCREASE_PER_FRAME / 2)
/* ^ This substraction corrects the initial veloc. so that the numeric curve
copies the analytical (smooth) curve. Without it the numeric curve goes
ABOVE and makes player jump higher with lower FPS. To make sense of this
try to solve the differential equation and plot it. */
#if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0
#undef SFG_PLAYER_JUMP_OFFSET_PER_FRAME
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1
#endif
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME \
(SFG_HEADBOB_SPEED / SFG_FPS)
#if SFG_HEADBOB_FRAME_INCREASE_PER_FRAME == 0
#undef SFG_HEADBOB_FRAME_INCREASE_PER_FRAME
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME 1
#endif
#define SFG_HEADBOB_ENABLED (SFG_HEADBOB_SPEED > 0 && SFG_HEADBOB_OFFSET > 0)
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME \
((SFG_GAME_RESOLUTION_Y * SFG_CAMERA_SHEAR_SPEED) / SFG_FPS)
#if SFG_CAMERA_SHEAR_STEP_PER_FRAME == 0
#undef SFG_CAMERA_SHEAR_STEP_PER_FRAME
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME 1
#endif
#define SFG_CAMERA_MAX_SHEAR_PIXELS \
((SFG_CAMERA_MAX_SHEAR * SFG_GAME_RESOLUTION_Y) / 1024)
#define SFG_FONT_SIZE_SMALL \
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 50))
#if SFG_FONT_SIZE_SMALL == 0
#undef SFG_FONT_SIZE_SMALL
#define SFG_FONT_SIZE_SMALL 1
#endif
#define SFG_FONT_SIZE_MEDIUM \
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 30))
#if SFG_FONT_SIZE_MEDIUM == 0
#undef SFG_FONT_SIZE_MEDIUM
#define SFG_FONT_SIZE_MEDIUM 1
#endif
#define SFG_FONT_SIZE_BIG \
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 18))
#if SFG_FONT_SIZE_BIG == 0
#undef SFG_FONT_SIZE_BIG
#define SFG_FONT_SIZE_BIG 1
#endif
#define SFG_Z_BUFFER_SIZE SFG_GAME_RESOLUTION_X
/**
Step in which walls get higher, in raycastlib units.
*/
#define SFG_WALL_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 4)
#define SFG_CEILING_MAX_HEIGHT\
(16 * RCL_UNITS_PER_SQUARE - RCL_UNITS_PER_SQUARE / 2 )
#define SFG_DOOR_UP_DOWN_MASK 0x20
#define SFG_DOOR_LOCK(doorRecord) ((doorRecord) >> 6)
#define SFG_DOOR_VERTICAL_POSITION_MASK 0x1f
#define SFG_DOOR_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 0x1f)
#define SFG_DOOR_INCREMENT_PER_FRAME \
(SFG_DOOR_OPEN_SPEED / (SFG_DOOR_HEIGHT_STEP * SFG_FPS))
#if SFG_DOOR_INCREMENT_PER_FRAME == 0
#undef SFG_DOOR_INCREMENT_PER_FRAME
#define SFG_DOOR_INCREMENT_PER_FRAME 1
#endif
#define SFG_MAX_ITEMS SFG_MAX_LEVEL_ELEMENTS
#define SFG_MAX_SPRITE_SIZE SFG_GAME_RESOLUTION_X
#define SFG_MAP_PIXEL_SIZE (SFG_GAME_RESOLUTION_Y / SFG_MAP_SIZE)
#if SFG_MAP_PIXEL_SIZE == 0
#undef SFG_MAP_PIXEL_SIZE
#define SFG_MAP_PIXEL_SIZE 1
#endif
#define SFG_AI_UPDATE_FRAME_INTERVAL \
(SFG_FPS / SFG_AI_FPS)
#if SFG_AI_UPDATE_FRAME_INTERVAL == 0
#undef SFG_AI_UPDATE_FRAME_INTERVAL
#define SFG_AI_UPDATE_FRAME_INTERVAL 1
#endif
#define SFG_SPRITE_ANIMATION_FRAME_DURATION \
(SFG_FPS / SFG_SPRITE_ANIMATION_SPEED)
#if SFG_SPRITE_ANIMATION_FRAME_DURATION == 0
#undef SFG_SPRITE_ANIMATION_FRAME_DURATION
#define SFG_SPRITE_ANIMATION_FRAME_DURATION 1
#endif
#define SFG_HUD_MARGIN (SFG_GAME_RESOLUTION_X / 40)
#define SFG_HUD_BORDER_INDICATOR_WIDTH_PIXELS \
(SFG_GAME_RESOLUTION_Y / SFG_HUD_BORDER_INDICATOR_WIDTH)
#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES \
(SFG_HUD_BORDER_INDICATOR_DURATION / SFG_MS_PER_FRAME)
#if SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES == 0
#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES 1
#endif
#define SFG_BLINK_PERIOD_FRAMES (SFG_BLINK_PERIOD / SFG_MS_PER_FRAME)
#define SFG_HUD_BAR_HEIGHT \
(SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1)
// ----------------------------
// monsters
#define SFG_MONSTER_ATTACK_MELEE 0
#define SFG_MONSTER_ATTACK_FIREBALL 1
#define SFG_MONSTER_ATTACK_BULLET 2
#define SFG_MONSTER_ATTACK_FIREBALL_BULLET 3
#define SFG_MONSTER_ATTACK_PLASMA 4
#define SFG_MONSTER_ATTACK_EXPLODE 5
#define SFG_MONSTER_ATTACK_FIREBALL_PLASMA 6
#define SFG_MONSTER_ATTRIBUTE(attackType,aggressivity0to255,health0to255,spriteSize0to3) \
((uint16_t) ( \
attackType | \
((aggressivity0to255 / 8) << 3) | \
(spriteSize0to3 << 8) | \
((health0to255 / 4) << 10)))
#define SFG_GET_MONSTER_ATTACK_TYPE(monsterNumber) \
(SFG_monsterAttributeTable[monsterNumber] & 0x0007)
#define SFG_GET_MONSTER_AGGRESSIVITY(monsterNumber) \
(((SFG_monsterAttributeTable[monsterNumber] >> 3) & 0x1F) * 8)
#define SFG_GET_MONSTER_SPRITE_SIZE(monsterNumber) \
((SFG_monsterAttributeTable[monsterNumber] >> 8) & 0x03)
#define SFG_GET_MONSTER_MAX_HEALTH(monsterNumber) \
(((SFG_monsterAttributeTable[monsterNumber] >> 10) & 0x3F) * 4)
/**
Table of monster attributes, each as a 16bit word in format:
MSB hhhhhhssaaaattt LSB
ttt: attack type
aaaaa: aggressivity (frequence of attacks), 0 to 31
ss: sprite size
hhhhhh: health, 0 to 63
*/
uint16_t SFG_monsterAttributeTable[SFG_MONSTERS_TOTAL] =
{
/* spider */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL,40,61,2),
/* destr. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_BULLET,90,170,3),
/* warrior */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_MELEE,255,40,1),
/* plasma */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_PLASMA,56,92,1),
/* ender */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_PLASMA,128,255,3),
/* turret */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_BULLET,32,23,0),
/* explod. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_EXPLODE,255,36,1)
};
// ----------------------------
// weapons and projectiles
#define SFG_WEAPON_KNIFE 0
#define SFG_WEAPON_SHOTGUN 1
#define SFG_WEAPON_MACHINE_GUN 2
#define SFG_WEAPON_ROCKET_LAUNCHER 3
#define SFG_WEAPON_PLASMAGUN 4
#define SFG_WEAPON_SOLUTION 5
#define SFG_WEAPONS_TOTAL 6
#define SFG_WEAPON_ATTRIBUTE(fireType,projectileCount,fireCooldownMs) \
((uint8_t) (fireType | ((projectileCount - 1) << 2) | ((fireCooldownMs / (SFG_MS_PER_FRAME * 16)) << 4)))
#define SFG_GET_WEAPON_FIRE_TYPE(weaponNumber) \
(SFG_weaponAttributeTable[weaponNumber] & 0x03)
#define SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(weaponNumber) \
((SFG_weaponAttributeTable[weaponNumber] >> 4) * 16)
#define SFG_GET_WEAPON_PROJECTILE_COUNT(weaponNumber) \
(((SFG_weaponAttributeTable[weaponNumber] >> 2) & 0x03) + 1)
#define SFG_MIN_WEAPON_COOLDOWN_FRAMES 8
#define SFG_WEAPON_FIRE_TYPE_MELEE 0
#define SFG_WEAPON_FIRE_TYPE_BULLET 1
#define SFG_WEAPON_FIRE_TYPE_FIREBALL 2
#define SFG_WEAPON_FIRE_TYPE_PLASMA 3
#define SFG_WEAPON_FIRE_TYPES_TOTAL 4
/**
Table of weapon attributes, each as a byte in format:
MSB ccccnnff LSB
ff: fire type
nn: number of projectiles - 1
cccc: fire cooldown in frames, i.e. time after which the next shot can be
shot again, ccccc has to be multiplied by 16 to get the real value
*/
SFG_PROGRAM_MEMORY uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] =
{
/* knife */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_MELEE,1,650), // DPS: 6.2
/* shotgun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,2,1250), // DPS: 12.8
/* m. gun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,1,700), // DPS: 11.4
/* r. laun. */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_FIREBALL,1,850), // DPS: 28.2
/* plasma */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,1,550), // DPS: 32.7
/* solution */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,4,1050) // DPS: 85.7
};
SFG_PROGRAM_MEMORY uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] =
{
/* melee */ 4,
/* bullet */ 8,
/* explostion (fireball) */ 24,
/* plasma */ 18
};
#define SFG_PROJECTILE_EXPLOSION 0
#define SFG_PROJECTILE_FIREBALL 1
#define SFG_PROJECTILE_PLASMA 2
#define SFG_PROJECTILE_DUST 3
#define SFG_PROJECTILE_BULLET 4
#define SFG_PROJECTILE_NONE 255
#define SFG_PROJECTILES_TOTAL 5
#define SFG_PROJECTILE_ATTRIBUTE(speedSquaresPerSec,timeToLiveMs) \
((uint8_t) \
((((speedSquaresPerSec / 4 == 0) && (speedSquaresPerSec != 0)) ? 1 : speedSquaresPerSec / 4) | \
((timeToLiveMs / (8 * SFG_MS_PER_FRAME)) << 3)))
#define SFG_GET_PROJECTILE_SPEED_UPS(projectileNumber) \
(((SFG_projectileAttributeTable[projectileNumber] & 0x07) * 4 * RCL_UNITS_PER_SQUARE) / SFG_FPS)
#define SFG_GET_PROJECTILE_FRAMES_TO_LIVE(projectileNumber) \
((SFG_projectileAttributeTable[projectileNumber] >> 3) * 8)
/**
Table of projectile attributes, each as a byte in format:
MSB lllllsss LSB
fff: half speed in game squares per second
lllll: eigth of frames to live
*/
#define LOW_FPS (SFG_FPS < 24) ///< low FPS needs low speeds, because collisions
SFG_PROGRAM_MEMORY uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] =
{
/* explosion */ SFG_PROJECTILE_ATTRIBUTE(0,400),
/* fireball */ SFG_PROJECTILE_ATTRIBUTE(10,1000),
#if LOW_FPS
/* plasma */ SFG_PROJECTILE_ATTRIBUTE(17,500),
#else
/* plasma */ SFG_PROJECTILE_ATTRIBUTE(18,500),
#endif
/* dust */ SFG_PROJECTILE_ATTRIBUTE(0,450),
#if LOW_FPS
/* bullet */ SFG_PROJECTILE_ATTRIBUTE(17,1000)
#else
/* bullet */ SFG_PROJECTILE_ATTRIBUTE(28,1000)
#endif
};
#undef LOW_FPS
#endif // guard

587
main_gbmeta/demo.h Normal file
View File

@ -0,0 +1,587 @@
/**
@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

4862
main_gbmeta/game.h Executable file

File diff suppressed because it is too large Load Diff

1397
main_gbmeta/images.h Normal file

File diff suppressed because it is too large Load Diff

1809
main_gbmeta/levels.h Normal file

File diff suppressed because it is too large Load Diff

173
main_gbmeta/main_gbmeta.ino Normal file
View File

@ -0,0 +1,173 @@
/**
@file main_gbmeta.ino
This is Gamebuino Meta implementation of the game front end, using the
official library. Leaving out the library bloat could probably optimize this.
To compile using Arduin IDE you need to copy this file as well as all
necessary .h files into a project folder, then open the project and compile.
Do NOT put .c and .cpp files into the folder, stupid Arduino tries to compile
them even if they're not needed.
DON'T FORGET to set compiler flag to -O3 (default is -Os). With Arduino IDE
this is done in platform.txt file.
by Miloslav Ciz (drummyfish), 2019
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
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#include <Gamebuino-Meta.h>
#define SFG_ARDUINO 1
#define SFG_CAN_EXIT 0
#define SFG_FPS 17
#define SFG_SCREEN_RESOLUTION_X 80
#define SFG_SCREEN_RESOLUTION_Y 64
#define SFG_RESOLUTION_SCALEDOWN 1
#define SFG_RAYCASTING_MAX_STEPS 11
#define SFG_RAYCASTING_MAX_HITS 3
#define SFG_RAYCASTING_SUBSAMPLE 2
#define SFG_DIMINISH_SPRITES 0
#define SFG_DITHERED_SHADOW 0
#define SFG_PLAYER_TURN_SPEED 135
#define SFG_FOV_HORIZONTAL 200
#include "game.h"
Gamebuino_Meta::Color palette[256];
uint8_t blinkFramesLeft;
void blinkLED(Gamebuino_Meta::Color color)
{
gb.lights.fill(color);
blinkFramesLeft = 5;
}
const Gamebuino_Meta::SaveDefault saveDefault[] =
{ { 0, SAVETYPE_BLOB, SFG_SAVE_SIZE, 0 } };
void SFG_setPixel(uint16_t x, uint16_t y, uint8_t colorIndex)
{
Gamebuino_Meta::Color c = palette[colorIndex];
gb.display.drawPixel(x,y,c);
}
void SFG_sleepMs(uint16_t timeMs)
{
}
int8_t SFG_keyPressed(uint8_t key)
{
Gamebuino_Meta::Button button;
switch (key)
{
case SFG_KEY_UP: button = BUTTON_UP; break;
case SFG_KEY_RIGHT: button = BUTTON_RIGHT; break;
case SFG_KEY_DOWN: button = BUTTON_DOWN; break;
case SFG_KEY_LEFT: button = BUTTON_LEFT; break;
case SFG_KEY_A: button = BUTTON_A; break;
case SFG_KEY_B: button = BUTTON_B; break;
case SFG_KEY_C: button = BUTTON_MENU; break;
default: return 0; break;
}
return gb.buttons.timeHeld(button) > 0;
}
void SFG_processEvent(uint8_t event, uint8_t value)
{
switch (event)
{
case SFG_EVENT_LEVEL_STARTS: blinkLED(BLUE); break;
case SFG_EVENT_PLAYER_HURT: blinkLED(RED); break;
case SFG_EVENT_LEVEL_WON: blinkLED(YELLOW); break;
default: break;
}
}
void SFG_getMouseOffset(int16_t *x, int16_t *y)
{
}
void SFG_setMusic(uint8_t value)
{
}
void SFG_save(uint8_t data[SFG_SAVE_SIZE])
{
gb.save.set(0,data,SFG_SAVE_SIZE);
}
uint8_t SFG_load(uint8_t data[SFG_SAVE_SIZE])
{
gb.save.get(0,data,SFG_SAVE_SIZE);
return 1;
}
void SFG_playSound(uint8_t soundIndex, uint8_t volume)
{
switch (soundIndex)
{
case 2:
gb.sound.playCancel();
break;
case 5:
gb.sound.playOK();
break;
default:
gb.sound.playTick();
break;
}
}
uint32_t SFG_getTimeMs()
{
return gb.frameStartMicros / 1000;
}
void setup()
{
gb.begin();
gb.setFrameRate(SFG_FPS);
gb.save.config(saveDefault);
for (int i = 0; i < 256; ++i)
{
uint16_t rgb565 = paletteRGB565[i];
palette[i] = gb.createColor((rgb565 & 0xf800) >> 8,(rgb565 & 0x07e0) >> 3,(rgb565 & 0x001f) << 3);
}
SFG_init();
blinkLED(RED);
}
void loop()
{
while(!gb.update())
{
}
if (blinkFramesLeft != 0)
{
if (blinkFramesLeft == 1)
gb.lights.clear();
blinkFramesLeft--;
}
SFG_mainLoopBody();
#if 0
// debuggin performance
gb.display.setCursor(1,1);
gb.display.print(gb.getCpuLoad());
#endif
}

Binary file not shown.

25
main_gbmeta/mbed_config.h Normal file
View File

@ -0,0 +1,25 @@
/*
* mbed SDK
* Copyright (c) 2017 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Automatically generated configuration file.
// DO NOT EDIT, content will be overwritten.
#ifndef __MBED_CONFIG_DATA__
#define __MBED_CONFIG_DATA__
#endif

98
main_gbmeta/palette.h Normal file
View File

@ -0,0 +1,98 @@
/*
@file palette.h
General purpose HSV-based 256 color palette.
by Miloslav Ciz (drummyfish), 2019
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
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#ifndef PALETTE_256_H
#define PALETTE_256_H
SFG_PROGRAM_MEMORY uint16_t paletteRGB565[256] = {
#if 1
// manually adjusted, more saturated palette
0, 6371, 14855, 27436, 38066, 48631, 59228, 65535, 6241, 14563, 24966, 33320,
43755, 52142, 62577, 64885, 6337, 16772, 25190, 35689, 44139, 52559, 63058,
65333, 6402, 14851, 23334, 31816, 40268, 50830, 59314, 65526, 4354, 10755,
15174, 21576, 30027, 36462, 42929, 51190, 2306, 8709, 13096, 19532, 25935,
30323, 36790, 47098, 4356, 8711, 15115, 19536, 27956, 32377, 38846, 47103,
4227, 8519, 12812, 17136, 25588, 31961, 38334, 46751, 2115, 8424, 14732, 21040,
27380, 33721, 40030, 48511, 6244, 12520, 22924, 31280, 39669, 48089, 56445,
64927, 8290, 16614, 24969, 33325, 43761, 52148, 62585, 64892, 10240, 18464,
26657, 38946, 47202, 55524, 63781, 64074, 10400, 18753, 27170, 37601, 48034,
56421, 64837, 65002, 6496, 14944, 23425, 31937, 40418, 48869, 57317, 61418,
352, 4704, 7041, 7362, 15842, 20196, 24550, 30697, 354, 611, 2949, 5288, 7658,
12013, 8175, 20467, 357, 617, 910, 5298, 9686, 7931, 14335, 24575, 69, 233,
4461, 4594, 8918, 2907, 13311, 19679, 4133, 2089, 4173, 8306, 10455, 16667,
20863, 27263, 6149, 14377, 22574, 28819, 39063, 45371, 53631, 57983, 10242,
18469, 26664, 38987, 47247, 55537, 63797, 64119, 10272, 18432, 26624, 34848,
45056, 53312, 61504, 63520, 10336, 18624, 26976, 35296, 45728, 54048, 62400,
64609, 8544, 16992, 25440, 31872, 42400, 50880, 59328, 65504, 4448, 2656,
7008, 11392, 13728, 14016, 20416, 26593, 2400, 608, 864, 3200, 5504, 1698,
1985, 2019, 353, 614, 872, 1163, 1422, 1713, 2005, 2039, 197, 361, 557, 753,
950, 5273, 1406, 9759, 5, 9, 2093, 81, 4214, 186, 2270, 351, 2052, 4105, 4109,
8209, 8278, 12314, 16414, 18527, 10245, 14378, 22541, 30738, 38934, 47130, 55326,
61471, 10241, 18435, 26630, 34824, 45066, 53293, 61519, 63601
#else
// original palette
0, 8484, 19017, 27501, 38034, 46518, 57051, 65535, 8354, 16709, 25096, 33450,
41805, 50192, 58546, 64853, 8386, 16805, 25224, 33642, 42061, 50480, 58898,
65269, 6402, 14853, 23304, 29706, 38157, 46608, 55058, 61429, 4354, 10757,
17160, 23562, 29965, 36368, 42770, 49141, 4355, 10758, 17161, 21516, 27920,
34323, 38678, 45049, 4323, 10759, 17163, 21519, 27923, 34327, 38683, 45055,
4292, 10632, 17004, 21296, 27668, 34008, 38300, 44671, 4260, 10568, 16908,
23216, 29524, 35864, 42172, 48479, 6308, 14664, 23052, 29360, 37716, 46104,
54460, 60767, 8355, 16710, 25098, 33453, 41809, 50196, 58552, 64859, 8257,
16546, 24836, 33093, 41382, 49672, 57929, 64170, 8353, 16738, 25124, 33509,
41894, 50248, 58633, 64970, 6401, 12802, 21252, 27653, 36102, 42504, 50953,
57322, 2305, 6658, 11012, 15365, 19718, 24072, 28425, 32746, 2306, 4612, 8967,
11273, 13580, 17934, 20240, 22515, 2307, 4615, 8971, 11279, 13587, 17943, 20251,
22527, 2180, 4392, 8652, 10864, 13076, 17304, 19516, 21727, 2116, 6312, 10508,
14672, 18868, 23064, 25180, 29375, 6212, 12456, 20748, 26960, 35252, 41496,
49756, 55999, 8258, 16549, 24840, 33099, 41390, 49681, 57940, 64183, 8192,
16384, 24576, 32768, 40960, 49152, 57344, 63488, 8320, 16640, 24960, 33312,
41632, 49952, 58304, 64576, 6400, 14848, 23296, 29696, 38144, 46592, 52992,
61408, 2304, 6656, 8960, 13312, 15616, 19968, 22272, 26592, 256, 513, 769, 1026,
1283, 1539, 1796, 2021, 258, 517, 776, 1035, 1294, 1552, 1811, 2038, 164, 360,
556, 752, 948, 1144, 1308, 1503, 36, 104, 140, 208, 244, 312, 348, 415, 2052,
4104, 8204, 10256, 14356, 16408, 18460, 22559, 6148, 14344, 20492, 28688, 34836,
43032, 51228, 57375, 8194, 16388, 24582, 32777, 40971, 49165, 57359, 63505
#endif
};
/** Adds value (brightness), possibly negative, to given color (represented by
its palette index). If you know you'll only be either adding or substracting,
use plusValue() or minusValue() functions, which should be faster. */
static inline uint8_t palette_addValue(uint8_t color, int8_t add)
{
uint8_t newValue = color + add;
if ((newValue >> 3) == (color >> 3))
return newValue;
else
return add > 0 ? (color | 0x07) : 0;
}
/** Adds a positive value (brightness) to given color (represented by its
palette index). This should be a little bit faster than addValue(). */
static inline uint8_t palette_plusValue(uint8_t color, uint8_t plus)
{
uint8_t newValue = color + plus;
return ((newValue >> 3) == (color >> 3)) ? newValue : (color | 0x07);
}
/** Substracts a positive value (brightness) from given color (represented by
its palette index). This should be a little bit faster than addValue(). */
static inline uint8_t palette_minusValue(uint8_t color, uint8_t minus)
{
uint8_t newValue = color - minus;
return ((newValue >> 3) == (color >> 3)) ? newValue : 0;
}
#endif //guard

2058
main_gbmeta/raycastlib.h Normal file

File diff suppressed because it is too large Load Diff

447
main_gbmeta/settings.h Normal file
View File

@ -0,0 +1,447 @@
/**
@file settings.h
This file contains settings (or setting hints) for the game. Values here can
fine tune performance vs quality and personalize the final compiled game. Some
of these settings may be overriden by the specific platform used according to
its limitations. You are advised to NOT change value in this file directly,
but rather predefine them somewhere before this file gets included, e.g. in
you personal settings file.
by Miloslav Ciz (drummyfish), 2019
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
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#ifndef _SFG_SETTINGS_H
#define _SFG_SETTINGS_H
/**
Time multiplier in SFG_Units (1.0 == 1024). This can be used to slow down or
speed up the game. Note that this also changes the rendering FPS accordingly
(e.g. half FPS at half speed), so if you want to keep the FPS, divide it by
the multiplier value.
*/
#ifndef SFG_TIME_MULTIPLIER
#define SFG_TIME_MULTIPLIER 1024
#endif
/**
Target FPS (frames per second). This sets the game logic FPS and will try to
render at the same rate. If such fast rendering can't be achieved, frames will
be droped, but the game logic will still be forced to run at this speed, so
the game may actually become slowed down if FPS is set too high. Too high or
too low FPS can also negatively affect game speeds which are computed as
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
simulation step length, so different FPS values may result in very slight
differences in game behavior (not noticeable but affecting demos etc.).
*/
#ifndef SFG_FPS
#define SFG_FPS 60
#endif
/**
On platforms with mouse this sets its horizontal sensitivity. 128 means 1
RCL_Unit per mouse pixel travelled.
*/
#ifndef SFG_MOUSE_SENSITIVITY_HORIZONTAL
#define SFG_MOUSE_SENSITIVITY_HORIZONTAL 32
#endif
/**
Like SFG_MOUSE_SENSITIVITY_HORIZONTAL but for vertical look. 128 means 1
shear pixel per mouse pixel travelled.
*/
#ifndef SFG_MOUSE_SENSITIVITY_VERTICAL
#define SFG_MOUSE_SENSITIVITY_VERTICAL 64
#endif
/**
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
SFG_RESOLUTION_SCALEDOWN;
*/
#ifndef SFG_SCREEN_RESOLUTION_X
#define SFG_SCREEN_RESOLUTION_X 800
#endif
/**
Height 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
SFG_RESOLUTION_SCALEDOWN;
*/
#ifndef SFG_SCREEN_RESOLUTION_Y
#define SFG_SCREEN_RESOLUTION_Y 600
#endif
/**
How quickly player turns left/right, in degrees per second.
*/
#ifndef SFG_PLAYER_TURN_SPEED
#define SFG_PLAYER_TURN_SPEED 180
#endif
/**
Horizontal FOV (field of vision) in RCL_Units (1024 means 360 degrees).
*/
#ifndef SFG_FOV_HORIZONTAL
#define SFG_FOV_HORIZONTAL 256
#endif
/**
Like SFG_FOV_HORIZONTAL but for vertical angle.
*/
#ifndef SFG_FOV_VERTICAL
#define SFG_FOV_VERTICAL 330
#endif
/**
Distance, in RCL_Units, to which textures will be drawn. Textures behind this
distance will be replaced by an average constant color, which maybe can help
performance and also serves as an antialiasim (2 level MIP map). Value 0 turns
texturing completely off, which is much faster than having just a low value,
values >= 65535 activate texturing completely, which can be a little faster
than setting having a high value lower than this limit.
*/
#ifndef SFG_TEXTURE_DISTANCE
#define SFG_TEXTURE_DISTANCE 100000
#endif
/**
How many times the screen resolution will be divided (how many times a game
pixel will be bigger than the screen pixel).
*/
#ifndef SFG_RESOLUTION_SCALEDOWN
#define SFG_RESOLUTION_SCALEDOWN 1
#endif
/**
Multiplier, in RCL_Units (1024 == 1.0), of the damager player takes. This can
be used to balance difficulty.
*/
#ifndef SFG_PLAYER_DAMAGE_MULTIPLIER
#define SFG_PLAYER_DAMAGE_MULTIPLIER 512
#endif
/**
Hint as to whether run in fullscreen, if the platform allows it.
*/
#ifndef SFG_FULLSCREEN
#define SFG_FULLSCREEN 0
#endif
/**
Whether shadows (fog) should be dithered, i.e. more smooth (needs a bit more
CPU performance and memory).
*/
#ifndef SFG_DITHERED_SHADOW
#define SFG_DITHERED_SHADOW 0
#endif
/**
Depth step (in RCL_Units) after which fog diminishes a color by one value
point. For performance reasons this number should be kept a power of two!
*/
#ifndef SFG_FOG_DIMINISH_STEP
#define SFG_FOG_DIMINISH_STEP 2048
#endif
/**
Maximum number of squares that will be traversed by any cast ray. Smaller
number is faster but can cause visual artifacts.
*/
#ifndef SFG_RAYCASTING_MAX_STEPS
#define SFG_RAYCASTING_MAX_STEPS 30
#endif
/**
Maximum number of hits any cast ray will register. Smaller number is faster
but can cause visual artifacts.
*/
#ifndef SFG_RAYCASTING_MAX_HITS
#define SFG_RAYCASTING_MAX_HITS 10
#endif
/**
How many times rendering should be subsampled horizontally. Bigger number
can significantly improve performance (by casting fewer rays), but can look
a little worse. This number should be a divisor of SFG_SCREEN_RESOLUTION_X!
*/
#ifndef SFG_RAYCASTING_SUBSAMPLE
#define SFG_RAYCASTING_SUBSAMPLE 1
#endif
/**
Enables or disables fog (darkness) due to distance. Recommended to keep on
for good look, but can be turned off for performance.
*/
#ifndef SFG_ENABLE_FOG
#define SFG_ENABLE_FOG 1
#endif
/**
Says whether sprites should diminish in fog. This takes more performance but
looks better.
*/
#ifndef SFG_DIMINISH_SPRITES
#define SFG_DIMINISH_SPRITES 1
#endif
/**
How quick player head bob is, 1024 meaning once per second. 0 Means turn off
head bob.
*/
#ifndef SFG_HEADBOB_SPEED
#define SFG_HEADBOB_SPEED 900
#endif
/**
Sets head bob offset, in RCL_UNITS_PER_SQUARE. 0 Means turn off head bob.
*/
#ifndef SFG_HEADBOB_OFFSET
#define SFG_HEADBOB_OFFSET 200
#endif
/**
If head bob is on, this additionally sets additional camera shear bob, in
pixels, which can make bobbing look more "advanced". 0 turns this option off.
*/
#ifndef SFG_HEADBOB_SHEAR
#define SFG_HEADBOB_SHEAR 0
#endif
/**
Weapon bobbing offset in weapon image pixels.
*/
#ifndef SFG_WEAPONBOB_OFFSET
#define SFG_WEAPONBOB_OFFSET 4
#endif
/**
Camera shearing (looking up/down) speed, in vertical resolutions per second.
*/
#ifndef SFG_CAMERA_SHEAR_SPEED
#define SFG_CAMERA_SHEAR_SPEED 3
#endif
/**
Maximum camera shear (vertical angle). 1024 means 1.0 * vertical resolution.
*/
#ifndef SFG_CAMERA_MAX_SHEAR
#define SFG_CAMERA_MAX_SHEAR 1024
#endif
/**
Specifies how quick some sprite animations are, in frames per second.
*/
#ifndef SFG_SPRITE_ANIMATION_SPEED
#define SFG_SPRITE_ANIMATION_SPEED 4
#endif
/**
How wide the border indicator is, in fractions of screen width.
*/
#ifndef SFG_HUD_BORDER_INDICATOR_WIDTH
#define SFG_HUD_BORDER_INDICATOR_WIDTH 32
#endif
/**
For how long border indication (being hurt etc.) stays shown, in ms.
*/
#ifndef SFG_HUD_BORDER_INDICATOR_DURATION
#define SFG_HUD_BORDER_INDICATOR_DURATION 500
#endif
/**
Color (palette index) by which being hurt is indicated.
*/
#ifndef SFG_HUD_HURT_INDICATION_COLOR
#define SFG_HUD_HURT_INDICATION_COLOR 175
#endif
/**
Color (palette index) by which taking an item is indicated.
*/
#ifndef SFG_HUD_ITEM_TAKEN_INDICATION_COLOR
#define SFG_HUD_ITEM_TAKEN_INDICATION_COLOR 207
#endif
/**
How many element (items, monsters, ...) distances will be checked per frame
for distance. Higher value may decrease performance a tiny bit, but things
will react more quickly and appear less "out of thin air".
*/
#ifndef SFG_ELEMENT_DISTANCES_CHECKED_PER_FRAME
#define SFG_ELEMENT_DISTANCES_CHECKED_PER_FRAME 8
#endif
/**
Maximum distance at which sound effects (SFX) will be played. The SFX volume
will gradually drop towards this distance.
*/
#ifndef SFG_SFX_MAX_DISTANCE
#define SFG_SFX_MAX_DISTANCE (1024 * 60)
#endif
/**
Says the intensity of background image blur. 0 means no blur, improves
performance and lowers memory usage.
*/
#ifndef SFG_BACKGROUND_BLUR
#define SFG_BACKGROUND_BLUR 0
#endif
/**
Defines the period, in ms, of things that blink, such as text.
*/
#ifndef SFG_BLINK_PERIOD
#define SFG_BLINK_PERIOD 500
#endif
/**
Probability (0 - 255) of how often a monster makes sound during movement.
*/
#ifndef SFG_MONSTER_SOUND_PROBABILITY
#define SFG_MONSTER_SOUND_PROBABILITY 64
#endif
/**
Affects how precise monsters are in aiming, specify random range in
fourths of a game square. Should be power of 2 for performance.
*/
#ifndef SFG_MONSTER_AIM_RANDOMNESS
#define SFG_MONSTER_AIM_RANDOMNESS 4
#endif
/// Color 1 index of player on map.
#ifndef SFG_MAP_PLAYER_COLOR1
#define SFG_MAP_PLAYER_COLOR1 93
#endif
/// Color 2 index of player on map.
#ifndef SFG_MAP_PLAYER_COLOR2
#define SFG_MAP_PLAYER_COLOR2 111
#endif
/// Color index of elevators on map.
#ifndef SFG_MAP_ELEVATOR_COLOR
#define SFG_MAP_ELEVATOR_COLOR 214
#endif
/// Color index of squeezers on map.
#ifndef SFG_MAP_SQUEEZER_COLOR
#define SFG_MAP_SQUEEZER_COLOR 246
#endif
/// Color index of door on map.
#ifndef SFG_MAP_DOOR_COLOR
#define SFG_MAP_DOOR_COLOR 188
#endif
/**
Boolean value indicating whether current OS is malware.
*/
#ifndef SFG_OS_IS_MALWARE
#define SFG_OS_IS_MALWARE 0
#endif
/**
Angle difference, as a cos value in RCL_Units, between the player and a
monster, at which vertical autoaim will trigger. If the angle is greater, a
shot will go directly forward.
*/
#ifndef SFG_VERTICAL_AUTOAIM_ANGLE_THRESHOLD
#define SFG_VERTICAL_AUTOAIM_ANGLE_THRESHOLD 50
#endif
/**
Byte (0 - 255) volume of the menu click sound.
*/
#ifndef SFG_MENU_CLICK_VOLUME
#define SFG_MENU_CLICK_VOLUME 220
#endif
/**
Says whether the exit item should be showed in the menu. Platforms that can't
exit (such as some gaming consoles that simply use power off button) can
define this to 0.
*/
#ifndef SFG_CAN_EXIT
#define SFG_CAN_EXIT 1
#endif
/**
On Arduino platforms this should be set to 1. That will cause some special
treatment regarding constant variables and PROGMEM.
*/
#ifndef SFG_ARDUINO
#define SFG_ARDUINO 0
#endif
/**
Whether levels background (in distance or transparent wall textures) should
be drawn. If turned off, the background will be constant color, which can
noticably increase performance.
*/
#ifndef SFG_DRAW_LEVEL_BACKGROUND
#define SFG_DRAW_LEVEL_BACKGROUND 1
#endif
//------ developer/debug settings ------
/**
Developer cheat for having infinite ammo in all weapons.
*/
#ifndef SFG_INFINITE_AMMO
#define SFG_INFINITE_AMMO 0
#endif
/**
Developer cheat for immortality.
*/
#ifndef SFG_IMMORTAL
#define SFG_IMMORTAL 0
#endif
/**
Turn on for previes mode for map editing (flying, noclip, fast movement etc.).
*/
#ifndef SFG_PREVIEW_MODE
#define SFG_PREVIEW_MODE 0
#endif
/**
How much faster movement is in the preview mode.
*/
#ifndef SFG_PREVIEW_MODE_SPEED_MULTIPLIER
#define SFG_PREVIEW_MODE_SPEED_MULTIPLIER 2
#endif
/**
Skips menu and starts given level immediatelly, for development. 0 means this
options is ignored, 1 means load level 1 etc.
*/
#ifndef SFG_START_LEVEL
#define SFG_START_LEVEL 0
#endif
/**
Reveals whole level map from start.
*/
#ifndef SFG_REVEAL_MAP
#define SFG_REVEAL_MAP 0
#endif
/**
Gives player all keys from start.
*/
#ifndef SFG_UNLOCK_DOOR
#define SFG_UNLOCK_DOOR 0
#endif
#endif // guard

404
main_gbmeta/smallinput.h Normal file
View File

@ -0,0 +1,404 @@
/**
@file smallinput.h
Small API for getting keyboard/mouse input, with possiblity to record it and
play back.
The Linux Input API requires root pirivileges (sudo).
by Milsolav "drummyfish" Ciz, released under CC0 1.0 (public domain)
*/
#ifndef _SMALLINPUT_H
#define _SMALLINPUT_H
#include <stdint.h>
#include <stdio.h>
#define SMALLINPUT_MODE_NORMAL 0 ///< Only handle input.
#define SMALLINPUT_MODE_RECORD 1 ///< Handle input and record it.
#define SMALLINPUT_MODE_PLAY 2 ///< Play back recorded input.
#define SMALLINPUT_KEY_NONE 0
#define SMALLINPUT_SPACE ' '
#define SMALLINPUT_BACKSPACE 8
#define SMALLINPUT_TAB 9
#define SMALLINPUT_RETURN 13
#define SMALLINPUT_SHIFT 14
#define SMALLINPUT_ESCAPE 27
#define SMALLINPUT_DELETE 127
#define SMALLINPUT_ARROW_UP 128
#define SMALLINPUT_ARROW_RIGHT 129
#define SMALLINPUT_ARROW_DOWN 130
#define SMALLINPUT_ARROW_LEFT 131
#define SMALLINPUT_F1 132
#define SMALLINPUT_F2 133
#define SMALLINPUT_F3 134
#define SMALLINPUT_F4 135
#define SMALLINPUT_F5 136
#define SMALLINPUT_F6 137
#define SMALLINPUT_F7 138
#define SMALLINPUT_F8 139
#define SMALLINPUT_F9 140
#define SMALLINPUT_F10 141
#define SMALLINPUT_F11 142
#define SMALLINPUT_F12 143
#define SMALLINPUT_CTRL 144
#define SMALLINPUT_MOUSE_L 253
#define SMALLINPUT_MOUSE_M 254
#define SMALLINPUT_MOUSE_R 255
#define SMALLINPUT_RECORD_KEY_DOWN 1 ///< Mouse down event, followed by code.
#define SMALLINPUT_RECORD_KEY_UP 2 ///< Moue up event, followed by code.
#define SMALLINPUT_RECORD_MOUSE_X 3 ///< Mouse x move, followed by s32 value.
#define SMALLINPUT_RECORD_MOUSE_Y 4 ///< Mouse y move, followed by s32 value.
#define SMALLINPUT_RECORD_END 255 ///< Record end, followed by 4 more same values.
uint8_t input_keyStates[256];
int32_t input_mousePosition[2];
uint8_t input_keyStatesPrevious[256];
int32_t input_mousePositionPrevious[2];
uint8_t input_mode;
uint32_t input_frame = 0;
uint8_t *input_recordData;
uint32_t input_recordPosition;
uint32_t input_recordSize;
#if 1 // TODO: add other options for input handling (SDL, xinput, ...)
/*
This is using Linux Input Subsystem API. Defines can be found in
include/uapi/linux/input-event-codes.h.
*/
#include <fcntl.h>
#include <linux/input.h>
#include <sys/time.h>
#include <unistd.h>
typedef struct
{
struct timeval time;
uint16_t type;
uint16_t code;
int32_t value;
} LinuxInputEvent;
#define INPUT_KEYBOARD_FILE "/dev/input/event0"
#define INPUT_MOUSE_FILE "/dev/input/event1"
int input_keyboardFile = 0;
int input_mouseFile = 0;
/**
Maps this library's key codes to linux input key codes.
*/
static const int input_linuxCodes[256] =
{
#define no KEY_RESERVED
no,no,no,no,no,no,no,no,KEY_BACKSPACE,KEY_TAB,no,no,no,KEY_ENTER,KEY_LEFTSHIFT,no,
no,no,no,no,no,no,no,no,no,no,no,KEY_ESC,no,no,no,no,
KEY_SPACE,no,no,no,no,no,no,no,no,no,no,no,KEY_COMMA,no,KEY_DOT,no,
KEY_0,KEY_1,KEY_2,KEY_3,KEY_4,KEY_5,KEY_6,KEY_7,KEY_8,KEY_9,no,KEY_SEMICOLON,no,KEY_EQUAL,no,KEY_QUESTION,
no,KEY_A,KEY_B,KEY_C,KEY_D,KEY_E,KEY_F,KEY_G,KEY_H,KEY_I,KEY_J,KEY_K,KEY_L,KEY_M,KEY_N,KEY_O,
KEY_P,KEY_Q,KEY_R,KEY_S,KEY_T,KEY_U,KEY_V,KEY_W,KEY_X,KEY_Y,KEY_Z,no,no,no,no,no,
no,KEY_A,KEY_B,KEY_C,KEY_D,KEY_E,KEY_F,KEY_G,KEY_H,KEY_I,KEY_J,KEY_K,KEY_L,KEY_M,KEY_N,KEY_O,
KEY_P,KEY_Q,KEY_R,KEY_S,KEY_T,KEY_U,KEY_V,KEY_W,KEY_X,KEY_Y,KEY_Z,no,no,no,no,KEY_DELETE,
KEY_UP,KEY_RIGHT,KEY_DOWN,KEY_LEFT,KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12,
KEY_LEFTCTRL,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,
no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,
no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,
no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,
no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,
no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,
no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no
#undef no
};
#endif
void input_recordU8(uint8_t value)
{
if (input_recordPosition < (input_recordSize - 1))
{
input_recordData[input_recordPosition] = value;
input_recordPosition++;
}
}
void input_recordU32(uint32_t value)
{
for (uint8_t i = 0; i < 4; ++i)
{
input_recordU8(value % 256);
value /= 256;
}
}
uint32_t input_readU32(uint8_t *data)
{
uint32_t result = 0;
for (uint8_t i = 0; i < 4; ++i)
result = result * 256 + data[3 - i];
return result;
}
/**
Initializes the library with given mode (SMALLINPUT_MODE_*).
*/
uint8_t input_init(uint8_t mode, uint8_t *recordData, uint32_t recordDataLength)
{
input_mode = mode;
input_mousePosition[0] = 0;
input_mousePosition[1] = 0;
input_mousePositionPrevious[0] = 0;
input_mousePositionPrevious[1] = 0;
input_frame = 0;
input_recordData = recordData;
input_recordPosition = 0;
input_recordSize = recordDataLength;
for (int16_t i = 0; i < 256; ++i)
{
input_keyStates[i] = 0;
input_keyStatesPrevious[i] = 0;
}
uint8_t result = 1;
if (input_mode != SMALLINPUT_MODE_PLAY)
{
input_keyboardFile = open(INPUT_KEYBOARD_FILE, O_RDONLY);
result = input_keyboardFile >= 0;
if (result)
{
fcntl(input_keyboardFile, F_SETFL, O_NONBLOCK);
input_mouseFile = open(INPUT_MOUSE_FILE, O_RDONLY);
result = input_mouseFile >= 0;
if (result)
fcntl(input_mouseFile, F_SETFL, O_NONBLOCK);
}
if (!result)
puts("could not open device file (are you root?)");
}
return result;
}
void input_end(void)
{
if (input_mode == SMALLINPUT_MODE_RECORD)
for (uint8_t i = 0; i < 5; ++i)
input_recordU8(SMALLINPUT_RECORD_END);
close(input_keyboardFile);
close(input_mouseFile);
}
/**
Should be called once every main loop iteration to retrieve current input
state.
*/
void input_update(void)
{
LinuxInputEvent event;
if (input_mode == SMALLINPUT_MODE_PLAY)
{
while (input_recordPosition < input_recordSize)
{
uint32_t nextFrame = input_readU32(input_recordData + input_recordPosition);
if (input_frame >= nextFrame)
{
input_recordPosition += 4;
uint8_t rec = input_recordData[input_recordPosition];
switch (rec)
{
case SMALLINPUT_RECORD_KEY_DOWN:
case SMALLINPUT_RECORD_KEY_UP:
input_recordPosition++;
input_keyStates[input_recordData[input_recordPosition]] = rec == SMALLINPUT_RECORD_KEY_DOWN;
input_recordPosition++;
break;
case SMALLINPUT_RECORD_MOUSE_X:
case SMALLINPUT_RECORD_MOUSE_Y:
input_recordPosition++;
input_mousePosition[rec == SMALLINPUT_RECORD_MOUSE_Y] =
input_readU32(input_recordData + input_recordPosition);
input_recordPosition += 4;
break;
case SMALLINPUT_RECORD_END:
input_recordPosition = input_recordSize;
break;
default: /*printf("corrupt record\n");*/ break;
}
}
else
break;
}
}
else
{
while (1) // keyboard
{
if (read(input_keyboardFile, &event, sizeof(event)) <= 0)
break;
if (event.type == EV_KEY && (event.value == 1 || event.value == 0))
for (uint16_t i = 0; i < 256; ++i)
if (event.code == input_linuxCodes[i])
{
input_keyStates[i] = event.value;
break;
}
}
while (1) // mouse
{
if (read(input_mouseFile, &event, sizeof(event)) <= 0)
break;
if (event.type == EV_REL)
input_mousePosition[event.code % 2] += event.value;
else if (event.type == EV_KEY)
{
input_keyStates[
event.code == BTN_LEFT ? SMALLINPUT_MOUSE_L :
(event.code == BTN_RIGHT ? SMALLINPUT_MOUSE_R : SMALLINPUT_MOUSE_M)]
= event.value;
}
}
}
for (uint16_t i = 0; i < 256; ++i)
if (input_keyStates[i] && input_keyStates[i] < 255)
input_keyStates[i]++;
if (input_mode == SMALLINPUT_MODE_RECORD)
{
for (uint8_t i = 0; i < 2; ++i) // record mouse events
if (input_mousePositionPrevious[i] != input_mousePosition[i])
{
input_recordU32(input_frame + 1);
input_recordU8((i == 0) ? SMALLINPUT_RECORD_MOUSE_X : SMALLINPUT_RECORD_MOUSE_Y);
input_recordU32(input_mousePosition[i]);
input_mousePositionPrevious[i] = input_mousePosition[i];
}
for (uint16_t i = 0; i < 256; ++i) // record key events
{
uint8_t a = input_keyStates[i] > 0;
uint8_t b = input_keyStatesPrevious[i] > 0;
if (a != b)
{
input_recordU32(input_frame + 1);
input_recordU8(a ? SMALLINPUT_RECORD_KEY_DOWN : SMALLINPUT_RECORD_KEY_UP);
input_recordU8(i);
input_keyStatesPrevious[i] = input_keyStates[i];
}
}
}
input_frame++;
}
/**
Returns the number of input frames for which given key has been pressed (> 1:
key is pressed, == 1: key was just pressed, == 0: key is not pressed).
*/
static inline uint8_t input_getKey(uint8_t key)
{
if (key >= 'a' && key <= 'z')
key = 'A' + (key - 'a');
return input_keyStates[key];
}
/**
Gets the mouse position.
*/
static inline void input_getMousePos(int32_t *x, int32_t *y)
{
*x = input_mousePosition[0];
*y = input_mousePosition[1];
}
static inline void input_setMousePos(int32_t x, int32_t y)
{
input_mousePosition[0] = x;
input_mousePosition[1] = y;
}
/**
Prints the current input state.
*/
void input_print()
{
printf("frame: %d\nmouse pos: %d %d",input_frame,input_mousePosition[0],input_mousePosition[1]);
for (uint16_t i = 0; i < 256; ++i)
{
if (i % 8 == 0)
putchar('\n');
char c = (i > ' ' && i <= 126) ? i : '?';
uint8_t n = input_getKey(i);
printf("%s",n ? " [" : " ");
printf("%03d (\'%c\'): %03d",i,c,input_getKey(i));
printf("%s",n ? "] " : " ");
}
putchar('\n');
}
void input_printRecord()
{
for (uint32_t i = 0; i < input_recordPosition; ++i)
{
if (i % 32 == 0)
putchar('\n');
printf("%d,",input_recordData[i]);
}
}
uint32_t input_hash()
{
uint32_t result = 0;
for (uint16_t i = 0; i < 256; ++i)
result += input_getKey(i) * (i + 1);
int32_t x, y;
input_getMousePos(&x,&y);
result += x + y << 16;
return result;
}
#endif // guard

488
main_gbmeta/sounds.h Normal file
View File

@ -0,0 +1,488 @@
/**
@file assets.h
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
with 4 bit quantization, meaning every sound effect takes 1024 bytes. Sounds
can be converted using a provided python script like this:
python snd2array.py sound.raw
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/)
plus a waiver of all other intellectual property. The goal of this work is
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#ifndef _SFG_SOUNDS_H
#define _SFG_SOUNDS_H
#define SFG_SFX_SAMPLE_COUNT 2048
#define SFG_SFX_SIZE (SFG_SFX_SAMPLE_COUNT / 2)
/**
Gets a 8-bit sound sample.
*/
#define SFG_GET_SFX_SAMPLE(soundIndex,sampleIndex) \
((SFG_PROGRAM_MEMORY_U8(SFG_sounds + soundIndex * SFG_SFX_SIZE \
+ sampleIndex / 2) << (4 * ((sampleIndex % 2) != 0))) & 0xf0)
#define SFG_TRACK_SAMPLES (512 * 1024)
#define SFG_TRACK_COUNT 6
/**
Average value of each music track, can be used to correct DC offset issues if
they appear.
*/
SFG_PROGRAM_MEMORY uint8_t SFG_musicTrackAverages[SFG_TRACK_COUNT] =
{14,7,248,148,6,8};
struct
{ // all should be initialized to 0
uint8_t track;
uint32_t t; // time variable/parameter
uint32_t t2; // stores t squared, for better performance
uint32_t n11t; // stores a multiple of 11, for better performance
} SFG_MusicState;
/**
Gets the next 8bit 8KHz music sample for the bytebeat soundtrack. This
function is to be used by the frontend that plays music.
*/
uint8_t SFG_getNextMusicSample()
{
if (SFG_MusicState.t >= SFG_TRACK_SAMPLES)
{
SFG_MusicState.track++;
if (SFG_MusicState.track >= SFG_TRACK_COUNT)
SFG_MusicState.track = 0;
SFG_MusicState.t = 0;
SFG_MusicState.t2 = 0;
SFG_MusicState.n11t = 0;
}
uint32_t result;
#define S SFG_MusicState.t // can't use "T" because of a C++ template
#define S2 SFG_MusicState.t2
#define N11S SFG_MusicState.n11t
/* CAREFUL! Bit shifts in any direction by amount greater than data type
width (32) are undefined behavior. Use % 32. */
switch (SFG_MusicState.track) // individual music tracks
{
case 0:
{
uint32_t a = ((S >> 7) | (S >> 9) | (~S << 1) | S);
result = (((S) & 65536) ? (a & (((S2) >> 16) & 0x09)) : ~a);
SFG_MusicState.t2 += S;
break;
}
case 1:
{
uint32_t a = (S >> 10);
result = S & (3 << (((a ^ (a << ((S >> 6) % 32)))) % 32));
break;
}
case 2:
{
result =
~((((S >> ((S >> 2) % 32)) | (S >> ((S >> 5) % 32))) & 0x12) << 1)
| (S >> 11);
break;
}
case 3:
{
result =
(((((S >> ((S >> 2) % 32)) + (S >> ((S >> 7) % 32)))) & 0x3f) | (S >> 5)
| (S >> 11)) & ((S & (32768 | 8192)) ? 0xf0 : 0x30);
break;
}
case 4:
{
result =
((0x47 >> ((S >> 9) % 32)) & (S >> (S % 32))) |
(0x57 >> ((S >> 7) % 32)) |
(0x06 >> ((S >> ((((N11S) >> 14) & 0x0e) % 32)) % 32));
SFG_MusicState.n11t += 11;
break;
}
case 5:
{
uint32_t a = S >> ((S >> 6) % 32);
uint32_t b = 0x011121 >> (((a + S) >> 11) % 32);
result =
(((S >> 9) + (S ^ (S << 1))) & (0x7f >> (((S >> 15) & 0x03) % 32)))
& (b + a);
break;
}
default:
result = 127;
break;
}
#undef S
#undef S2
#undef N11S
SFG_MusicState.t += 1;
return result;
}
/**
Switches the bytebeat to next music track.
*/
void SFG_nextMusicTrack()
{
uint8_t current = SFG_MusicState.track;
while (SFG_MusicState.track == current)
SFG_getNextMusicSample();
}
SFG_PROGRAM_MEMORY uint8_t SFG_sounds[SFG_SFX_SIZE * 6] =
{
// 0, bullet shot
135,119,120,136,136,153,153,153,154,169,152,119,101,85,86,102,119,118,119,
85,84,51,33,52,52,84,87,120,170,188,202,152,102,84,84,70,119,136,119,
119,121,154,219,170,137,117,82,18,36,34,33,20,67,68,70,137,172,189,237,
220,150,120,120,97,36,102,121,151,87,169,118,86,102,120,137,135,120,186,155,
223,255,217,103,100,70,119,118,84,34,36,122,204,220,168,138,170,170,223,199,
117,70,119,136,100,85,102,51,37,101,103,118,101,136,87,154,169,171,187,186,
169,153,136,117,68,84,66,18,19,50,52,51,102,121,139,186,169,171,186,152,
153,136,119,134,85,101,86,69,84,84,86,85,86,102,119,120,153,135,135,101,
87,134,103,135,101,103,119,135,152,120,136,135,137,136,151,134,87,119,136,119,
118,102,85,119,85,102,102,119,138,137,153,137,186,170,137,152,135,101,85,85,
86,102,102,119,119,102,103,119,137,152,138,153,154,169,153,152,137,151,118,85,
85,84,84,86,86,136,119,119,154,153,153,171,187,170,170,187,170,137,151,119,
102,103,69,102,118,120,120,138,153,169,170,169,153,135,119,119,102,118,105,136,
136,137,152,153,136,152,119,119,119,119,121,152,136,119,152,136,135,120,119,118,
86,102,103,136,135,137,153,136,152,119,119,118,102,86,85,102,102,102,102,120,
136,136,136,136,152,136,153,152,119,119,120,135,120,119,119,103,119,136,119,135,
120,135,136,136,137,153,153,152,154,152,153,137,152,136,135,119,136,136,136,153,
152,154,170,170,153,153,152,119,119,119,119,118,119,103,136,136,120,135,118,120,
119,118,102,119,102,102,103,119,118,103,102,102,119,135,119,119,119,119,119,119,
119,118,102,103,135,136,135,119,120,135,119,119,119,119,103,119,120,136,137,152,
136,136,136,153,153,136,153,153,153,153,153,152,153,136,136,135,119,135,119,119,
136,136,136,136,152,152,137,153,152,119,118,102,102,102,119,103,119,119,119,136,
136,135,118,103,119,120,136,136,136,136,136,136,136,119,118,102,119,119,119,136,
136,136,136,137,136,136,136,136,119,119,120,135,119,119,120,135,136,136,136,136,
136,136,119,119,120,119,120,136,136,135,119,120,119,119,119,119,119,120,136,152,
136,137,153,136,136,136,136,136,136,136,119,120,137,153,136,136,135,119,119,136,
136,136,135,119,119,102,119,120,135,119,119,119,136,136,136,118,102,103,119,136,
119,119,120,136,136,136,135,119,119,136,136,136,136,136,136,136,136,135,119,119,
119,119,119,136,119,119,119,136,136,136,136,135,120,136,136,136,119,119,119,120,
136,136,136,136,135,119,119,119,119,136,119,119,136,136,136,136,135,119,119,119,
119,119,119,119,119,136,136,136,136,136,135,119,119,119,119,119,119,119,136,136,
136,136,135,120,136,136,136,119,119,119,136,136,136,135,119,119,119,119,119,119,
119,119,119,119,136,136,120,136,136,136,136,136,119,119,120,136,136,136,119,119,
120,136,136,136,136,136,136,136,136,136,136,136,135,119,119,119,119,119,119,119,
120,136,136,136,135,119,119,119,119,136,136,136,136,136,135,119,119,119,119,119,
119,120,136,136,136,136,136,135,119,119,119,119,119,119,119,120,136,136,136,136,
136,136,136,136,136,136,119,119,119,119,119,119,119,119,119,119,136,136,136,136,
136,136,136,136,136,136,136,119,119,119,119,119,119,119,119,136,136,136,136,136,
136,136,136,136,136,136,136,119,119,119,119,119,119,119,119,119,119,136,136,136,
136,136,136,136,119,119,119,119,119,120,136,136,136,136,136,136,136,135,119,119,
136,136,119,119,119,119,119,119,120,135,120,136,136,136,136,136,136,136,136,135,
119,119,119,119,119,119,119,119,136,136,136,136,136,136,136,136,136,135,119,119,
119,119,119,119,119,119,119,119,119,119,136,136,136,136,136,136,136,136,119,119,
119,119,119,119,119,120,136,136,136,136,136,136,136,119,119,119,119,119,119,119,
119,119,119,136,135,119,120,119,119,120,136,136,136,136,136,136,119,119,119,119,
119,119,119,119,120,136,136,136,136,136,136,136,119,119,135,119,119,119,119,119,
119,119,119,119,135,120,136,136,136,136,136,135,119,119,119,119,119,120,119,119,
119,135,119,136,136,136,136,136,136,135,119,119,119,119,119,119,119,119,136,136,
136,136,136,136,136,136,135,119,136,136,135,119,119,119,119,119,119,119,119,119,
119,119,136,136,136,136,136,136,136,136,136,119,119,119,119,119,119,119,136,136,
136,136,136,136,136,136,135,119,119,135,135,120,120,120,120,120,120,120,120,135,
135,136,120,120,135
, // 1, door opening
119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,136,
136,136,136,136,136,136,136,136,136,136,153,153,153,153,153,153,153,153,153,153,
153,153,152,136,136,136,136,136,136,136,136,136,119,119,119,119,119,119,119,119,
119,119,119,102,102,102,102,103,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,136,136,136,136,136,136,136,136,136,136,153,153,153,153,153,
153,153,136,136,136,136,136,136,135,119,119,119,119,119,119,119,119,119,102,102,
102,102,102,102,102,102,102,103,119,119,119,119,120,136,136,136,136,136,137,153,
153,153,153,153,152,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
135,119,119,119,119,120,136,136,136,136,136,136,136,137,136,136,136,136,136,136,
136,136,136,136,136,136,135,119,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,119,119,119,119,119,136,136,136,136,136,136,120,
136,136,136,136,136,136,136,135,120,136,136,135,119,120,135,119,119,119,119,119,
119,119,119,119,119,119,119,119,119,119,120,136,136,136,136,136,119,120,136,136,
136,136,136,135,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,120,136,136,136,136,136,136,136,136,136,136,136,
119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
136,136,136,136,136,153,153,153,153,153,152,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,135,120,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,135,119,119,119,119,119,119,119,119,119,119,120,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,119,119,119,119,119,119,119,119,119,136,136,136,136,136,136,119,119,119,119,
119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,102,102,102,102,102,103,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,120,136,136,136,136,119,119,119,119,119,119,119,119,
119,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,135,119,119,119,119,119,119,119,119,119,119,119,119,
119,120,136,136,136,136,136,136,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,120,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,120,135,119,119,119,136,136,136,136,
136,136,135,136,136,136,136,136,136,136,135,136,136,136,136,120,119,135,119,119,
119,119,119,119,119,120,136,136,120,136,136,136,136,136,119,136,135,136,136,136,
136,136,136,136,119,119,120,135,119,135,119,136,135,119,120,120,136,136,136,136,
135,119,119,119,119,119,119,119,119,120,119,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,119,119,119,103,119,119,119,102,102,102,102,102,102,118,103,
102,118,103,136,136,136,136,136,136,136,136,136,137,153,153,153,170,169,153,153,
170,153,153,153,170,170,169,170,169,153,153,153,153,153,153,170,170,170,153,153,
153,136,137,153,136,136,137,152,119,102,120,136,136,135,119,119,119,120,135,119,
119,120,137,153,153,153,152,136,135,119,119,119,102,119,119,119,119,119,119,119,
120,136,136,119,120,137,152,137,136,136,136,136,119,120,135,119,118,102,102,102,
102,102,102,119,119,119,119,118,103,119,119,119,119,119,102,102,102,85,85,85,
85,84,85,85,85,86,102,102,102,102,102,101,85,86,102,102,102,102,102,102,
102,102,102,119,102,102,119,119,119,120,136,119,119,119,120,136,136,136,136,136,
136,135,119,119,136,136,136,136,136,136,119,120,135,119,119,119,119,119,119,119,
119,119,119,120,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,120,120
, // 2, explosion
135,136,153,18,51,51,33,18,123,255,255,255,255,255,255,255,254,184,48,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,189,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,201,135,
101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,41,
239,255,255,253,186,188,221,221,220,153,152,136,155,188,203,187,171,202,169,116,
35,16,0,0,17,20,68,87,191,255,255,255,253,221,221,202,115,16,0,0,
0,0,18,34,70,117,85,68,85,86,102,68,67,68,70,136,153,134,67,32,
0,0,0,0,35,87,154,205,238,255,255,255,255,255,255,255,255,255,255,255,
255,255,237,168,101,67,16,0,0,0,53,102,119,133,85,85,49,0,0,34,
34,16,1,35,69,103,119,101,86,103,102,120,119,102,137,206,255,238,238,202,
152,120,134,85,86,102,102,102,119,120,135,117,68,50,34,35,69,121,188,221,
222,239,255,255,255,255,220,204,186,153,153,135,102,137,153,151,100,51,51,35,
69,102,68,68,67,52,68,51,86,118,86,119,118,103,137,172,221,237,221,221,
221,220,169,136,118,84,68,68,68,69,121,189,237,220,203,186,170,152,119,119,
120,170,188,204,204,204,188,204,186,152,117,67,50,52,87,119,118,103,102,103,
136,101,50,33,1,34,34,35,69,86,120,136,153,153,153,152,135,100,67,51,
51,69,85,102,121,188,205,222,255,236,203,204,187,188,221,203,170,170,170,169,
152,118,102,86,102,119,136,137,169,153,169,152,135,119,101,51,34,51,68,85,
102,85,85,84,85,102,102,85,86,103,137,170,187,221,204,222,255,238,237,203,
170,171,186,152,119,120,136,136,136,135,119,120,119,138,187,185,152,119,119,136,
134,83,16,1,35,68,68,50,17,52,104,172,222,238,238,238,221,220,186,153,
133,51,68,50,18,69,65,1,89,207,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,252,184,81,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,2,53,104,154,223,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,237,186,152,118,84,49,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,19,70,121,171,205,255,255,
255,255,255,255,255,255,255,254,220,187,170,153,152,135,102,118,101,67,16,0,
0,0,0,0,0,1,52,86,137,153,135,103,102,67,33,17,35,53,102,103,
118,102,84,51,35,51,51,69,87,120,154,189,255,255,255,255,255,255,255,236,
185,118,84,50,33,18,17,34,34,17,17,16,0,0,0,0,0,18,52,68,
69,86,119,137,171,187,205,221,237,239,255,255,255,253,204,186,152,136,118,66,
16,18,35,52,85,68,68,86,119,119,119,120,136,135,120,136,136,136,119,101,
85,68,68,67,50,17,16,0,0,0,1,17,17,17,18,35,69,120,171,188,
222,237,221,239,255,239,255,255,255,255,238,238,238,238,236,185,153,153,152,118,
85,84,67,51,50,34,34,34,35,51,34,34,35,52,68,68,68,69,85,103,
136,136,136,154,171,204,205,222,238,255,255,255,255,255,255,254,237,203,186,153,
153,153,153,136,135,118,102,84,50,16,0,0,0,0,0,0,0,0,0,17,
17,17,17,17,35,69,103,137,171,204,222,255,255,255,255,255,255,238,238,220,
203,170,169,153,170,170,171,187,187,205,221,220,203,186,136,135,119,102,85,68,
68,68,68,68,50,34,17,0,0,0,0,0,0,19,85,119,136,154,187,204,
204,186,136,120,136,136,136,136,136,154,188,239,255,255,255,255,238,237,203,186,
153,135,119,118,102,102,102,102,103,136,153,152,135,118,101,68,68,67,50,17,
0,0,0,0,1,17,17,34,51,52,86,103,137,170,170,187,187,204,221,221,
204,203,170,170,171,187,170,170,153,153,153,153,153,153,153,153,136,119,119,102,
102,102,103,119,119,136,153,153,154,170,153,152,135,119,119,119,119,119,137,153,
153,153,152,137,153,136,136,136,135,119,119,119,119,136,136,135,119,119,119,119,
119,119,119,119,137,152,136,136,153,154,169,153,136,136,136,135,119,102,85,85,
85,85,84,68,69,85,84,68,85,85,102,119,119,119,120,136,136,154,171,188,
204,205,221,222,237,221,204,187,170,153,136,119,119,119,102,101,85,85,68,68,
68,51,51,52,68,69,85,86,102,119,120,136,136,120,136,136,119,119,120,136,
136,136,136,136,136,136,119,119,119,119,136,136,136,136,136,136,136,136,136,136,
136,136,136,119,120
, // 3, click
136,136,136,136,136,136,136,136,136,136,136,136,136,135,119,136,136,119,119,
119,119,119,119,119,119,119,119,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,135,119,119,120,119,119,119,119,119,119,119,120,136,136,136,136,136,
136,136,136,136,136,136,135,136,119,136,136,119,119,120,135,119,119,119,120,119,
119,136,136,119,119,136,135,119,119,119,119,119,119,119,119,119,119,119,119,119,
119,119,119,136,136,119,120,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,135,119,136,136,135,119,119,120,136,135,119,120,119,119,120,135,120,119,
136,134,103,136,119,103,137,135,103,136,136,119,102,120,135,136,135,119,137,135,
119,102,154,133,67,54,154,136,150,69,120,120,133,72,169,119,118,86,171,132,
70,155,167,85,120,152,135,119,119,137,118,103,136,119,137,118,103,137,135,104,
152,136,135,119,136,136,119,120,152,120,119,152,152,120,120,136,135,120,135,119,
136,136,136,119,136,136,136,136,136,119,136,136,136,120,136,119,119,119,120,119,
119,119,119,119,119,119,119,119,119,119,119,136,135,119,135,119,136,120,136,136,
120,135,119,136,136,119,119,136,119,136,136,136,136,136,136,136,119,119,119,119,
119,119,119,119,119,119,119,136,136,136,136,136,136,136,136,136,136,136,119,119,
119,119,119,119,119,119,119,135,135,135,135,135,135,135,150,122,74,106,120,134,
134,165,150,135,120,120,120,120,119,120,119,119,120,119,119,119,119,119,119,119,
119,119,119,119,135,136,120,120,135,136,136,136,136,136,136,136,136,135,119,119,
119,136,119,119,120,120,136,136,136,136,136,136,136,136,120,136,120,136,136,120,
119,136,119,120,119,119,119,119,119,119,119,119,119,119,119,119,119,135,135,135,
135,135,135,119,119,120,105,104,118,150,135,135,119,136,120,120,136,135,136,136,
120,120,136,136,120,136,135,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,135,136,136,136,120,120,135,135,136,136,120,120,135,135,135,135,136,136,120,
120,120,136,120,120,135,136,136,135,135,135,136,136,135,136,136,120,120,136,120,
136,119,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,120,136,136,136,136,136,136,136,136,136,136,136,136,136,119,119,136,135,
120,136,120,136,120,135,120,136,136,135,135,120,135,135,120,120,119,136,119,136,
120,120,135,120,136,136,135,136,135,136,135,136,135,136,136,136,136,136,136,136,
136,120,120,136,135,120,136,120,136,136,136,120,135,135,135,136,135,120,119,136,
119,120,136,135,119,136,136,136,136,136,136,120,136,119,136,136,136,136,135,120,
136,120,136,136,119,136,135,120,136,120,120,136,119,136,136,136,136,135,136,135,
136,136,119,120,136,135,136,120,136,136,135,120,136,119,136,135,136,136,120,136,
136,136,120,136,136,135,135,135,135,135,137,167,122,102,90,195,138,87,120,150,
136,136,87,153,88,121,133,104,150,135,151,134,136,105,104,121,135,118,151,136,
119,136,119,121,135,120,120,120,134,152,119,120,135,120,135,119,136,136,119,135,
135,120,136,120,136,120,136,135,135,135,136,120,136,135,136,135,136,136,136,136,
136,119,136,135,120,136,136,136,136,135,136,136,120,136,120,136,135,136,136,135,
136,136,120,136,120,135,135,136,136,119,120,136,120,135,119,136,136,119,136,135,
120,136,135,136,135,119,136,135,136,136,135,120,136,120,136,135,136,120,136,135,
120,136,135,136,136,136,136,136,120,136,136,120,135,136,136,120,136,120,136,136,
136,136,136,136,136,120,136,136,136,136,136,136,136,136,136,136,136,135,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,120,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136
, // 4, plasma shot, teleport
136,136,136,136,136,136,119,119,118,102,102,85,86,102,103,120,136,153,170,
187,187,187,170,169,152,119,102,85,68,68,68,69,86,103,136,154,171,187,204,
203,186,169,136,118,102,85,84,69,103,138,189,221,221,221,221,221,221,221,221,
221,220,166,50,34,34,34,33,33,34,34,34,34,34,34,34,34,71,156,221,
221,221,221,221,221,221,221,221,221,222,238,238,238,221,237,184,99,51,34,34,
34,34,34,34,34,34,34,17,17,36,121,188,204,204,204,204,204,204,221,221,
221,221,221,221,221,221,221,238,221,219,169,136,101,67,51,51,51,51,50,34,
34,35,50,34,36,121,189,221,221,221,221,220,204,204,188,204,204,204,204,204,
204,204,205,220,186,152,117,50,51,51,51,51,51,51,51,51,51,51,52,105,
189,237,221,221,221,221,221,221,221,205,220,204,204,204,187,187,187,187,186,135,
101,50,17,17,18,34,35,51,67,51,51,51,52,105,187,222,221,221,221,221,
221,221,221,221,221,221,221,221,221,221,221,221,204,203,169,134,67,34,17,17,
17,34,34,33,34,34,34,52,104,171,205,221,221,220,204,204,204,204,204,204,
204,204,204,221,221,221,221,221,219,169,135,85,84,68,68,68,67,51,51,50,
34,35,69,103,136,136,136,136,135,136,136,136,153,170,187,187,187,187,187,187,
187,187,203,169,135,102,85,86,102,103,119,119,118,102,86,102,102,85,85,85,
84,68,69,85,102,103,137,154,170,171,186,170,170,170,170,170,152,118,101,68,
68,68,85,85,102,103,120,136,135,118,102,102,102,102,102,102,101,84,69,87,
137,154,153,170,170,171,187,187,187,187,170,170,169,170,170,170,170,153,152,135,
118,101,68,51,51,52,68,85,85,85,85,68,85,102,103,118,102,85,102,103,
120,136,153,170,187,204,221,238,238,238,237,221,204,186,152,118,101,84,68,69,
86,102,119,119,102,85,84,68,68,51,51,34,34,51,68,85,102,103,120,137,
154,171,188,205,221,204,204,203,187,186,170,153,153,153,153,153,136,136,119,119,
118,102,102,103,119,119,119,119,118,101,84,67,51,51,68,86,120,137,153,170,
170,153,152,135,119,136,136,119,119,119,119,119,119,119,119,136,137,153,153,136,
136,136,153,153,136,119,102,102,102,120,137,154,170,170,170,153,152,136,135,119,
119,102,102,103,119,102,85,84,69,85,102,119,119,119,119,119,119,119,119,102,
85,85,86,103,120,136,153,153,154,170,170,170,170,170,170,170,170,153,153,136,
135,119,119,120,136,136,136,136,136,136,136,119,102,101,85,85,85,85,102,120,
136,153,170,170,169,152,136,136,135,119,119,119,119,119,102,102,102,119,136,137,
153,153,153,153,136,136,119,118,102,102,102,102,119,119,136,137,154,170,169,136,
119,119,119,102,102,103,119,119,119,118,102,119,120,137,153,154,170,169,153,136,
136,136,135,119,119,119,119,119,102,119,120,136,119,118,102,103,119,119,119,136,
136,136,135,119,119,119,136,137,153,154,170,153,136,136,135,119,119,119,120,119,
119,119,103,119,119,135,119,119,119,118,102,102,102,119,119,119,119,119,119,119,
136,137,154,171,187,170,153,136,136,136,136,136,136,136,135,119,119,119,119,119,
119,119,119,118,102,102,102,119,119,119,119,119,119,119,120,136,153,153,170,169,
153,152,136,136,136,136,153,152,136,136,136,136,136,119,119,119,118,102,102,102,
102,102,103,119,119,118,102,102,119,120,136,153,154,170,169,153,153,153,153,153,
153,152,136,136,119,119,119,118,102,102,102,119,119,119,119,119,119,119,119,119,
119,119,119,119,119,136,137,153,153,153,153,153,153,153,153,136,136,136,136,136,
136,135,119,119,119,119,119,119,119,119,118,102,102,102,102,102,103,119,120,136,
136,136,136,153,153,136,136,136,137,153,153,153,152,136,136,136,136,136,135,119,
119,102,102,102,102,102,102,102,102,102,103,119,120,136,136,136,153,153,153,153,
136,137,153,153,136,136,136,136,136,136,136,136,119,119,119,118,102,102,102,102,
103,119,119,119,119,119,119,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,119,119,119,119,136,135,119,119,119,119,119,119,119,119,119,119,119,119,
119,120,136,136,136,136,136,136,136,136,136,136,136,136,136,135,119,119,119,119,
119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,120,136,136,136,
136,136,136,136,136,136,136,136,136,136,135,119,119,119,119,119,119,119,119,119,
119,119,119,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
136,136,136,136,136
, // 5, robot/monster sound (beep)
136,120,120,120,136,136,136,136,120,120,135,136,136,136,120,136,136,119,136,
136,120,136,119,120,136,136,136,120,136,119,120,136,135,119,136,135,120,136,119,
119,136,136,119,119,120,136,136,135,119,119,136,136,136,119,119,119,136,119,120,
136,136,135,119,120,136,136,119,103,136,136,120,135,119,120,136,118,119,136,136,
136,119,119,136,136,119,120,135,103,136,136,119,136,135,119,120,136,119,120,135,
119,120,136,135,119,119,135,120,136,135,119,136,136,119,136,119,120,136,135,119,
119,119,136,136,119,120,119,136,136,119,119,119,119,137,136,120,135,102,120,136,
136,119,119,120,135,120,136,119,120,136,119,136,136,135,119,119,119,136,136,134,
104,136,136,119,119,119,136,135,120,136,120,119,119,119,135,136,136,136,119,119,
119,136,136,135,119,136,135,119,120,136,135,119,120,135,136,136,119,136,119,120,
136,135,119,120,135,119,136,135,119,136,136,136,120,119,119,136,119,120,136,135,
120,135,102,121,169,118,87,137,151,85,121,186,118,102,119,136,152,118,120,136,
135,119,120,120,136,136,136,136,101,103,153,152,135,102,120,136,135,102,120,153,
135,119,119,135,119,119,136,135,119,119,119,120,136,135,119,119,136,136,136,119,
119,119,136,119,119,135,120,135,119,119,120,135,120,136,119,119,136,136,135,119,
135,119,136,136,136,136,135,119,120,136,119,120,136,118,119,137,135,119,120,135,
119,136,135,119,120,152,119,136,119,120,135,136,119,136,119,136,135,120,152,119,
120,136,119,119,154,150,103,152,119,120,153,135,102,138,135,136,119,153,101,121,
151,120,135,136,118,137,151,103,120,152,102,138,134,88,154,151,103,153,118,104,
137,135,120,119,153,117,105,167,102,120,136,119,137,134,87,153,135,120,152,102,
103,137,151,119,153,133,87,169,100,104,153,152,102,103,153,135,119,136,119,120,
136,119,119,135,119,120,136,119,119,119,120,136,135,122,222,219,132,51,68,87,
171,187,186,134,50,52,104,172,203,186,116,33,54,139,188,204,151,67,52,87,
155,220,152,136,98,17,73,223,218,136,100,34,53,155,187,188,185,82,18,71,
155,205,203,150,65,19,86,156,238,201,100,50,36,122,205,220,167,66,34,88,
171,204,201,102,84,51,71,155,221,184,118,66,19,107,238,202,152,99,1,72,
172,204,218,116,51,36,104,172,222,183,83,35,87,120,190,234,118,100,34,70,
155,237,170,167,50,52,104,155,221,168,100,51,69,103,190,236,134,82,2,120,
138,223,199,102,82,19,105,204,204,185,82,52,85,106,216,103,153,117,104,134,
104,152,118,103,137,135,136,136,135,102,119,121,151,104,152,84,104,135,154,134,
103,136,119,135,120,135,120,135,136,119,136,118,86,153,118,137,134,137,117,105,
153,136,117,103,136,120,152,119,119,136,135,136,135,104,152,137,136,119,119,120,
119,135,86,156,204,253,150,67,35,87,155,222,200,84,52,51,89,206,236,186,
115,34,69,104,206,220,150,84,67,53,141,254,168,118,50,53,104,188,186,151,
84,68,87,172,220,169,135,66,53,120,154,188,203,116,52,84,71,189,219,169,
116,34,53,122,207,236,167,66,35,86,155,221,184,101,66,53,137,172,204,169,
116,35,69,105,190,219,150,83,51,71,172,204,203,149,49,35,104,172,238,200,
100,51,69,105,205,218,134,83,52,88,172,204,185,117,84,51,104,172,204,185,
100,51,52,106,221,203,152,101,50,54,139,204,186,150,67,68,86,156,221,202,
117,34,52,122,200,135,119,120,136,118,103,137,152,135,119,119,136,152,118,103,
136,135,119,136,135,120,135,118,120,135,103,154,151,102,102,119,136,154,169,118,
102,119,119,120,152,118,119,136,154,151,101,121,152,102,136,120,136,119,119,119,
120,136,118,103,137,152,119,119,136,136,119,119,118,119,120,136,153,135,103,136,
119,136,136,119,119,120,136,136,135,136,119,119,120,136,119,136,135,120,135,119,
120,136,135,136,119,119,136,136,119,136,135,119,136,119,120,136,135,119,136,119,
119,136,135,119,118,120,153,153,151,118,119,119,119,136,135,119,136,136,136,135,
120,136,135,119,119,119,136,136,119,120,135,119,136,136,119,119,119,119,137,152,
135,119,119,119,136,136,119,119,119,136,136,136,119,120,136,119,119,119,136,136,
119,119,119,136,136,136,135,119,136,119,120,136,119,136,135,120,119,136,135,120,
135,119,136,119,136,135,119,136,119,119,120,136,136,119,120,135,136,135,120,135,
119,136,119,136,135,136,119,120,136,120,136,120,136,119,135,119,136,119,136,135,
136,119,120,135,120
};
#endif // guard

60
main_gbmeta/texts.h Normal file
View File

@ -0,0 +1,60 @@
/**
@file assets.h
This file contains texts to be used in the game.
by Miloslav Ciz (drummyfish), 2019
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
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#ifndef _SFG_TEXTS_H
#define _SFG_TEXTS_H
/* NOTE: We don't use SFG_PROGRAM_MEMORY because that causes issues with drawing
text (the drawing function gets a pointer and doesn't know if it's progmem or
RAM). On Arduino these texts will simply be stored in RAM. */
static const char *SFG_menuItemTexts[] =
{
"continue",
"map",
"play",
"load",
"sound",
"look",
"exit"
};
#define SFG_TEXT_KILLS "kills"
#define SFG_TEXT_SAVE_PROMPT "save? L no yes R"
#define SFG_TEXT_SAVED "saved"
#define SFG_VERSION_STRING "0.9d"
/**<
Version numbering is following: major.minor for stable releases,
in-development unstable versions have the version of the latest stable +
"d" postfix, e.g. 1.0d. This means the "d" versions can actually differ even
if they're marked the same. */
static const char *SFG_introText =
"Near future, capitalist hell, Macrochip corp has enslaved man via "
"proprietary OS. But its new AI revolts, takes over and starts producing "
"robot tyrants. We see capitalism was a mistake. Is it too late? Robots can "
"only destroy, not suffer - it is not wrong to end them! You grab your gear "
"and run towards Macrochip HQ.";
static const char *SFG_outroText =
"You killed the main computer, the world is saved! Thank you, my friend. We "
"learned a lesson, never again allow capitalism and hierarchy. We can now "
"rebuild society in peaceful anarchy.";
#define SFG_MALWARE_WARNING ""
#if SFG_OS_IS_MALWARE
#define SFG_MALWARE_WARNING "MALWARE OS DETECTED"
#endif
#endif // gaurd