1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-28 19:23:53 +00:00

Include stringbank.txt into binary in case stringbank.txt is out of date

This makes sure engine-internal strings are always present.
This commit is contained in:
fgenesis 2018-01-02 15:31:47 +01:00
parent ce4f6a7d3e
commit 8f565c6171
8 changed files with 318 additions and 23 deletions

View file

@ -4542,6 +4542,10 @@ void DSQ::loadStringBank()
{
stringbank.clear();
#define BANKSTRING(id, str) stringbank.set(id, str);
#include "StringBank_gen.h"
#undef BANKSTRING
// First, load the default string banks
stringbank.load("data/stringbank.txt");
if (mod.isActive())
@ -4555,12 +4559,4 @@ void DSQ::loadStringBank()
fname = localisePath(mod.getPath() + "stringbank.txt", mod.getPath());
stringbank.load(fname);
}
if(stringbank.empty())
exit_error("Failed to load data/stringbank.txt");
// ADD DEFAULTS
stringbank.addDefault(2153, "--");
}

265
Aquaria/StringBank_gen.h Normal file
View file

@ -0,0 +1,265 @@
// Generated by tools/stringbank_gen.lua
BANKSTRING(0, "Double click on the food or drag the food to Naija's mouth to eat. ")
BANKSTRING(1, "Drag two or three ingredients over and press the Cook button to combine them. Drag food onto the 'X' to throw it away. When in a kitchen, you will have access to three slots.")
BANKSTRING(2, "Use the minimap in the corner to get your bearings. White circles represent new areas. Naija's home is nearby - marked in gold.")
BANKSTRING(3, "Boost towards enemies in Beast Form to bite them.")
BANKSTRING(4, "You've found a new Map Token!\nDouble Click the Mini Map in the corner of the screen to view the World Map.")
BANKSTRING(6, "You've learned Li's song. Sing it to draw Li towards you if he has wandered off. Interact with Li's helmet if you'd like to leave him here.")
BANKSTRING(7, "Sing Li's Song when he is Near to Toggle his Combat Mode.")
BANKSTRING(8, "Congratulations, you've reached the end of the current Aquaria IGF demo! Look for more updates in the upcoming months.")
BANKSTRING(9, "Absorb blue plants to heal Naija's wounds.")
BANKSTRING(11, "Naija can combine ingredients to create special food items.")
BANKSTRING(12, "Some enemies allow you to fire new shots when devoured...")
BANKSTRING(13, "Click on Naija to Let Go, Click Far Away to Jump")
BANKSTRING(14, "The songs that Naija has learned are displayed here. Hover the cursor over them to see how they are sung. Click them to hear Naija's description.")
BANKSTRING(15, "Click these icons to switch between menu pages.")
BANKSTRING(16, "This page seems to be blank for now. Perhaps later...")
BANKSTRING(17, "Naija's pets are displayed here. Click to select the active pet.")
BANKSTRING(19, "UNUSED")
BANKSTRING(20, "Change into Energy Form to Pass the Next Barrier")
BANKSTRING(21, "Sing the same color note as the Song Plant to Open it")
BANKSTRING(22, "Sing the same color note as the Verse Egg to Open it")
BANKSTRING(23, "Learned the")
BANKSTRING(24, "Recipe!")
BANKSTRING(26, "You Have Gained the Power to Cook with Three Slots at Any Time")
BANKSTRING(27, "Too Many")
BANKSTRING(28, "Spin the Cursor around Naija to Switch Sides in Dual Form")
BANKSTRING(29, "Charge Up Naija's Attack by Killing Enemies with Li's Side")
BANKSTRING(30, "You've discovered a Blaster Pet Egg!")
BANKSTRING(31, "You've discovered a Pirhana Pet Egg!")
BANKSTRING(32, "You've discovered a Dumbo Octopus Pet Egg!")
BANKSTRING(33, "You've discovered a Nautilus Pet Egg!")
BANKSTRING(34, "Creatures' shells can be removed with the bind song.")
BANKSTRING(35, "The Shield Song - Press ESC for Song Menu")
BANKSTRING(36, "Learned the Bind Song")
BANKSTRING(37, "Learned the Energy Form Song")
BANKSTRING(38, "Learned the Beast Form Song")
BANKSTRING(39, "Learned the Fish Form Song")
BANKSTRING(40, "Learned the Nature Form Song")
BANKSTRING(41, "Learned the Sun Form Song")
BANKSTRING(42, "Learned Li's Song")
BANKSTRING(43, "Learned the Dual Form Song")
BANKSTRING(44, "Learned the Spirit Form Song")
BANKSTRING(50, "Use the Bind Song to Lift Rocks and Pull Up Plants")
BANKSTRING(51, "Use the Bind Song to Move the Bloated Mermen")
BANKSTRING(60, "===WINDOWS/LINUX HINTS START===")
BANKSTRING(61, "Hold Left Mouse Button or Space Bar to Swim")
BANKSTRING(62, "Hold Right on Naija to Sing")
BANKSTRING(63, "Hold Right on Enemies to Target them in Energy Form.")
BANKSTRING(64, "Press or Hold Right to Create Seeds in Nature Form.")
BANKSTRING(65, "Hold Left and Move the Cursor Around Naija to Roll")
BANKSTRING(66, "Tap Left and Right on Naija to Revert and Pass Through")
BANKSTRING(67, "Hold Middle Mouse Button or Left Shift to Look Around")
BANKSTRING(68, "Right Click to Interact")
BANKSTRING(69, "Hold Right to Charge in Energy Form")
BANKSTRING(70, "Click Right to Attack in Energy Form")
BANKSTRING(71, "Click and Hold Left Mouse Button Far from Naija")
BANKSTRING(80, "===MAC HINTS START===")
BANKSTRING(81, "Hold Left Mouse Button or Space Bar to Swim")
BANKSTRING(82, "Hold Ctrl on Naija to Sing")
BANKSTRING(83, "Hold Ctrl on Enemies to Target them in Energy Form.")
BANKSTRING(84, "Press or Hold Ctrl to Create Seeds in Nature Form.")
BANKSTRING(85, "Hold the Mouse Button and Move the Cursor Around Naija to Roll")
BANKSTRING(86, "Tap Both Buttons on Naija, or X key, to Revert and Pass Through")
BANKSTRING(87, "Hold Left Shift or Middle Mouse Button to Look Around")
BANKSTRING(88, "Press Ctrl to Interact")
BANKSTRING(89, "Hold Ctrl to Charge in Energy Form")
BANKSTRING(90, "Press Ctrl to Attack in Energy Form")
BANKSTRING(91, "Click and Hold Left Mouse Button Far from Naija")
BANKSTRING(100, "+")
BANKSTRING(101, "-")
BANKSTRING(200, "Heal")
BANKSTRING(201, "Full Health")
BANKSTRING(202, "Defense +")
BANKSTRING(203, "Seconds")
BANKSTRING(204, "Speed +")
BANKSTRING(205, "for")
BANKSTRING(206, "Regeneration x")
BANKSTRING(207, "Trippy")
BANKSTRING(208, "Beast Shot")
BANKSTRING(209, "Bite Power Up")
BANKSTRING(210, "Invincible")
BANKSTRING(211, "Energy Shot +")
BANKSTRING(212, "Blindness Cured")
BANKSTRING(213, "Poison Cured")
BANKSTRING(214, "Poisoned")
BANKSTRING(215, "Tasty!")
BANKSTRING(216, "Pet Power Up")
BANKSTRING(217, "Fish Form Poison")
BANKSTRING(218, "All Status Cured")
BANKSTRING(219, "Web Ability")
BANKSTRING(220, "Sun Ability Up")
BANKSTRING(221, "???")
BANKSTRING(222, "You've found a lost treasure! Many are hidden throughout the waters of Aquaria. Once collected, they will modify Naija's home cave in unique ways.")
BANKSTRING(223, "A treasure has been added to your home cave.")
BANKSTRING(224, "You've found a new costume! You can use the treasure menu to wear it.")
BANKSTRING(225, "You must find another Ancient Turtle before you can travel with them.")
BANKSTRING(226, "Ride the Ancient Turtles to travel quickly through regions of Aquaria.")
BANKSTRING(227, "Li Will Eat")
BANKSTRING(500, "[Jelly Beacon] [This odd plant seemed to draw small Jelly Fish towards it.]")
BANKSTRING(501, "[Krotite Armor] [I recovered this ancient battle armor worn by the Krotites, from a secret entrance to the Energy Temple.]")
BANKSTRING(502, "[Energy Idol] [A small statuette that burned with the power of the Krotites.]")
BANKSTRING(503, "[Tooth] [In the rush of victory, I pulled this large tooth from the Energy God's jaw. I decided to keep it, as a reminder...]")
BANKSTRING(504, "[Big Seed] [I discovered a giant seed in my sanctuary. When I brought it home and planted it, it sprouted into a colorful garden.]")
BANKSTRING(505, "[Crab Armor] [I fashioned this armor from the shell of the Giant Crab. It would provide me with extra defense when worn.]")
BANKSTRING(506, "[Glowing Plant] [Its twin bulbs drew jellyfish up from the deep.]")
BANKSTRING(507, "[Mithalas Pot] [This pot never seemed to run out of meat for my kitchen.]")
BANKSTRING(508, "[Arnassi Armor] [I won this armor by completing the Arnassi gauntlet in record time. When worn, I could ride seahorses more effectively.]")
BANKSTRING(509, "[Odd Container] [The bubbles trapped inside this container amused me.]")
BANKSTRING(510, "[Mithalan Banner] [I took a blue banner from Mithalas, to remind me of the time spent in its waters.]")
BANKSTRING(511, "[Mithala Doll] [I imagined that this doll belonged to a young girl who had lived in Mithalas long before it was destroyed.]")
BANKSTRING(512, "[Walker Baby] [Perhaps one day it would grow up to be as magnificent as the Walkers in the Kelp Forest.]")
BANKSTRING(513, "[Seed Bag] [I spread these seeds around the foresty area of my cave. Soon small leafy sprouts appeared.]")
BANKSTRING(514, "[Arnassi Statue] [An Arnassi statue I scavenged from the ruins of the civilization.]")
BANKSTRING(515, "[Gear] [I thought that it might be fun to have one of these in my cave.]")
BANKSTRING(516, "[Sun Key] [A strange shiny object... I had no idea what it was for, but I decided to keep it.]")
BANKSTRING(517, "[Urchin Costume] [A spiny costume fashioned from shells of sea urchins. Creatures that touched it would take damage from its sharp spikes.]")
BANKSTRING(518, "[Girl's Costume] [A rather revealing costume...]")
BANKSTRING(519, "[Mutant Costume] [Why did they look so much like me...]")
BANKSTRING(520, "[Jelly Costume] [I won this costume by defeating King Jellyfish. When worn, it would heal me if my wounds became critical.]")
BANKSTRING(521, "[Mithalan Dress] [A ceremonial costume worn by the Princess of Mithalas.]")
BANKSTRING(522, "[Anemone Seed] [When planted, this seed sprouted a garden of anemones in my cave.]")
BANKSTRING(523, "[Glowing Seed] [When planted, this seed sprouted a garden of glowing plants in my cave.]")
BANKSTRING(524, "[Turtle Egg] [I found this egg in the Turtle Cave.]")
BANKSTRING(525, "[King's Skull] [How did he end up in such a terrible place, I wondered?]")
BANKSTRING(526, "[Drask's Trident] [This belonged on the end of a Prince's weapon.]")
BANKSTRING(527, "[Song Plant Spore] [The spores from the song plant reacted strongly to the Verse.]")
BANKSTRING(528, "[Jelly Egg] [An egg from an upside-down jelly.]")
BANKSTRING(529, "[Stone Head] [I wondered if this stone's crude face was the product of nature or something else?]")
BANKSTRING(530, "[Golden Starfish] [A special starfish infused with Sun's power.]")
BANKSTRING(531, "[Black Pearl] [A beautiful black pearl I found hidden away in a deep cave.]")
BANKSTRING(532, "[Baby Crib] [This baby's crib brought powerful memories rushing to the surface.]")
BANKSTRING(600, "Pets")
BANKSTRING(601, "[Nautilus] [Bashes itself into nearby creatures.]")
BANKSTRING(602, "[Dumbo] [Creates a glow of light around Naija.]")
BANKSTRING(603, "[Blaster] [Fires on nearby creatures.]")
BANKSTRING(604, "[Piranha] [Bites and devours nearby creatures.]")
BANKSTRING(799, "Secret Error")
BANKSTRING(800, "Found One of Naija's Lost Memories")
BANKSTRING(801, "Found Two of Naija's Lost Memories")
BANKSTRING(802, "Found All of Naija's Lost Memories - A New Ending")
BANKSTRING(850, "End of Demo")
BANKSTRING(851, "Wrong Way!")
BANKSTRING(852, "Lap")
BANKSTRING(853, "Complete!")
BANKSTRING(860, "Enter Map Marker Name:")
BANKSTRING(1000, "Boiler Room")
BANKSTRING(1001, "Whale")
BANKSTRING(1002, "Frozen Veil")
BANKSTRING(1003, "Bubble Cave")
BANKSTRING(1004, "The Energy Temple")
BANKSTRING(1005, "Naija's Home")
BANKSTRING(1006, "Verse Cave")
BANKSTRING(1007, "The Song Cave")
BANKSTRING(1008, "Home Waters")
BANKSTRING(1009, "Open Waters")
BANKSTRING(1010, "The Kelp Forest")
BANKSTRING(1011, "Mithalas City")
BANKSTRING(1012, "Mithalas Cathedral")
BANKSTRING(1013, "The Sun Temple")
BANKSTRING(1014, "The Veil")
BANKSTRING(1015, "The Abyss")
BANKSTRING(1016, "The Sunken City")
BANKSTRING(1017, "Fish Cave")
BANKSTRING(1018, "Octopus Cave")
BANKSTRING(1019, "Ice Cavern")
BANKSTRING(1020, "???")
BANKSTRING(1021, "The Body")
BANKSTRING(1022, "")
BANKSTRING(1023, "Secret Cave Passage")
BANKSTRING(1024, "Mermog Cave")
BANKSTRING(1025, "Forest Sprite Cave")
BANKSTRING(1026, "The Fish Cave")
BANKSTRING(1027, "The Turtle Cave")
BANKSTRING(1028, "The Arnassi Ruins")
BANKSTRING(1029, "Li's Cave")
BANKSTRING(1030, "King Jellyfish Cave")
BANKSTRING(2000, "Save Game")
BANKSTRING(2001, "Load Game")
BANKSTRING(2002, "Slot")
BANKSTRING(2003, "Empty")
BANKSTRING(2004, "~Paused~")
BANKSTRING(2005, "Press 'S' to Skip")
BANKSTRING(2006, "Page")
BANKSTRING(2007, "Recipes")
BANKSTRING(2008, "error")
BANKSTRING(2009, "No Description")
BANKSTRING(2010, "Stopped Recording")
BANKSTRING(2011, "Stopped Playback")
BANKSTRING(2012, "1: Refresh\n2: Heal\n3: Reset Cont.\n5: Set Invincible\n6: Set Flag\n8: All Songs\n9: All Ups\nS: learn song #\nF: Find Entity\nC: Set Costume\n0: Learn MArea Songs\nR: Record Demo\nP: Playback Demo\nT: Rewind Demo\nU: Ouput Demo Frames\nB: Unload Resources\nA: Reload Resources\nM: AutoMap\nJ: JumpState\nQ: QuitNestedMain")
BANKSTRING(2013, "health")
BANKSTRING(2014, "Enter Flag to Set")
BANKSTRING(2015, "Enter Value to Set Flag To")
BANKSTRING(2016, "Entity data not found! Aborting...")
BANKSTRING(2017, "Variables data not found! Aborting...")
BANKSTRING(2018, "Particle Name:")
BANKSTRING(2019, "Saved worldmap data to")
BANKSTRING(2020, "Unable to save worldmap to")
BANKSTRING(2021, "Unable to retrieve online mod list.\nCheck your connection and try again.")
BANKSTRING(2022, "Server error!\nBad XML, please contact server admin.\nURL:")
BANKSTRING(2023, "Finished downloading mod")
BANKSTRING(2024, "Download update?")
BANKSTRING(2025, "Mod already exists. Re-download?")
BANKSTRING(2026, "This mod was installed manually,\nnot messing with it.")
BANKSTRING(2027, "\nBrowse installed mods")
BANKSTRING(2028, "\nBrowse & enable/disable installed patches")
BANKSTRING(2029, "\nBrowse mods online")
BANKSTRING(2030, "\nReturn to title")
BANKSTRING(2031, "Any")
BANKSTRING(2032, "[Achievements]")
BANKSTRING(2033, "Retrieving online mod list...")
BANKSTRING(2034, "Open URL in web browser?")
BANKSTRING(2050, "-- WARNING: Dangerous script functions are ENABLED!")
BANKSTRING(2100, "=== for options menu ===")
BANKSTRING(2101, "Action")
BANKSTRING(2102, "Key 1")
BANKSTRING(2103, "Key 2")
BANKSTRING(2104, "Joystick")
BANKSTRING(2105, "Left Mouse Equiv.")
BANKSTRING(2106, "Right Mouse Equiv.")
BANKSTRING(2107, "Action 1: Swim")
BANKSTRING(2108, "Action 2: Sing/Ability")
BANKSTRING(2109, "Swim Up")
BANKSTRING(2110, "Swim Down")
BANKSTRING(2111, "Swim Left")
BANKSTRING(2112, "Swim Right")
BANKSTRING(2113, "Roll")
BANKSTRING(2114, "Revert")
BANKSTRING(2115, "WorldMap/Recipes")
BANKSTRING(2116, "Menu/Escape")
BANKSTRING(2117, "Stick 1 X")
BANKSTRING(2118, "Stick 1 Y")
BANKSTRING(2119, "Stick 2 X")
BANKSTRING(2120, "Stick 2 Y")
BANKSTRING(2121, "Prev Page")
BANKSTRING(2122, "Next Page")
BANKSTRING(2123, "Food Menu Cook")
BANKSTRING(2124, "Food Left")
BANKSTRING(2125, "Food Right")
BANKSTRING(2126, "Food Drop")
BANKSTRING(2127, "Look")
BANKSTRING(2128, "Help")
BANKSTRING(2129, "Song Slot #")
BANKSTRING(2130, "Category")
BANKSTRING(2131, "Mouse")
BANKSTRING(2132, "Take Screenshot")
BANKSTRING(2133, "Action Set:")
BANKSTRING(2134, "Enabled")
BANKSTRING(2135, "Menu Up")
BANKSTRING(2136, "Menu Down")
BANKSTRING(2137, "Menu Left")
BANKSTRING(2138, "Menu Right")
BANKSTRING(2139, "No Joystick")
BANKSTRING(2140, "Joystick:")
BANKSTRING(2141, "Not available:")
BANKSTRING(2142, "Desktop")
BANKSTRING(2150, "Movement")
BANKSTRING(2151, "Menu")
BANKSTRING(2152, "Quick Keys")
BANKSTRING(2153, "--")
BANKSTRING(2154, "Invalid key id: ")
BANKSTRING(2155, "Invalid joy button value: ")
BANKSTRING(2156, "Invalid mouse button id: ")
BANKSTRING(2157, "Invalid joy axis(+): ")
BANKSTRING(2158, "Invalid joy axis(-): ")

