Maelstrom: Removed the store

From 5b111ebfdd30d17369012838b94e7781f50c6c4e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 22 Nov 2025 23:35:23 -0800
Subject: [PATCH] Removed the store

We're not going to have in-app purchases
---
 CMakeLists.txt           |   4 -
 Data/UI/feature.xml      |  27 -------
 game/MaelstromUI.h       |   1 +
 game/Maelstrom_Globals.h |   4 -
 game/ServiceManager.cpp  |  48 ------------
 game/ServiceManager.h    |  47 ------------
 game/init.cpp            |   8 --
 game/main.cpp            |  32 --------
 game/main.h              |   2 -
 game/store.cpp           | 161 ---------------------------------------
 game/store.h             |  67 ----------------
 11 files changed, 1 insertion(+), 400 deletions(-)
 delete mode 100644 Data/UI/feature.xml
 delete mode 100644 game/ServiceManager.cpp
 delete mode 100644 game/ServiceManager.h
 delete mode 100644 game/store.cpp
 delete mode 100644 game/store.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8cd11944..d050e462 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,11 +79,7 @@ set(MAELSTROM_SOURCES
 	game/replay.h
 	game/scores.cpp
 	game/scores.h
-	game/ServiceManager.cpp
-	game/ServiceManager.h
 	game/shinobi.h
-	game/store.cpp
-	game/store.h
 
 	maclib/bitesex.h
 	maclib/Mac_Compat.h
diff --git a/Data/UI/feature.xml b/Data/UI/feature.xml
deleted file mode 100644
index 43697fcd..00000000
--- a/Data/UI/feature.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<Dialog>
-	<Size w="408" h="168"/>
-	<Elements>
-		<DialogLabel name="message" template="DialogLabel" text="Would you like to purchase this feature?">
-			<Size w="392"/>
-			<Anchor anchorFrom="TOPLEFT" anchorTo="TOPLEFT" x="8" y="8"/>
-		</DialogLabel>
-		<DialogLabel name="title" template="DialogLabel">
-			<Anchor anchorFrom="TOPLEFT" anchorTo="BOTTOMLEFT" anchor="message" x="0" y="8"/>
-		</DialogLabel>
-		<DialogLabel name="description" template="DialogLabel">
-			<Size w="392"/>
-			<TextArea><Anchor anchorFrom="TOPLEFT" anchorTo="TOPLEFT"/></TextArea>
-			<Anchor anchorFrom="TOPLEFT" anchorTo="BOTTOMLEFT" anchor="title" x="0" y="8"/>
-		</DialogLabel>
-		<DialogLabel name="price" template="DialogLabel">
-			<Anchor anchorFrom="LEFT" anchorTo="RIGHT" anchor="title" x="8" y="0"/>
-		</DialogLabel>
-
-		<DialogButton name="button1" template="DialogButton" text="Buy it!" id="1" default="true">
-			<Anchor anchorFrom="BOTTOMRIGHT" anchorTo="BOTTOMRIGHT" x="-10" y="-11"/>
-		</DialogButton>
-		<DialogButton template="DialogButton" text="Cancel">
-			<Anchor anchorFrom="RIGHT" anchorTo="LEFT" anchor="button1" x="-14"/>
-		</DialogButton>
-	</Elements>
-</Dialog>
diff --git a/game/MaelstromUI.h b/game/MaelstromUI.h
index bf3a713c..d3d00ea0 100644
--- a/game/MaelstromUI.h
+++ b/game/MaelstromUI.h
@@ -21,6 +21,7 @@
 */
 
 #include "Maelstrom_Globals.h"
+#include "Localization.h"
 
 #include "../screenlib/UIManager.h"
 #include "../screenlib/UIDrawEngine.h"
diff --git a/game/Maelstrom_Globals.h b/game/Maelstrom_Globals.h
index c2f726fa..6a894cca 100644
--- a/game/Maelstrom_Globals.h
+++ b/game/Maelstrom_Globals.h
@@ -43,7 +43,6 @@
 #include "scores.h"
 #include "controls.h"
 #include "gameinfo.h"
-#include "store.h"
 
 // Preferences keys
 #define PREFERENCES_RESOLUTION "Resolution"
@@ -67,9 +66,6 @@ extern FrameBuf *screen;
 // The UI system
 extern UIManager *ui;
 
-// The Store
-extern StoreManager *store;
-
 /* Boolean type */
 typedef Uint8 Bool;
 
diff --git a/game/ServiceManager.cpp b/game/ServiceManager.cpp
deleted file mode 100644
index 0d07c5be..00000000
--- a/game/ServiceManager.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-/* ----------------------------------------------------------------- */
-/* -- ServiceManager */
-
-#include "MaelstromUI.h"
-#include "ServiceManager.h"
-
-
-ServiceManager::ServiceManager()
-{
-    m_serviceEvent = SDL_RegisterEvents(1);
-}
-
-bool
-ServiceManager::HandleEvent(const SDL_Event &event)
-{
-    if (event.type == m_serviceEvent) {
-        HandleEvent(event.user.code, event.user.data1, event.user.data2);
-        return true;
-    }
-    return false;
-}
-
-void
-ServiceManager::PushEvent(int eventCode, void *data1, void *data2)
-{
-    SDL_Event event;
-
-    event.type = m_serviceEvent;
-    event.user.code = eventCode;
-    event.user.data1 = data1;
-    event.user.data2 = data2;
-    SDL_PushEvent(&event);
-}
-
-void
-ServiceManager::ShowMessage(const char *message, const char *button1Text, const char *button1Action)
-{
-    ::ShowMessage(message, button1Text, button1Action);
-}
-
-void
-ServiceManager::HideMessage()
-{
-    ::HideMessage();
-}
-
-// vim: ts=4:sw=4:expandtab
diff --git a/game/ServiceManager.h b/game/ServiceManager.h
deleted file mode 100644
index 76f433a8..00000000
--- a/game/ServiceManager.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-/* ----------------------------------------------------------------- */
-/* -- Service */
-
-#ifndef _SERVICE_MANAGER_H
-#define _SERVICE_MANAGER_H
-
-// This file defines the interface to custom platform services
-
-#include "Localization.h"
-
-class ServiceManager
-{
-public:
-    ServiceManager();
-    virtual ~ServiceManager() { }
-
-    // Return true if the platform supports this service
-    // If the service is temporarily unavailable, this function should return
-    // true, and the appropriate service functions should show an info message.
-    virtual bool IsAvailable() = 0;
-
-    // Threaded event handling
-    // PushEvent() can be called from any thread
-    // HandleEvent() gets called on main thread
-    bool HandleEvent(const SDL_Event &event);
-    void PushEvent(int eventCode, void *data1 = NULL, void *data2 = NULL);
-    virtual void HandleEvent(int eventCode, void *data1, void *data2) { }
-
-    // Do any per-frame processing
-    virtual void Tick() { }
-
-    //
-    // API called by platform specific code
-    //
-
-    // Show a message in the UI
-    void ShowMessage(const char *message, const char *button1Text = TEXT("Okay"), const char *button1Action = NULL);
-    void HideMessage();
-
-protected:
-    Uint32 m_serviceEvent;
-};
-
-#endif // _SERVICE_MANAGER_H
-
-// vim: ts=4:sw=4:expandtab
diff --git a/game/init.cpp b/game/init.cpp
index abe44327..1347d800 100644
--- a/game/init.cpp
+++ b/game/init.cpp
@@ -48,7 +48,6 @@ Sound    *sound = NULL;
 FontServ *fontserv = NULL;
 FrameBuf *screen = NULL;
 UIManager *ui = NULL;
-StoreManager *store = NULL;
 
 array<Resolution> gResolutions;
 int	gResolutionIndex;
@@ -720,10 +719,6 @@ void CleanUp(void)
 		SDL_free( gReplayFile );
 		gReplayFile = NULL;
 	}
