textadv/src/structures.c

481 lines
12 KiB
C

/* Copyright © 2020 tyrolyean
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "structures.h"
#include <stddef.h>
const uint8_t sine_table[256] PROGMEM = {
0x7f,0x82,0x85,0x88,
0x8c,0x8f,0x92,0x95,
0x98,0x9b,0x9e,0xa1,
0xa4,0xa7,0xaa,0xad,
0xb0,0xb3,0xb6,0xb9,
0xbb,0xbe,0xc1,0xc3,
0xc6,0xc9,0xcb,0xce,
0xd0,0xd3,0xd5,0xd7,
0xd9,0xdc,0xde,0xe0,
0xe2,0xe4,0xe6,0xe8,
0xe9,0xeb,0xed,0xee,
0xf0,0xf1,0xf2,0xf4,
0xf5,0xf6,0xf7,0xf8,
0xf9,0xfa,0xfb,0xfc,
0xfc,0xfd,0xfd,0xfe,
0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,
0xfe,0xfd,0xfd,0xfc,
0xfc,0xfb,0xfa,0xfa,
0xf9,0xf8,0xf7,0xf6,
0xf4,0xf3,0xf2,0xf0,
0xef,0xed,0xec,0xea,
0xe8,0xe7,0xe5,0xe3,
0xe1,0xdf,0xdd,0xdb,
0xd8,0xd6,0xd4,0xd1,
0xcf,0xcc,0xca,0xc7,
0xc5,0xc2,0xbf,0xbd,
0xba,0xb7,0xb4,0xb1,
0xaf,0xac,0xa9,0xa6,
0xa3,0xa0,0x9d,0x9a,
0x96,0x93,0x90,0x8d,
0x8a,0x87,0x84,0x81,
0x7d,0x7a,0x77,0x74,
0x71,0x6e,0x6b,0x68,
0x64,0x61,0x5e,0x5b,
0x58,0x55,0x52,0x4f,
0x4d,0x4a,0x47,0x44,
0x41,0x3f,0x3c,0x39,
0x37,0x34,0x32,0x2f,
0x2d,0x2a,0x28,0x26,
0x23,0x21,0x1f,0x1d,
0x1b,0x19,0x17,0x16,
0x14,0x12,0x11,0xf,
0xe,0xc,0xb,0xa,
0x8,0x7,0x6,0x5,
0x4,0x4,0x3,0x2,
0x2,0x1,0x1,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x1,0x1,0x2,
0x2,0x3,0x4,0x5,
0x6,0x7,0x8,0x9,
0xa,0xc,0xd,0xe,
0x10,0x11,0x13,0x15,
0x16,0x18,0x1a,0x1c,
0x1e,0x20,0x22,0x25,
0x27,0x29,0x2b,0x2e,
0x30,0x33,0x35,0x38,
0x3b,0x3d,0x40,0x43,
0x45,0x48,0x4b,0x4e,
0x51,0x54,0x57,0x5a,
0x5d,0x60,0x63,0x66,
0x69,0x6c,0x6f,0x72,
0x76,0x79,0x7c,0x7f,
};
const uint8_t noise_table[1024] PROGMEM = {
0x30, 0xc, 0x3, 0xdf,
0x31, 0xfa, 0x2b, 0x78,
0xd5, 0xd8, 0x6c, 0x29,
0x45, 0xa1, 0x2, 0x69,
0x69, 0x91, 0x8d, 0x65,
0x71, 0xb8, 0x43, 0xde,
0xf2, 0xf6, 0x78, 0x6e,
0x1d, 0xbf, 0x34, 0x4e,
0xcb, 0x38, 0x2e, 0xfd,
0x32, 0x59, 0x75, 0x7,
0x32, 0xe2, 0x31, 0x77,
0x84, 0x33, 0xe1, 0xed,
0xc5, 0x6e, 0x52, 0x36,
0x27, 0x96, 0x15, 0x19,
0x8d, 0x8d, 0x88, 0xab,
0x4d, 0xbc, 0xf9, 0x18,
0xf5, 0x27, 0x16, 0x27,
0x81, 0x8c, 0x2f, 0xb4,
0x6e, 0x60, 0x2b, 0xf2,
0x94, 0xc, 0xe0, 0x59,
0x7b, 0x33, 0x8f, 0xa3,
0xc9, 0xa4, 0xbd, 0x57,
0x32, 0x45, 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0xe4, 0x74,
0xec, 0x7, 0x4f, 0xf,
0x24, 0x32, 0x3a, 0xb8
};
char* sndirtroad_msg[2] = {
"You travel a bit towards the moon, you think that's the way to go. You"
" find a bear in the middle of the road sleeping seemingly in peace. "
"The way to the north is blocked by the bear.",
"You atravel a bit towards the moon, you KNOW that's the way to go. You"
" smell something weired along the way, but you don't know where it is "
"coming from. Smells like flesh rotting away..."
};
char* user_action_req_msgs[3] = {
"What are you going to do?"
};
const char* info_table[] = {
"ERROR", // 0
"Invalid command!", // 1
"You can't use that!", // 2
NULL, // 3
"You can't go that way!", // 4
"YOU MAY ACT NOW!", // 5
"There is nothing here..", // 6
"it died", // 7
"it survived", // 8
"a bear blocks the way", // 9
"it ran away...", // 10
"it won't start", // 11
"you can't type", // 12
"you unlocked the door" // 13
};
const char* action_table[NUM_ACTIONS] = {
"help",
"north",
"south",
"west",
"east",
"describe",
"use",
"inventory",
"search",
"take",
};
const char* room_table[] = {
"NOTHING",
"LONELY ROAD",
"S/N DIRT ROAD",
"FIREPLACE",
"E/W Street",
"OLD HOUSE",
"LIVING ROOM",
"ATTIC",
"BASEMENT",
"COMPUTER ROOM"
};
char* room_description_table[sizeof(room_table)/sizeof(const char*)] = {
"You stare into a void of nothingness. You see noone, you hear noone,"
"you feel someone. You look around, and see nothing, yet "
"you are no less scared.",
"You are on the dead end of a lonely road. You look right and left of "
"you, but you cannot remember why you are here... You are terrified.",
NULL,
"You find a fireplace in the middle of the woods. A street leads to it "
"from the west. The fire in the middle of the place is still burning as"
" if someone had left in a hurry...",
"You travel down the road. It has no lights, but the moon shines bright"
". The road ends with a house to your left. The houses door mat is in "
"the road. Its door is locked.",
"You enter the long hallway of the old house. It has doors on all walls"
". The doors look a little weired because they are flat and don't have "
"a handle to pull.",
"You enter a large room with a few chairs and a tube TV inside it. In "
"the center there is a tile table with a vase and flowers on it. The "
"flowers are blooming.",
"You enter the attic of the house. It has a few books and some filers "
"with documents inside it. The filers are glued together. The books too"
". You can't stand up straight.",
"You enter the basement. You find some potatoes in a corner and a "
"skeleton atop it. ",
"You enter a room which looks like you've traveled from an old house "
"to the campus of a university. There is a large machine witha sign "
"DIGITAL on it. It looks like a computer, though you've never seen one "
"in person before..."
};
bool room_visited_table[sizeof(room_table)/sizeof(const char*)];
uint8_t room_map_table[sizeof(room_table)/sizeof(const char*)]
[4] = {
/* NORTH, SOUTH, WEST, EAST */
{0,0,0,0}, /* 0 nothing */
{2,0,0,0}, /* 1 LONELY ROAD */
{0,1,0,0}, /* 2 S/N DIRT ROAD */
{0,2,4,0}, /* 3 FIREPLACE */
{0,0,0,3}, /* 4 E/W STREET */
{7,4,9,6}, /* 5 OLD HOUSE */
{8,0,5,0}, /* 6 LIVING ROOM */
{0,5,0,0}, /* 7 ATTIC */
{0,6,0,0}, /* 8 BASEMENT */
{0,0,0,5} /* 9 COMPUTERROOM */
};
const char* item_table[NUM_ITEMS] = {
"FLOPPY DISK", /* 0 */
"SCREWDRIVER", /* 1 */
"KEYBOARD", /* 2 */
"SAUSAGE", /* 3 */
"FLESH", /* 4 */
"KEY", /* 5 */
"PISTOL" /* 6 */
};
bool inventory[sizeof(item_table)/sizeof(const char*)];
int8_t item_room_map[NUM_ROOMS] = {
-1, /* 0 NOTHING */
ITEM_PISTOL, /* 1 LONELY ROAD */
ITEM_SAUSAGE, /* 2 S/N DIRT ROAD */
-1, /* 3 FIREPLACE */
ITEM_KEY, /* 4 E/W STREET*/
ITEM_SCREWDRIVER, /* 5 OLD HOUSE */
-1, /* 6 LIVING ROOM */
ITEM_KEYBOARD, /* 7 ATTIC */
ITEM_FLOPPY, /* 8 BASEMENT */
-1 /* 9 COMPUTERROOM */
};
const struct tone_t * room_track_map[NUM_ROOMS] = {
intro_track,
lonely_road_track,
computer_room_track,
lonely_road_track,
computer_room_track
};