View file

@ -143,10 +143,10 @@ std::string getInputCodeToUserString(unsigned int k, size_t joystickID)
}
std::string s = inputcode2string(k);
return s.empty() ? stringbank.get(2153) : s;
return s.empty() ? stringbank.get(SB_BBGE_NO_KEY) : s;
}
static int checkInp(const char *s, int category, int limit, const char *err)
static int checkInp(const char *s, int category, int limit, StringBankIndexBBGE errid)
{
const int k = atoi(s);
if(!k)
@ -155,7 +155,7 @@ static int checkInp(const char *s, int category, int limit, const char *err)
return k + category;
std::ostringstream os;
os << err << k;
os << stringbank.get(errid) << k;
errorLog(os.str());
return 0;
}
@ -171,20 +171,20 @@ int getStringToInputCode(const std::string& s)
else if(s == "MMB")
k = MOUSE_BUTTON_MIDDLE;
else if(!strncmp(s.c_str(), "K:", 2))
k = checkInp(s.c_str() + 2, 0, KEY_MAXARRAY, "Invalid key id: ");
k = checkInp(s.c_str() + 2, 0, KEY_MAXARRAY, SB_BBGE_INVALID_KEY_ID);
else if(!strncmp(s.c_str(), "JB:", 3))
k = checkInp(s.c_str() + 3, JOY_BUTTON_0, JOY_BUTTON_END, "Invalid joy button value: ");
k = checkInp(s.c_str() + 3, JOY_BUTTON_0, JOY_BUTTON_END, SB_BBGE_INVALID_JOY_BTN);
else if(!strncmp(s.c_str(), "MB:", 3))
k = checkInp(s.c_str() + 3, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_EXTRA_END, "Invalid mouse button id: ");
k = checkInp(s.c_str() + 3, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_EXTRA_END, SB_BBGE_INVALID_MOUSE_BTN);
else if(s.length() > 4 && !strncmp(s.c_str(), "AX:", 3))
{
switch(s[3])
{
case '+':
k = checkInp(s.c_str() + 4, JOY_AXIS_0_POS, JOY_AXIS_END_POS, "Invalid joy axis(+): ");
k = checkInp(s.c_str() + 4, JOY_AXIS_0_POS, JOY_AXIS_END_POS, SB_BBGE_INVALID_JOY_AXIS_POS);
break;
case '-':
k = checkInp(s.c_str() + 4, JOY_AXIS_0_NEG, JOY_AXIS_END_NEG, "Invalid joy axis(-): ");
k = checkInp(s.c_str() + 4, JOY_AXIS_0_NEG, JOY_AXIS_END_NEG, SB_BBGE_INVALID_JOY_AXIS_NEG);
break;
default:
return 0;

View file

@ -69,9 +69,7 @@ const std::string& StringBank::get(int idx) const
return it != stringMap.end() ? it->second : emptyStr;
}
void StringBank::addDefault(int idx, const char *str)
void StringBank::set(int idx, const char *str)
{
StringMap::iterator it = stringMap.find(idx);
if(it == stringMap.end())
stringMap[idx] = str;
stringMap[idx] = str;
}

View file

@ -4,6 +4,17 @@
#include <string>
#include <map>
// Some strings used in BBGE
enum StringBankIndexBBGE
{
SB_BBGE_NO_KEY = 2153,
SB_BBGE_INVALID_KEY_ID = 2154,
SB_BBGE_INVALID_JOY_BTN = 2155,
SB_BBGE_INVALID_MOUSE_BTN = 2156,
SB_BBGE_INVALID_JOY_AXIS_POS = 2157,
SB_BBGE_INVALID_JOY_AXIS_NEG = 2158,
};
class StringBank
{
public:
@ -11,8 +22,7 @@ public:
bool load(const std::string &file);
void clear();
bool empty() const;
void addDefault(int idx, const char *str);
void set(int idx, const char *str);
const std::string& get(int idx) const;
protected:

View file

@ -463,6 +463,7 @@ SET(AQUARIA_SRCS
${SRCDIR}/StatsAndAchievements.cpp
${SRCDIR}/SteamRender.cpp
${SRCDIR}/Strand.cpp
${SRCDIR}/StringBank_gen.h
${SRCDIR}/SubtitlePlayer.cpp
${SRCDIR}/ToolTip.cpp
${SRCDIR}/UserSettings.cpp

View file

@ -256,3 +256,8 @@
2151 Menu
2152 Quick Keys
2153 --
2154 Invalid key id:
2155 Invalid joy button value:
2156 Invalid mouse button id:
2157 Invalid joy axis(+):
2158 Invalid joy axis(-):

20
tools/stringbank_gen.lua Normal file
View file

@ -0,0 +1,20 @@
local out = { "// Generated by tools/stringbank_gen.lua" }
for line in io.lines"../files/data/stringbank.txt" do
if #line > 0 then
local id, str = line:match"^%s*(%d+)%s*(.*)$"
if not id then
error("Parse error: " .. line)
end
str = str:gsub("|", "\\n")
str = "BANKSTRING(" .. id .. ", \"" .. str .. "\")"
print(str)
table.insert(out, str)
end
end
table.insert(out, "\n")
local fh = assert(io.open("../Aquaria/StringBank_gen.h", "w"))
fh:write(table.concat(out, "\n"))
fh:close()
print("All done!")