-	if ( store ) {
-		delete store;
-		store = NULL;
-	}
 	if ( ui ) {
 		delete ui;
 		ui = NULL;
@@ -849,9 +844,6 @@ int DoInitializations(Uint32 window_flags)
 	ui->ShowPanel(PANEL_LOADING);
 	ui->Draw();
 
-	/* -- Create the store manager */
-	store = StoreManager::Create();
-
 	/* -- Load in the prize CICN's */
 	if ( LoadCICNS() < 0 )
 		return(-1);
diff --git a/game/main.cpp b/game/main.cpp
index 8ecfb85a..8bf5b789 100644
--- a/game/main.cpp
+++ b/game/main.cpp
@@ -353,11 +353,6 @@ MainPanelDelegate::OnTick()
 bool
 MainPanelDelegate::HandleEvent(const SDL_Event &event)
 {
-	/* -- Handle store events */
-	if (store->HandleEvent(event)) {
-		return true;
-	}
-
 	/* -- Handle file drop requests */
 	if ( event.type == SDL_EVENT_DROP_FILE ) {
 		gReplayFile = SDL_strdup( event.drop.data );
@@ -380,8 +375,6 @@ MainPanelDelegate::OnAction(UIBaseElement *sender, const char *action)
 		OnActionPlay();
 	} else if (SDL_strcmp(action, "multiplayer") == 0) {
 		OnActionMultiplayer();
-	} else if (SDL_strcmp(action, "multiplayer_activated") == 0) {
-		OnActionMultiplayerActivated();
 	} else if (SDL_strcmp(action, "quit") == 0) {
 		OnActionQuitGame();
 	} else if (SDL_strcmp(action, "volume_down") == 0) {
@@ -392,8 +385,6 @@ MainPanelDelegate::OnAction(UIBaseElement *sender, const char *action)
 		OnActionSetVolume(SDL_atoi(action+9));
 	} else if (SDL_strcmp(action, "toggle_kidmode") == 0) {
 		OnActionToggleKidMode(sender);
-	} else if (SDL_strcmp(action, "kidmode_activated") == 0) {
-		OnActionKidModeActivated();
 	} else if (SDL_strcmp(action, "toggle_fullscreen") == 0) {
 		OnActionToggleFullscreen();
 	} else if (SDL_strcmp(action, "screenshot") == 0) {
@@ -422,12 +413,6 @@ MainPanelDelegate::OnActionPlay()
 
 void
 MainPanelDelegate::OnActionMultiplayer()
-{
-	store->ActivateFeature(FEATURE_NETWORK, "multiplayer_activated");
-}
-
-void
-MainPanelDelegate::OnActionMultiplayerActivated()
 {
 	ui->ShowPanel(DIALOG_LOBBY);
 }
@@ -493,26 +478,9 @@ MainPanelDelegate::OnActionToggleKidMode(UIBaseElement *sender)
 		return;
 	}
 
-	if (checkbox->IsChecked()) {
-		if (!store->HasFeature(FEATURE_KIDMODE)) {
-			checkbox->SetChecked(false);
-			store->ActivateFeature(FEATURE_KIDMODE, "kidmode_activated");
-		}
-	}
 	checkbox->SaveData(prefs);
 }
 
-void
-MainPanelDelegate::OnActionKidModeActivated()
-{
-	UIElementCheckbox *checkbox = m_panel->GetElement<UIElementCheckbox>("kidmode");
-
-	if (!checkbox) {
-		return;
-	}
-	checkbox->SetChecked(true);
-}
-
 void
 MainPanelDelegate::OnActionScreenshot()
 {
diff --git a/game/main.h b/game/main.h
index a28306fa..2de15061 100644
--- a/game/main.h
+++ b/game/main.h
@@ -41,14 +41,12 @@ class MainPanelDelegate : public UIPanelDelegate
 protected:
 	void OnActionPlay();
 	void OnActionMultiplayer();
-	void OnActionMultiplayerActivated();
 	void OnActionQuitGame();
 	void OnActionVolumeDown();
 	void OnActionVolumeUp();
 	void OnActionSetVolume(int volume);
 	void OnActionToggleFullscreen();
 	void OnActionToggleKidMode(UIBaseElement *sender);
-	void OnActionKidModeActivated();
 	void OnActionScreenshot();
 	void OnActionCheat();
 	void OnActionRunLastReplay();
diff --git a/game/store.cpp b/game/store.cpp
deleted file mode 100644
index 5889e97d..00000000
--- a/game/store.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-
-/* ----------------------------------------------------------------- */
-/* -- Store */
-
-#include "Maelstrom_Globals.h"
-#include "MaelstromUI.h"
-#include "store.h"
-
-#ifndef USING_STOREKIT
-#define STORE_SIMPLE
-#endif
-
-
-struct PurchaseInfo {
-    PurchaseInfo(StoreManager *manager, void *context,
-                 const char *title, const char *description, const char *price)
-        : manager(manager),
-          context(context),
-          title(title ? SDL_strdup(title) : NULL),
-          description(description ? SDL_strdup(description) : NULL),
-          price(price ? SDL_strdup(price) : NULL)
-    { }
-
-    ~PurchaseInfo() {
-        if (this->title) {
-            SDL_free(this->title);
-        }
-        if (this->description) {
-            SDL_free(this->description);
-        }
-        if (this->price) {
-            SDL_free(this->price);
-        }
-    }
-
-    StoreManager *manager;
-    void *context;
-    char *title;
-    char *description;
-    char *price;
-};
-
-static void PurchaseDialogInit(void *param, UIDialog *dialog)
-{
-    PurchaseInfo *info = (PurchaseInfo *)param;
-
-    UIElement *title = dialog->GetElement<UIElement>("title");
-    if (title) {
-        title->SetText(info->title);
-    }
-
-    UIElement *description = dialog->GetElement<UIElement>("description");
-    if (description) {
-        description->SetText(info->description);
-    }
-
-    UIElement *price = dialog->GetElement<UIElement>("price");
-    if (price) {
-        price->SetText(info->price);
-    }
-}
-
-static void PurchaseDialogDone(void *param, UIDialog *dialog, int status)
-{
-    PurchaseInfo *info = (PurchaseInfo *)param;
-
-    bool shouldPurchase = (status > 0);
-    info->manager->PurchaseDialogResult(info->context, shouldPurchase);
-    delete info;
-}
-
-
-#ifdef STORE_SIMPLE
-
-class StoreManagerSimple : public StoreManager
-{
-public:
-    StoreManagerSimple() : StoreManager() { }
-
-    virtual bool IsAvailable() {
-        return false;
-    }
-    virtual bool HasFeature(const char *feature);
-    virtual void GrantFeature(const char *feature);
-    virtual void ActivateFeature(const char *feature,
-                                 const char *action_activate,
-                                 const char *action_canceled);
-    virtual void PurchaseDialogResult(void *context, bool shouldPurchase) { }
-};
-
-bool
-StoreManagerSimple::HasFeature(const char *feature)
-{
-    return true;
-}
-
-void
-StoreManagerSimple::GrantFeature(const char *feature)
-{
-}
-
-void
-StoreManagerSimple::ActivateFeature(const char *feature,
-                                    const char *action_activate,
-                                    const char *action_canceled)
-{
-    PerformAction(action_activate);
-}
-
-StoreManager *
-StoreManager::Create()
-{
-    return new StoreManagerSimple;
-}
-
-#endif // STORE_SIMPLE
-
-
-StoreManager::StoreManager() : ServiceManager()
-{
-}
-
-void
-StoreManager::ShowPurchaseDialog(void *context, const char *title, const char *description, const char *price)
-{
-    UIDialog *dialog = ui->GetPanel<UIDialog>(DIALOG_FEATURE);
-    if (dialog) {
-        PurchaseInfo *info = new PurchaseInfo(this, context,
-                                              title, description, price);
-        dialog->SetDialogInitHandler(PurchaseDialogInit, info);
-        dialog->SetDialogDoneHandler(PurchaseDialogDone, info);
-        ui->ShowPanel(dialog);
-    }
-}
-
-void
-StoreManager::ShowPurchaseCanceled(const char *message, const char *action)
-{
-    if (message && *message) {
-        ::ShowMessage(message, TEXT("Okay"), action);
-    } else {
-        PerformAction(action);
-    }
-}
-
-void
-StoreManager::ShowPurchaseComplete(const char *action)
-{
-    ::ShowMessage(TEXT("Thank you for your purchase!"), TEXT("Okay"), action);
-}
-
-void
-StoreManager::PerformAction(const char *action)
-{
-    UIPanel *panel = ui->GetCurrentPanel();
-    if (panel && action) {
-        panel->Action(NULL, action);
-    }
-}
-
-// vim: ts=4:sw=4:expandtab
diff --git a/game/store.h b/game/store.h
deleted file mode 100644
index 86ee4ede..00000000
--- a/game/store.h
+++ /dev/null
@@ -1,67 +0,0 @@
-
-/* ----------------------------------------------------------------- */
-/* -- Store */
-
-#ifndef _STORE_H
-#define _STORE_H
-
-// This file defines the interface to the store functionality
-
-#include "ServiceManager.h"
-
-// Paid features
-#define FEATURE_KIDMODE	"Feature.KidMode"
-#define FEATURE_NETWORK	"Feature.Network"
-
-class StoreManager : public ServiceManager
-{
-public:
-    static StoreManager *Create();
-
-public:
-    StoreManager();
-    virtual ~StoreManager() { }
-
-    // Returns true if a feature has been purchased
-    virtual bool HasFeature(const char *feature) = 0;
-
-    // Grant a feature as though it had been purchased
-    virtual void GrantFeature(const char *feature) = 0;
-
-    // If the feature has already been purchased, no UI should be shown,
-    // and the action should be executed immediately.
-    //
-    // If the feature has not been purchased, UI should be shown allowing
-    // the user to purchase the feature.
-    //
-    // If the feature can not be purchased or the purchase is cancelled,
-    // the appropriate UI should be shown and no action should be taken.
-    virtual void ActivateFeature(const char *feature,
-                                 const char *action_activate,
-                                 const char *action_canceled = NULL) = 0;
-
-    // The function called when the purchase dialog returns
-    virtual void PurchaseDialogResult(void *context, bool shouldPurchase) = 0;
-
-    //
-    // API called by platform specific code
-    //
-
-    // Show the feature purchase dialog (Would you like to buy this?)
-    void ShowPurchaseDialog(void *context, const char *title, const char *description, const char *price);
-
-    // Show an optional message and perform the cancel action
-    // The message should be NULL if the action was canceled by the user,
-    // and set to an error message if the purchase failed for some reason.
-    void ShowPurchaseCanceled(const char *message, const char *action);
-
-    // Show a thank you note and perform the activate action
-    void ShowPurchaseComplete(const char *action);
-
-    // Perform an action once a feature is available
-    void PerformAction(const char *action);
-};
-
-#endif // _STORE_H
-
-// vim: ts=4:sw=4:expandtab