#include "ConsoleCmds.h"
#include "Game.h"
#include "Dialog.h"
+#include "Hotspot.h"
#include "Utils/Folders.h"
const char *cmd_names[cmd_count] = {
extern float slomofreq;
extern int tutoriallevel;
extern int hostile;
-extern XYZ hotspot[40];
-extern int hotspottype[40];
-extern float hotspotsize[40];
-extern char hotspottext[40][256];
extern int maptype;
-extern int numhotspots;
extern Objects objects;
extern int slomo;
extern float slomodelay;
fpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", objects.type[k], objects.yaw[k], objects.pitch[k],
objects.position[k].x, objects.position[k].y, objects.position[k].z, objects.scale[k]);
- fpackf(tfile, "Bi", numhotspots);
- for (int i = 0; i < numhotspots; i++) {
- fpackf(tfile, "Bi Bf Bf Bf Bf", hotspottype[i], hotspotsize[i], hotspot[i].x, hotspot[i].y, hotspot[i].z);
- int templength = strlen(hotspottext[i]);
+ fpackf(tfile, "Bi", Hotspot::hotspots.size());
+ for (int i = 0; i < Hotspot::hotspots.size(); i++) {
+ fpackf(tfile, "Bi Bf Bf Bf Bf", Hotspot::hotspots[i].type, Hotspot::hotspots[i].size, Hotspot::hotspots[i].position.x, Hotspot::hotspots[i].position.y, Hotspot::hotspots[i].position.z);
+ int templength = strlen(Hotspot::hotspots[i].text);
fpackf(tfile, "Bi", templength);
for (int l = 0; l < templength; l++)
- fpackf(tfile, "Bb", hotspottext[i][l]);
+ fpackf(tfile, "Bb", Hotspot::hotspots[i].text[l]);
}
fpackf(tfile, "Bi", Person::players.size());
void ch_hs(const char *args)
{
- hotspot[numhotspots] = Person::players[0]->coords;
-
float size;
int type, shift;
sscanf(args, "%f%d %n", &size, &type, &shift);
- hotspotsize[numhotspots] = size;
- hotspottype[numhotspots] = type;
-
- strcpy(hotspottext[numhotspots], args + shift);
- strcat(hotspottext[numhotspots], "\n");
+ Hotspot::hotspots.emplace_back(Person::players[0]->coords, type, size);
- numhotspots++;
+ strcpy(Hotspot::hotspots.back().text, args + shift);
+ strcat(Hotspot::hotspots.back().text, "\n");
}
void ch_dialogue(const char *args)
void ch_ddialogue(const char *args)
{
- Dialog::dialogs.pop_back();
+ if (!Dialog::dialogs.empty()) {
+ Dialog::dialogs.pop_back();
+ }
}
void ch_dhs(const char *args)
{
- if (numhotspots)
- numhotspots--;
+ if (!Hotspot::hotspots.empty()) {
+ Hotspot::hotspots.pop_back();
+ }
}
void ch_immobile(const char *args)