├── src
├── framework
│ ├── misc
│ │ ├── Flags.cpp
│ │ ├── fcaseopen.h
│ │ ├── CMakeLists.txt
│ │ ├── Ratio.cpp
│ │ ├── PropertiesParser.h
│ │ ├── MTRand.h
│ │ ├── Ratio.h
│ │ ├── Flags.h
│ │ ├── Point.h
│ │ ├── Debug.h
│ │ ├── Buffer.h
│ │ ├── ModVal.h
│ │ ├── XMLParser.h
│ │ ├── RegistryEmulator.h
│ │ ├── SexyMatrix.h
│ │ ├── memmgr.h
│ │ ├── DescParser.h
│ │ ├── Rect.h
│ │ └── KeyCodes.h
│ ├── imagelib
│ │ ├── CMakeLists.txt
│ │ └── ImageLib.h
│ ├── paklib
│ │ └── CMakeLists.txt
│ ├── widget
│ │ ├── SliderListener.h
│ │ ├── Insets.cpp
│ │ ├── ScrollListener.h
│ │ ├── CheckboxListener.h
│ │ ├── DialogListener.h
│ │ ├── Insets.h
│ │ ├── ListListener.h
│ │ ├── CMakeLists.txt
│ │ ├── DialogButton.h
│ │ ├── ButtonListener.h
│ │ ├── EditListener.h
│ │ ├── HyperlinkWidget.h
│ │ ├── ScrollbuttonWidget.h
│ │ ├── Slider.h
│ │ ├── Checkbox.h
│ │ ├── HyperlinkWidget.cpp
│ │ ├── TextWidget.h
│ │ ├── ScrollbuttonWidget.cpp
│ │ ├── ButtonWidget.h
│ │ ├── Checkbox.cpp
│ │ ├── ScrollbarWidget.h
│ │ ├── DialogButton.cpp
│ │ ├── WidgetContainer.h
│ │ ├── ListWidget.h
│ │ └── EditWidget.h
│ ├── graphics
│ │ ├── CMakeLists.txt
│ │ ├── TriVertex.h
│ │ ├── shaders
│ │ │ ├── shader.vert
│ │ │ ├── CMakeLists.txt
│ │ │ └── water.comp
│ │ ├── Font.h
│ │ ├── Font.cpp
│ │ ├── Color.h
│ │ ├── VkInterface.h
│ │ ├── WindowInterface.h
│ │ ├── Color.cpp
│ │ └── VkCommon.h
│ ├── resource.h
│ ├── CursorWidget.h
│ ├── sound
│ │ ├── DummySoundInstance.h
│ │ ├── SoundInstance.h
│ │ ├── DummySoundManager.h
│ │ ├── DummyMusicInterface.h
│ │ ├── SoundManager.h
│ │ ├── BassSoundInstance.h
│ │ ├── MusicInterface.h
│ │ ├── CMakeLists.txt
│ │ ├── BassSoundManager.h
│ │ ├── BassMusicInterface.h
│ │ └── BassSoundInstance.cpp
│ ├── LawnProject.rc
│ ├── SexyApp.h
│ └── .gitattributes
├── lawn
│ ├── Cutscene.h
│ ├── LawnMower.cpp
│ ├── Projectile.cpp
│ ├── widget
│ │ ├── GameButton.cpp
│ │ ├── UserDialog.cpp
│ │ ├── AlmanacDialog.cpp
│ │ ├── ImitaterDialog.cpp
│ │ ├── CMakeLists.txt
│ │ ├── ImitaterDialog.h
│ │ ├── ContinueDialog.h
│ │ ├── CheatDialog.h
│ │ ├── NewUserDialog.h
│ │ ├── UserDialog.h
│ │ ├── AchievementsScreen.h
│ │ ├── NewOptionsDialog.h
│ │ ├── TitleScreen.h
│ │ ├── AwardScreen.h
│ │ ├── LawnDialog.h
│ │ ├── AlmanacDialog.h
│ │ ├── NewUserDialog.cpp
│ │ └── ChallengeScreen.h
│ ├── system
│ │ ├── CMakeLists.txt
│ │ ├── TypingCheck.h
│ │ ├── TypingCheck.cpp
│ │ ├── PoolEffect.h
│ │ ├── ProfileMgr.h
│ │ ├── ReanimationLawn.h
│ │ └── SaveGame.h
│ ├── BoardInclude.h
│ ├── CMakeLists.txt
│ ├── GameObject.h
│ ├── GameObject.cpp
│ ├── CursorObject.h
│ ├── ToolTipWidget.h
│ ├── LawnMower.h
│ ├── MessageWidget.h
│ ├── LawnCommon.h
│ ├── Coin.h
│ ├── SeedPacket.h
│ ├── Projectile.h
│ └── GridItem.h
├── res
│ ├── Cursor13.cur
│ └── CMakeLists.txt
├── compiler
│ ├── CMakeLists.txt
│ ├── array.h
│ ├── hash.h
│ ├── quick_sort.h
│ └── map.h
├── todlib
│ ├── CMakeLists.txt
│ ├── FilterEffect.h
│ ├── ReanimAtlas.h
│ ├── EffectSystem.h
│ ├── TodDebug.cpp
│ ├── Trail.h
│ └── TodList.cpp
├── CMakeLists.txt
├── main.cpp
└── GameConstants.h
├── .gitattributes
├── tools
├── trackdef-token-matcher.re
├── SelectorScreen.reanim.diff
└── unpak.c
├── configure.sh
├── profile.sh
├── clang-format-all.sh
├── install.sh
├── run.sh
├── toolchain.cmake
├── .clang-format
├── CMakeSettings.json
├── cmake
└── embed_binary.cmake
└── re-plants-vs-zombies.sublime-project
/src/framework/misc/Flags.cpp:
--------------------------------------------------------------------------------
1 | #include "Flags.h"
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/src/lawn/Cutscene.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/lawn/Cutscene.h
--------------------------------------------------------------------------------
/src/res/Cursor13.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/res/Cursor13.cur
--------------------------------------------------------------------------------
/src/lawn/LawnMower.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/lawn/LawnMower.cpp
--------------------------------------------------------------------------------
/src/lawn/Projectile.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/lawn/Projectile.cpp
--------------------------------------------------------------------------------
/tools/trackdef-token-matcher.re:
--------------------------------------------------------------------------------
1 | (?:[-0-9.]+|\[(?:(?:[-0-9.]+(?: [a-Z]+)? [-0-9.]+)|(?:[-0-9.]+))\])(,[-0-9.]+)?
--------------------------------------------------------------------------------
/src/lawn/widget/GameButton.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/lawn/widget/GameButton.cpp
--------------------------------------------------------------------------------
/src/lawn/widget/UserDialog.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/lawn/widget/UserDialog.cpp
--------------------------------------------------------------------------------
/src/lawn/widget/AlmanacDialog.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/lawn/widget/AlmanacDialog.cpp
--------------------------------------------------------------------------------
/src/framework/imagelib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | "ImageLib.cpp"
3 | "ImageLib.h"
4 | )
5 |
--------------------------------------------------------------------------------
/src/lawn/widget/ImitaterDialog.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minerscale/re-plants-vs-zombies/HEAD/src/lawn/widget/ImitaterDialog.cpp
--------------------------------------------------------------------------------
/src/framework/paklib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | "PakInterface.cpp"
3 | "PakInterface.h"
4 | )
5 |
--------------------------------------------------------------------------------
/configure.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | rm -rf build
4 | rm -f compile_commands.json
5 | cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake -G Ninja -B build
6 |
--------------------------------------------------------------------------------
/profile.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cd tools/run/
4 |
5 | perf record -e cycles -e cache-misses -e branch-misses -g --call-graph=dwarf -F 762 ./PlantsVsZombies
6 | #perf script -F +pid > test-conv.perf
7 |
--------------------------------------------------------------------------------
/clang-format-all.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | git ls-tree -r $(git rev-parse --abbrev-ref HEAD) --name-only |
4 | grep -E "(\.cpp|\.c|\.hpp|\.h)$" |
5 | while read line; do
6 | clang-format -style=file -i "$line";
7 | done
8 |
--------------------------------------------------------------------------------
/tools/SelectorScreen.reanim.diff:
--------------------------------------------------------------------------------
1 | 24110c24110
2 | < 405.0624.0IMAGE_REANIM_SELECTORSCREEN_STARTADVENTURE_BUTTON1
3 | ---
4 | > 405.0624.0IMAGE_REANIM_SELECTORSCREEN_ADVENTURE_BUTTON
5 |
--------------------------------------------------------------------------------
/src/compiler/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | ${CMAKE_CURRENT_SOURCE_DIR}/quick_sort.h
3 | ${CMAKE_CURRENT_SOURCE_DIR}/hash.h
4 | ${CMAKE_CURRENT_SOURCE_DIR}/map.h
5 | ${CMAKE_CURRENT_SOURCE_DIR}/array.h
6 | )
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cmake --build build -j6
4 | if [ $? -eq 0 ]; then
5 | mkdir -p tools/run
6 | cp build/compile_commands.json .
7 | cp build/PlantsVsZombies tools/run/PlantsVsZombies
8 | cp build/libbass.so tools/run/libbass.so
9 | fi
10 |
--------------------------------------------------------------------------------
/run.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | rm -f tools/run/PlantsVsZombies
4 |
5 | ./install.sh
6 | cd tools/run
7 |
8 | if test -f ./PlantsVsZombies
9 | then
10 | if [[ $1 = "-g" ]]
11 | then
12 | lldb ./PlantsVsZombies
13 | else
14 | gamemoderun ./PlantsVsZombies
15 | fi
16 | fi
17 |
--------------------------------------------------------------------------------
/src/lawn/system/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | Music.cpp
3 | PlayerInfo.cpp
4 | SaveGame.cpp
5 | ReanimationLawn.cpp
6 | ProfileMgr.cpp
7 | PoolEffect.cpp
8 | TypingCheck.cpp
9 | DataSync.cpp
10 | )
11 |
--------------------------------------------------------------------------------
/toolchain.cmake:
--------------------------------------------------------------------------------
1 | #set(CMAKE_SYSTEM_NAME Windows)
2 | set(CMAKE_SYSTEM_PROCESSOR x86_64)
3 | set(CMAKE_BUILD_TYPE Release)
4 | set(CHOST "")
5 | set(CMAKE_C_COMPILER "clang")
6 | set(CMAKE_CXX_COMPILER "clang++")
7 | #set(CMAKE_RC_COMPILER "${CHOST}-windres")
8 | set(CMAKE_FIND_ROOT_PATH "/usr/${CHOST}")
9 |
--------------------------------------------------------------------------------
/src/framework/widget/SliderListener.h:
--------------------------------------------------------------------------------
1 | #ifndef __SLIDERLISTENER_H__
2 | #define __SLIDERLISTENER_H__
3 |
4 | namespace Sexy {
5 | class SliderListener {
6 | public:
7 | virtual void SliderVal(int theId, double theVal) = 0;
8 | };
9 | } // namespace Sexy
10 |
11 | #endif //__SLIDERLISTENER_H__
12 |
--------------------------------------------------------------------------------
/src/framework/widget/Insets.cpp:
--------------------------------------------------------------------------------
1 | #include "Insets.h"
2 |
3 | using namespace Sexy;
4 |
5 | Insets::Insets() : mLeft(0), mTop(0), mRight(0), mBottom(0) {}
6 |
7 | Insets::Insets(int theLeft, int theTop, int theRight, int theBottom)
8 | : mLeft(theLeft), mTop(theTop), mRight(theRight), mBottom(theBottom) {}
9 |
--------------------------------------------------------------------------------
/src/framework/widget/ScrollListener.h:
--------------------------------------------------------------------------------
1 | #ifndef __SCROLLLISTENER_H__
2 | #define __SCROLLLISTENER_H__
3 |
4 | namespace Sexy {
5 | class ScrollListener {
6 | public:
7 | virtual void ScrollPosition(int theId, double thePosition) = 0;
8 | };
9 | } // namespace Sexy
10 |
11 | #endif // __SCROLLLISTENER_H__
12 |
--------------------------------------------------------------------------------
/src/framework/widget/CheckboxListener.h:
--------------------------------------------------------------------------------
1 | #ifndef __CHECKBOX_LISTENER__
2 | #define __CHECKBOX_LISTENER__
3 |
4 | namespace Sexy {
5 | class CheckboxListener {
6 | public:
7 | virtual void CheckboxChecked(int theId, bool checked) = 0;
8 | };
9 | } // namespace Sexy
10 |
11 | #endif //__CHECKBOX_LISTENER__
12 |
--------------------------------------------------------------------------------
/src/framework/misc/fcaseopen.h:
--------------------------------------------------------------------------------
1 | #ifndef fcaseopen_h
2 | #define fcaseopen_h
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | FILE *fcaseopen(const char *path, const char *mode);
9 |
10 | #if !defined(_WIN32)
11 | std::string casepath(const std::string &path);
12 | #else
13 | #define casepath(path) (path)
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/framework/widget/DialogListener.h:
--------------------------------------------------------------------------------
1 | #ifndef __DIALOGLISTENER_H__
2 | #define __DIALOGLISTENER_H__
3 |
4 | namespace Sexy {
5 | class DialogListener {
6 | public:
7 | virtual void DialogButtonPress(int theDialogId, int theButtonId) = 0;
8 | virtual void DialogButtonDepress(int theDialogId, int theButtonId) = 0;
9 | };
10 | } // namespace Sexy
11 |
12 | #endif // __DIALOGLISTENER_H__
13 |
--------------------------------------------------------------------------------
/src/todlib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | Attachment.cpp
3 | EffectSystem.cpp
4 | ReanimAtlas.cpp
5 | TodCommon.cpp
6 | TodFoley.cpp
7 | TodParticle.cpp
8 | Trail.cpp
9 | Definition.cpp
10 | FilterEffect.cpp
11 | Reanimator.cpp
12 | TodDebug.cpp
13 | TodList.cpp
14 | TodStringFile.cpp
15 | )
16 |
--------------------------------------------------------------------------------
/src/framework/widget/Insets.h:
--------------------------------------------------------------------------------
1 | #ifndef __INSETS_H__
2 | #define __INSETS_H__
3 |
4 | namespace Sexy {
5 | class Insets {
6 | public:
7 | int mLeft;
8 | int mTop;
9 | int mRight;
10 | int mBottom;
11 |
12 | public:
13 | Insets();
14 | Insets(int theLeft, int theTop, int theRight, int theBottom);
15 | // Insets(const Insets& theInsets);
16 | };
17 | } // namespace Sexy
18 |
19 | #endif //__INSETS_H__
20 |
--------------------------------------------------------------------------------
/src/framework/widget/ListListener.h:
--------------------------------------------------------------------------------
1 | #ifndef __LISTLISTENER_H__
2 | #define __LISTLISTENER_H__
3 |
4 | namespace Sexy {
5 | class ListListener {
6 | public:
7 | virtual void ListClicked(int theId, int theIdx, int theClickCount) = 0;
8 | virtual void ListClosed(int theId) = 0;
9 | virtual void ListHiliteChanged(int theId, int theOldIdx, int theNewIdx) = 0;
10 | };
11 | } // namespace Sexy
12 |
13 | #endif //__LISTLISTENER_H__
14 |
--------------------------------------------------------------------------------
/src/framework/misc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | "Buffer.cpp"
3 | "Debug.cpp"
4 | "DescParser.cpp"
5 | "Flags.cpp"
6 | "KeyCodes.cpp"
7 | "MTRand.cpp"
8 | "PropertiesParser.cpp"
9 | "Ratio.cpp"
10 | "ResourceManager.cpp"
11 | "SexyMatrix.cpp"
12 | "XMLParser.cpp"
13 | "RegistryEmulator.cpp"
14 | "fcaseopen.cpp"
15 | )
16 |
--------------------------------------------------------------------------------
/src/framework/graphics/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(ExternalProject)
2 |
3 | find_package(Vulkan REQUIRED)
4 |
5 | target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::Vulkan)
6 |
7 | target_sources(${PROJECT_NAME} PRIVATE
8 | Color.cpp
9 | Color.h
10 | Font.cpp
11 | Graphics.cpp
12 | Image.cpp
13 | ImageFont.cpp
14 | VkInterface.cpp
15 | VkImage.cpp
16 | )
17 |
18 | add_subdirectory(shaders)
19 |
--------------------------------------------------------------------------------
/src/framework/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ 生成的包含文件。
3 | // 供 LawnProject.rc 使用
4 | //
5 | #define IDC_CURSOR1 102
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 103
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/framework/CursorWidget.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURSORWIDGET_H__
2 | #define __CURSORWIDGET_H__
3 |
4 | #include "Point.h"
5 | #include "Widget.h"
6 |
7 | namespace Sexy {
8 |
9 | class Image;
10 |
11 | class CursorWidget : public Widget {
12 | public:
13 | Image *mImage;
14 |
15 | public:
16 | CursorWidget();
17 |
18 | virtual void Draw(Graphics *g);
19 | void SetImage(Image *theImage);
20 | Point GetHotspot();
21 | };
22 |
23 | } // namespace Sexy
24 |
25 | #endif //__CURSORWIDGET_H__
26 |
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | BasedOnStyle: LLVM
3 | ColumnLimit: 120
4 | AccessModifierOffset: -4
5 | AlignAfterOpenBracket: BlockIndent
6 | AlignArrayOfStructures: Left
7 | AlignConsecutiveShortCaseStatements:
8 | Enabled: true
9 | AllowShortBlocksOnASingleLine: Empty
10 | AllowShortCaseLabelsOnASingleLine: true
11 | AllowShortIfStatementsOnASingleLine: AllIfsAndElse
12 | IndentWidth: 4
13 | LineEnding: LF
14 | NamespaceIndentation: Inner
15 | TabWidth: 4
16 | BraceWrapping:
17 | AfterControlStatement: MultiLine
18 |
--------------------------------------------------------------------------------
/src/framework/widget/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | "ButtonWidget.cpp"
3 | "Checkbox.cpp"
4 | "Dialog.cpp"
5 | "DialogButton.cpp"
6 | "EditWidget.cpp"
7 | "HyperlinkWidget.cpp"
8 | "Insets.cpp"
9 | "ListWidget.cpp"
10 | "ScrollbarWidget.cpp"
11 | "ScrollbuttonWidget.cpp"
12 | "Slider.cpp"
13 | "TextWidget.cpp"
14 | "Widget.cpp"
15 | "WidgetContainer.cpp"
16 | "WidgetManager.cpp"
17 | )
18 |
--------------------------------------------------------------------------------
/src/framework/widget/DialogButton.h:
--------------------------------------------------------------------------------
1 | #ifndef __DIALOGBUTTON_H__
2 | #define __DIALOGBUTTON_H__
3 |
4 | #include "ButtonWidget.h"
5 |
6 | namespace Sexy {
7 | class DialogButton : public ButtonWidget {
8 | public:
9 | Image *mComponentImage;
10 | int mTranslateX, mTranslateY;
11 | int mTextOffsetX, mTextOffsetY;
12 |
13 | public:
14 | DialogButton(Image *theComponentImage, int theId, ButtonListener *theListener);
15 |
16 | void Draw(Graphics *g) override;
17 | };
18 | } // namespace Sexy
19 |
20 | #endif //__DIALOGBUTTON_H__
21 |
--------------------------------------------------------------------------------
/src/lawn/BoardInclude.h:
--------------------------------------------------------------------------------
1 | #include "Board.h"
2 | #include "Challenge.h"
3 | #include "Coin.h"
4 | #include "CursorObject.h"
5 | #include "Cutscene.h"
6 | #include "GameConstants.h"
7 | #include "GridItem.h"
8 | #include "LawnApp.h"
9 | #include "LawnMower.h"
10 | #include "MessageWidget.h"
11 | #include "Plant.h"
12 | #include "Projectile.h"
13 | #include "Resources.h"
14 | #include "SeedPacket.h"
15 | #include "ToolTipWidget.h"
16 | #include "Zombie.h"
17 | #include "graphics/Graphics.h"
18 | #include "misc/Debug.h"
19 | #include "widget/GameButton.h"
20 |
--------------------------------------------------------------------------------
/src/lawn/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | Board.cpp
3 | LawnMower.cpp
4 | GameObject.cpp
5 | SeedPacket.cpp
6 | CutScene.cpp
7 | Challenge.cpp
8 | CursorObject.cpp
9 | Coin.cpp
10 | Projectile.cpp
11 | Plant.cpp
12 | Zombie.cpp
13 | ToolTipWidget.cpp
14 | ZenGarden.cpp
15 | MessageWidget.cpp
16 | LawnCommon.cpp
17 | GridItem.cpp
18 | )
19 |
20 | add_subdirectory(system)
21 | add_subdirectory(widget)
22 |
--------------------------------------------------------------------------------
/src/framework/widget/ButtonListener.h:
--------------------------------------------------------------------------------
1 | #ifndef __BUTTONLISTENER_H__
2 | #define __BUTTONLISTENER_H__
3 |
4 | namespace Sexy {
5 | class ButtonListener {
6 | public:
7 | virtual void ButtonPress(int theId) = 0;
8 | virtual void ButtonDepress(int theId) = 0;
9 | virtual void ButtonDownTick(int theId) = 0;
10 | virtual void ButtonMouseEnter(int theId) = 0;
11 | virtual void ButtonMouseLeave(int theId) = 0;
12 | virtual void ButtonMouseMove(int theId, int theX, int theY) = 0;
13 | };
14 | } // namespace Sexy
15 |
16 | #endif //__BUTTONLISTENER_H__
17 |
--------------------------------------------------------------------------------
/src/lawn/widget/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_sources(${PROJECT_NAME} PRIVATE
2 | NewUserDialog.cpp
3 | AlmanacDialog.cpp
4 | SeedChooserScreen.cpp
5 | ImitaterDialog.cpp
6 | ContinueDialog.cpp
7 | AwardScreen.cpp
8 | GameButton.cpp
9 | LawnDialog.cpp
10 | GameSelector.cpp
11 | StoreScreen.cpp
12 | CreditScreen.cpp
13 | AchievementsScreen.cpp
14 | UserDialog.cpp
15 | ChallengeScreen.cpp
16 | NewOptionsDialog.cpp
17 | CheatDialog.cpp
18 | TitleScreen.cpp
19 | )
20 |
--------------------------------------------------------------------------------
/src/framework/widget/EditListener.h:
--------------------------------------------------------------------------------
1 | #ifndef __EDITLISTENER_H__
2 | #define __EDITLISTENER_H__
3 |
4 | #include "framework/Common.h"
5 |
6 | namespace Sexy {
7 | class EditListener {
8 | public:
9 | virtual void EditWidgetText(int theId, const SexyString &theString) = 0;
10 |
11 | // virtual bool AllowKey(int theId, KeyCode theKey) { return true; }
12 | // virtual bool AllowChar(int theId, SexyChar theChar) { return true; }
13 | // virtual bool AllowText(int theId, const SexyString& theText) { return true; }
14 | };
15 | } // namespace Sexy
16 |
17 | #endif //__EDITLISTENER_H__
18 |
--------------------------------------------------------------------------------
/src/lawn/GameObject.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "framework/graphics/Graphics.h"
4 |
5 | using namespace Sexy;
6 |
7 | class LawnApp;
8 | class Board;
9 |
10 | class GameObject {
11 | public:
12 | LawnApp *mApp;
13 | Board *mBoard;
14 | int mX;
15 | int mY;
16 | int mWidth;
17 | int mHeight;
18 | bool mVisible;
19 | int mRow;
20 | int mRenderOrder;
21 |
22 | public:
23 | /*inline*/ GameObject();
24 | /*inline*/ bool BeginDraw(Graphics *g) const;
25 | /*inline*/ void EndDraw(Graphics *g);
26 | /*inline*/ void MakeParentGraphicsFrame(Graphics *g);
27 | };
28 |
--------------------------------------------------------------------------------
/src/framework/widget/HyperlinkWidget.h:
--------------------------------------------------------------------------------
1 | #ifndef __HYPERLINKWIDGET_H__
2 | #define __HYPERLINKWIDGET_H__
3 |
4 | #include "ButtonWidget.h"
5 |
6 | namespace Sexy {
7 | class HyperlinkWidget : public ButtonWidget {
8 | public:
9 | Color mColor;
10 | Color mOverColor;
11 | int mUnderlineSize;
12 | int mUnderlineOffset;
13 |
14 | public:
15 | HyperlinkWidget(int theId, ButtonListener *theButtonListener);
16 |
17 | void Draw(Graphics *g) override;
18 | void MouseEnter() override;
19 | void MouseLeave() override;
20 | };
21 | } // namespace Sexy
22 |
23 | #endif //__HYPERLINKWIDGET_H__
24 |
--------------------------------------------------------------------------------
/src/compiler/array.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace compiler {
4 | template static constexpr auto SparseArray() {
5 | using T = decltype(arr)::value_type::second_type;
6 |
7 | constexpr auto max_key = std::max_element(arr.begin(), arr.end(), [](const auto &left, const auto &right) {
8 | return left.first < right.first;
9 | })->first;
10 |
11 | std::array sparse_array{};
12 |
13 | for (auto it : arr) {
14 | sparse_array[it.first] = it.second;
15 | }
16 |
17 | return sparse_array;
18 | }
19 | } // namespace compiler
--------------------------------------------------------------------------------
/src/lawn/system/TypingCheck.h:
--------------------------------------------------------------------------------
1 | #ifndef __TYPINGCHECK_H__
2 | #define __TYPINGCHECK_H__
3 |
4 | #include "framework/misc/KeyCodes.h"
5 | #include
6 |
7 | class TypingCheck {
8 | protected:
9 | std::string mPhrase;
10 | std::string mRecentTyping;
11 |
12 | public:
13 | TypingCheck() : mPhrase() {}
14 |
15 | TypingCheck(const std::string &thePhrase);
16 |
17 | void SetPhrase(const std::string &thePhrase);
18 | /*inline*/ void AddKeyCode(Sexy::KeyCode theKeyCode);
19 | void AddChar(char theChar);
20 | /*inline*/ bool Check();
21 | bool Check(Sexy::KeyCode theKeyCode);
22 | };
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/src/lawn/GameObject.cpp:
--------------------------------------------------------------------------------
1 | #include "GameObject.h"
2 | #include "LawnApp.h"
3 |
4 | GameObject::GameObject() {
5 | mApp = gLawnApp;
6 | mBoard = gLawnApp->mBoard;
7 | mX = 0;
8 | mY = 0;
9 | mWidth = 0;
10 | mHeight = 0;
11 | mVisible = true;
12 | mRow = -1;
13 | mRenderOrder = RenderLayer::RENDER_LAYER_TOP;
14 | }
15 |
16 | bool GameObject::BeginDraw(Graphics *g) const {
17 | if (!mVisible) return false;
18 |
19 | g->Translate(mX, mY);
20 | return true;
21 | }
22 |
23 | void GameObject::EndDraw(Graphics *g) { g->Translate(-mX, -mY); }
24 |
25 | void GameObject::MakeParentGraphicsFrame(Graphics *g) { g->Translate(-mX, -mY); }
26 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | target_compile_definitions(${PROJECT_NAME} PRIVATE
2 | "$<$:"
3 | "_DEBUG;"
4 | ">"
5 | "$<$:"
6 | "NDEBUG;"
7 | "RELEASEFINAL;"
8 | ">"
9 | )
10 |
11 | target_include_directories(${PROJECT_NAME} PRIVATE
12 | "${CMAKE_BINARY_DIR}/include"
13 | "${CMAKE_SOURCE_DIR}/src"
14 | )
15 |
16 | target_sources(${PROJECT_NAME} PRIVATE
17 | main.cpp
18 | LawnApp.cpp
19 | Resources.cpp
20 | )
21 |
22 | add_subdirectory(framework)
23 | add_subdirectory(todlib)
24 | add_subdirectory(lawn)
25 | add_subdirectory(res)
26 | add_subdirectory(compiler)
27 |
--------------------------------------------------------------------------------
/src/framework/widget/ScrollbuttonWidget.h:
--------------------------------------------------------------------------------
1 | #ifndef __SCROLLBUTTONWIDGET_H__
2 | #define __SCROLLBUTTONWIDGET_H__
3 |
4 | #include "widget/ButtonWidget.h"
5 |
6 | namespace Sexy {
7 | class ButtonListener;
8 |
9 | class ScrollbuttonWidget : public ButtonWidget {
10 | public:
11 | bool mHorizontal;
12 |
13 | // mType is a new way of doing things (1 = up, 2 = down, 3 = left, 4 = right).
14 | // This overrides mHorizontal and mId.
15 | int mType;
16 |
17 | public:
18 | ScrollbuttonWidget(int theId, ButtonListener *theButtonListener, int theType = 0);
19 | ~ScrollbuttonWidget() override;
20 |
21 | void Draw(Graphics *g) override;
22 | };
23 | } // namespace Sexy
24 |
25 | #endif //__SCROLLBUTTONWIDGET_H__
26 |
--------------------------------------------------------------------------------
/src/framework/misc/Ratio.cpp:
--------------------------------------------------------------------------------
1 | #include "Ratio.h"
2 |
3 | namespace Sexy {
4 | Ratio::Ratio() : mNumerator(1), mDenominator(1) {}
5 |
6 | Ratio::Ratio(int theNumerator, int theDenominator) { Set(theNumerator, theDenominator); }
7 |
8 | void Ratio::Set(int theNumerator, int theDenominator) {
9 | // find the greatest-common-denominator of theNumerator and theDenominator.
10 | int a = theNumerator;
11 | int b = theDenominator;
12 | while (b != 0) {
13 | int t = b;
14 | b = a % b;
15 | a = t;
16 | }
17 |
18 | // divide by the g-c-d to reduce mNumerator/mDenominator to lowest terms.
19 | mNumerator = theNumerator / a;
20 | mDenominator = theDenominator / a;
21 | }
22 | } // namespace Sexy
23 |
--------------------------------------------------------------------------------
/src/lawn/widget/ImitaterDialog.h:
--------------------------------------------------------------------------------
1 | #ifndef __IMITATERDIALOG_H__
2 | #define __IMITATERDIALOG_H__
3 |
4 | #include "LawnDialog.h"
5 |
6 | class ToolTipWidget;
7 |
8 | class ImitaterDialog : public LawnDialog {
9 | public:
10 | ToolTipWidget *mToolTip;
11 | SeedType mToolTipSeed;
12 |
13 | public:
14 | ImitaterDialog();
15 | ~ImitaterDialog() override;
16 |
17 | SeedType SeedHitTest(int x, int y) const;
18 | void UpdateCursor();
19 | void Update() override;
20 | /*inline*/ void GetSeedPosition(int theIndex, int &x, int &y) const;
21 | void Draw(Graphics *g) override;
22 | void ShowToolTip();
23 | /*inline*/ void RemoveToolTip();
24 | void MouseDown(int x, int y, int theClickCount) override;
25 |
26 | void MouseUp(int, int, int) override {}
27 | };
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/src/framework/graphics/TriVertex.h:
--------------------------------------------------------------------------------
1 | #ifndef __TRIVERTEX_H__
2 | #define __TRIVERTEX_H__
3 |
4 | namespace Sexy {
5 | ///////////////////////////////////////////////////////////////////////////////
6 | ///////////////////////////////////////////////////////////////////////////////
7 | class TriVertex {
8 | public:
9 | float x, y, u, v;
10 | uint32_t color; // ARGB (0 = use color specified in function call)
11 |
12 | public:
13 | TriVertex() { color = 0; }
14 | TriVertex(float theX, float theY) : x(theX), y(theY) { color = 0; }
15 | TriVertex(float theX, float theY, float theU, float theV) : x(theX), y(theY), u(theU), v(theV) { color = 0; }
16 |
17 | TriVertex(float theX, float theY, float theU, float theV, uint32_t theColor)
18 | : x(theX), y(theY), u(theU), v(theV), color(theColor) {}
19 | };
20 | } // namespace Sexy
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/src/lawn/widget/ContinueDialog.h:
--------------------------------------------------------------------------------
1 | #ifndef __CONTINUEDIALOG_H__
2 | #define __CONTINUEDIALOG_H__
3 |
4 | #include "LawnDialog.h"
5 |
6 | class ContinueDialog : public LawnDialog {
7 | public:
8 | enum { ContinueDialog_Continue, ContinueDialog_NewGame };
9 |
10 | public:
11 | DialogButton *mContinueButton; //+0x16C
12 | DialogButton *mNewGameButton; //+0x170
13 |
14 | public:
15 | ContinueDialog(LawnApp *theApp);
16 | ~ContinueDialog() override;
17 |
18 | int GetPreferredHeight(int theWidth) override;
19 | void Resize(int theX, int theY, int theWidth, int theHeight) override;
20 | void AddedToManager(WidgetManager *theWidgetManager) override;
21 | void RemovedFromManager(WidgetManager *theWidgetManager) override;
22 | void ButtonDepress(int theId) override;
23 | void RestartLoopingSounds() const;
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/CMakeSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "x64-Debug",
5 | "generator": "Ninja",
6 | "configurationType": "Debug",
7 | "inheritEnvironments": [
8 | "msvc_x64_x64"
9 | ],
10 | "buildRoot": "${projectDir}\\out\\build\\${name}",
11 | "installRoot": "${projectDir}\\out\\install\\${name}",
12 | "cmakeCommandArgs": "",
13 | "buildCommandArgs": "",
14 | "ctestCommandArgs": ""
15 | },
16 | {
17 | "name": "x64-Release",
18 | "generator": "Ninja",
19 | "configurationType": "Release",
20 | "inheritEnvironments": [
21 | "msvc_x64_x64"
22 | ],
23 | "buildRoot": "${projectDir}\\out\\build\\${name}",
24 | "installRoot": "${projectDir}\\out\\install\\${name}",
25 | "cmakeCommandArgs": "",
26 | "buildCommandArgs": "",
27 | "ctestCommandArgs": ""
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/cmake/embed_binary.cmake:
--------------------------------------------------------------------------------
1 | # https://stackoverflow.com/a/27206982
2 | # Creates C resources file from files in given list
3 |
4 | # bin: path to binary file
5 | # output: path to output file
6 |
7 | if (NOT EXISTS ${bin})
8 | message(FATAL_ERROR "File ${bin} does not exist")
9 | endif ()
10 | # Get short filename
11 | string(REGEX MATCH "([^/]+)$" filename ${bin})
12 | # Replace filename spaces & extension separator for C compatibility
13 | string(REGEX REPLACE "\\.| |-" "_" filename ${filename})
14 | # Read hex data from file
15 | file(READ ${bin} filedata HEX)
16 | if (filedata STREQUAL "")
17 | message(FATAL_ERROR "File ${bin} is empty")
18 | endif ()
19 | # Convert hex data for C compatibility
20 | string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata})
21 | file(WRITE ${output} "#include\n#include \nextern const uint8_t _binary_${filename}[] = {${filedata}};\nextern const size_t _binary_${filename}_size = sizeof(_binary_${filename});\n\n")
--------------------------------------------------------------------------------
/src/lawn/widget/CheatDialog.h:
--------------------------------------------------------------------------------
1 | #ifndef __CHEATDIALOG_H__
2 | #define __CHEATDIALOG_H__
3 |
4 | #include "LawnDialog.h"
5 | #include "framework/widget/EditListener.h"
6 | #include "framework/widget/EditWidget.h"
7 |
8 | class CheatDialog : public LawnDialog, public EditListener {
9 | public:
10 | LawnApp *mApp; //+0x170
11 | EditWidget *mLevelEditWidget; //+0x174
12 |
13 | public:
14 | CheatDialog(LawnApp *theApp);
15 | ~CheatDialog() override;
16 |
17 | int GetPreferredHeight(int theWidth) override;
18 | void Resize(int theX, int theY, int theWidth, int theHeight) override;
19 | void AddedToManager(WidgetManager *theWidgetManager) override;
20 | void RemovedFromManager(WidgetManager *theWidgetManager) override;
21 | void Draw(Graphics *g) override;
22 | void EditWidgetText(int theId, const SexyString &theString) override;
23 | virtual bool AllowChar(int theId, SexyChar theChar);
24 | bool ApplyCheat() const;
25 | };
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/src/framework/sound/DummySoundInstance.h:
--------------------------------------------------------------------------------
1 | #ifndef __DUMMY_SOUND_INSTANCE_H__
2 | #define __DUMMY_SOUND_INSTANCE_H__
3 |
4 | #include "sound/SoundInstance.h"
5 |
6 | class DummySoundInstance : public Sexy::SoundInstance {
7 | public:
8 | void Release() override {}
9 |
10 | void SetBaseVolume(double) override {}
11 |
12 | void SetBasePan(int) override {}
13 |
14 | void AdjustPitch(double) override {}
15 |
16 | void SetVolume(double) override {}
17 |
18 | void SetPan(int) override {} //-hundredth db to +hundredth db = left to right
19 |
20 | int GetSoundPosition() override { return 0; }
21 |
22 | void SetSoundPosition(int /*thePosition*/) override {}
23 |
24 | bool Play(bool, bool) override { return true; }
25 |
26 | void Stop() override {}
27 |
28 | bool IsPlaying() override { return false; }
29 | bool IsReleased() override { return true; }
30 | double GetVolume() override { return 0; }
31 | };
32 |
33 | #endif // __DUMMY_SOUND_INSTANCE_H__
34 |
--------------------------------------------------------------------------------
/src/framework/widget/Slider.h:
--------------------------------------------------------------------------------
1 | #ifndef __SLIDER_H__
2 | #define __SLIDER_H__
3 |
4 | #include "Widget.h"
5 |
6 | namespace Sexy {
7 | class SliderListener;
8 |
9 | class Slider : public Widget {
10 | public:
11 | SliderListener *mListener;
12 | double mVal;
13 | int mId;
14 | Image *mTrackImage;
15 | Image *mThumbImage;
16 |
17 | bool mDragging;
18 | int mRelX;
19 | int mRelY;
20 |
21 | bool mHorizontal;
22 |
23 | public:
24 | Slider(Image *theTrackImage, Image *theThumbImage, int theId, SliderListener *theListener);
25 |
26 | virtual void SetValue(double theValue);
27 |
28 | virtual bool HasTransparencies();
29 | void Draw(Graphics *g) override;
30 |
31 | void MouseMove(int x, int y) override;
32 | void MouseDown(int x, int y, int theClickCount) override;
33 | void MouseDrag(int x, int y) override;
34 | void MouseUp(int x, int y) override;
35 | void MouseLeave() override;
36 | };
37 | } // namespace Sexy
38 |
39 | #endif //__SLIDER_H__
40 |
--------------------------------------------------------------------------------
/src/framework/sound/SoundInstance.h:
--------------------------------------------------------------------------------
1 | #ifndef __SOUNDINSTANCE_H__
2 | #define __SOUNDINSTANCE_H__
3 |
4 | #include "framework/Common.h"
5 |
6 | namespace Sexy {
7 | class SoundInstance {
8 | public:
9 | SoundInstance() {}
10 |
11 | virtual ~SoundInstance() {}
12 |
13 | virtual void Release() = 0;
14 |
15 | virtual void SetBaseVolume(double theBaseVolume) = 0;
16 | virtual void SetBasePan(int theBasePan) = 0;
17 |
18 | virtual void AdjustPitch(double theNumSteps) = 0;
19 |
20 | virtual void SetVolume(double theVolume) = 0;
21 | virtual void SetPan(int thePosition) = 0; //-hundredth db to +hundredth db = left to right
22 |
23 | virtual int GetSoundPosition() = 0;
24 | virtual void SetSoundPosition(int thePosition) = 0;
25 |
26 | virtual bool Play(bool looping, bool autoRelease) = 0;
27 | virtual void Stop() = 0;
28 | virtual bool IsPlaying() = 0;
29 | virtual bool IsReleased() = 0;
30 | virtual double GetVolume() = 0;
31 | };
32 | } // namespace Sexy
33 |
34 | #endif //__SOUNDINSTANCE_H__
35 |
--------------------------------------------------------------------------------
/src/lawn/CursorObject.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURSOROBJECT_H__
2 | #define __CURSOROBJECT_H__
3 |
4 | #include "ConstEnums.h"
5 | #include "GameObject.h"
6 |
7 | class CursorObject : public GameObject {
8 | public:
9 | int mSeedBankIndex; //+0x24
10 | SeedType mType; //+0x28
11 | SeedType mImitaterType; //+0x2C
12 | CursorType mCursorType; //+0x30
13 | CoinID mCoinID; //+0x34
14 | PlantID mGlovePlantID; //+0x38
15 | PlantID mDuplicatorPlantID; //+0x3C
16 | PlantID mCobCannonPlantID; //+0x40
17 | int mHammerDownCounter; //+0x44
18 | ReanimationID mReanimCursorID; //+0x48
19 |
20 | public:
21 | CursorObject();
22 |
23 | void Update();
24 | void Draw(Graphics *g);
25 | void Die() const;
26 | };
27 |
28 | class CursorPreview : public GameObject {
29 | public:
30 | int mGridX;
31 | int mGridY;
32 |
33 | public:
34 | CursorPreview();
35 |
36 | void Update();
37 | void Draw(Graphics *g);
38 | };
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/src/framework/misc/PropertiesParser.h:
--------------------------------------------------------------------------------
1 | #ifndef __SEXYAPPFRAMEWORK_NO_PROPERTIES_PARSER__
2 | #ifndef __PROPERTIESPARSER_H__
3 | #define __PROPERTIESPARSER_H__
4 |
5 | #include "SexyAppBase.h"
6 |
7 | namespace Sexy {
8 | class XMLParser;
9 |
10 | class PropertiesParser {
11 | public:
12 | SexyAppBase *mApp;
13 | XMLParser *mXMLParser;
14 | SexyString mError;
15 | bool mHasFailed;
16 |
17 | protected:
18 | void Fail(const SexyString &theErrorText);
19 |
20 | bool ParseSingleElement(SexyString *theString);
21 | bool ParseStringArray(StringVector *theStringVector);
22 | bool ParseProperties();
23 | bool DoParseProperties();
24 |
25 | public:
26 | PropertiesParser(SexyAppBase *theApp);
27 | virtual ~PropertiesParser();
28 |
29 | bool ParsePropertiesFile(const std::string &theFilename);
30 | bool ParsePropertiesBuffer(const Buffer &theBuffer);
31 | SexyString GetErrorText();
32 | };
33 | } // namespace Sexy
34 |
35 | #endif //__PROPERTIESPARSER_H__
36 |
37 | #endif // __SEXYAPPFRAMEWORK_NO_PROPERTIES_PARSER__
38 |
--------------------------------------------------------------------------------
/src/lawn/widget/NewUserDialog.h:
--------------------------------------------------------------------------------
1 | #ifndef __NEWUSERDIALOG_H__
2 | #define __NEWUSERDIALOG_H__
3 |
4 | #include "LawnDialog.h"
5 | #include "framework/widget/EditListener.h"
6 | #include "widget/EditWidget.h"
7 |
8 | class NewUserDialog : public LawnDialog, public EditListener {
9 | public:
10 | LawnApp *mApp; //+0x170
11 | EditWidget *mNameEditWidget; //+0x174
12 |
13 | public:
14 | NewUserDialog(LawnApp *theApp, bool isRename);
15 | ~NewUserDialog() override;
16 |
17 | int GetPreferredHeight(int theWidth) override;
18 | void Resize(int theX, int theY, int theWidth, int theHeight) override;
19 | void AddedToManager(WidgetManager *theWidgetManager) override;
20 | void RemovedFromManager(WidgetManager *theWidgetManager) override;
21 | void Draw(Graphics *g) override;
22 | void EditWidgetText(int theId, const SexyString &theString) override;
23 | virtual bool AllowChar(int, SexyChar theChar);
24 | SexyString GetName() const;
25 | void SetName(const SexyString &theName) const;
26 | };
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/compiler/hash.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "quick_sort.h"
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | namespace compiler {
11 |
12 | template constexpr T fnv_hash(const char *str, const T basis, const T prime) {
13 | size_t Val = basis;
14 | for (size_t Idx = 0; Idx < std::char_traits::length(str); ++Idx) {
15 | Val ^= static_cast(str[Idx]);
16 | Val *= prime;
17 | }
18 | return Val;
19 | }
20 |
21 | template constexpr T get_fnv_prime() {}
22 | template <> constexpr uint32_t get_fnv_prime() { return 16777619; }
23 |
24 | template <> constexpr uint64_t get_fnv_prime() { return 1099511628211; }
25 |
26 | constexpr auto hash(const char *str) {
27 | constexpr size_t FNV_hash_prime = get_fnv_prime();
28 | constexpr size_t FNV_offset_basis = fnv_hash("chongo /\\../\\", (size_t)0, FNV_hash_prime);
29 | return fnv_hash(str, FNV_offset_basis, FNV_hash_prime);
30 | }
31 |
32 | } // namespace compiler
33 |
--------------------------------------------------------------------------------
/src/framework/graphics/shaders/shader.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout(location = 0) out vec2 fragTexCoord;
4 | layout(location = 1) out vec4 fragColor;
5 |
6 | layout(push_constant) uniform constants {
7 | vec4 vertices[4];
8 | uint colors[4];
9 | bool isQuad;
10 | bool toFilter;
11 | } PushConstants;
12 |
13 | int indexBuffer[6] = {
14 | 0, 1, 2, 2, 1, 3
15 | };
16 |
17 | vec4 unpackColor(uint color) {
18 | vec4 c = vec4((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, (color >> 24) & 0xFF)/255.0;
19 | return vec4(c.a * c.rgb, c.a);
20 | }
21 |
22 | void main() {
23 | //fragTexCoord = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
24 | uint index;
25 | if (PushConstants.isQuad) {
26 | index = indexBuffer[gl_VertexIndex];
27 | } else {
28 | index = gl_VertexIndex;
29 | }
30 |
31 | vec4 vertex = PushConstants.vertices[index];
32 | fragColor = unpackColor(PushConstants.colors[index]);
33 |
34 | fragTexCoord = vertex.zw;
35 | gl_Position = vec4(vertex.xy, 0.0, 1.0);
36 | }
37 |
--------------------------------------------------------------------------------
/src/framework/misc/MTRand.h:
--------------------------------------------------------------------------------
1 | #ifndef __MTRAND_H__
2 | #define __MTRAND_H__
3 |
4 | #include
5 |
6 | namespace Sexy {
7 | #define MTRAND_N 624
8 |
9 | class MTRand {
10 | unsigned long mt[MTRAND_N]; /* the array for the state vector */
11 | int mti;
12 |
13 | public:
14 | MTRand(const std::string &theSerialData);
15 | MTRand(unsigned long seed);
16 | MTRand();
17 |
18 | void SRand(const std::string &theSerialData);
19 | void SRand(unsigned long seed);
20 | unsigned long NextNoAssert();
21 | unsigned long Next();
22 | unsigned long NextNoAssert(unsigned long range);
23 | unsigned long Next(unsigned long range);
24 | float NextNoAssert(float range);
25 | float Next(float range);
26 |
27 | std::string Serialize() const;
28 |
29 | static void SetRandAllowed(bool allowed);
30 | };
31 |
32 | struct MTAutoDisallowRand {
33 | MTAutoDisallowRand() { MTRand::SetRandAllowed(false); }
34 | ~MTAutoDisallowRand() { MTRand::SetRandAllowed(true); }
35 | };
36 | } // namespace Sexy
37 |
38 | #endif //__MTRAND_H__
39 |
--------------------------------------------------------------------------------
/src/res/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # RC
3 | ################################################################################
4 | set(RC_OUTPUT_DIR ${CMAKE_BINARY_DIR}/res)
5 | file(GLOB RC_SRC
6 | ${CMAKE_CURRENT_SOURCE_DIR}/*
7 | )
8 |
9 | list(REMOVE_ITEM RC_SRC "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") # Don't include self into the binary
10 |
11 | set(RC_DEPENDS "")
12 | foreach (RC_FILE ${RC_SRC})
13 | get_filename_component(RC_FILE_NAME ${RC_FILE} NAME)
14 | add_custom_command(
15 | OUTPUT ${RC_OUTPUT_DIR}/${RC_FILE_NAME}.cpp
16 | COMMAND ${CMAKE_COMMAND} -Dbin="${RC_FILE}" -Doutput="${RC_OUTPUT_DIR}/${RC_FILE_NAME}.cpp" -P "${CMAKE_SOURCE_DIR}/cmake/embed_binary.cmake"
17 | DEPENDS ${RC_FILE}
18 | COMMENT "Converting ${RC_FILE_NAME} to C++"
19 | )
20 | list(APPEND RC_DEPENDS ${RC_OUTPUT_DIR}/${RC_FILE_NAME}.cpp)
21 | endforeach ()
22 |
23 | add_custom_target(rc DEPENDS ${RC_DEPENDS})
24 | add_library(rc_lib STATIC ${RC_DEPENDS})
25 | target_link_libraries(${PROJECT_NAME} PRIVATE rc_lib)
--------------------------------------------------------------------------------
/src/framework/widget/Checkbox.h:
--------------------------------------------------------------------------------
1 | #ifndef __CHECKBOX_H__
2 | #define __CHECKBOX_H__
3 |
4 | #include "Widget.h"
5 |
6 | namespace Sexy {
7 | class CheckboxListener;
8 | class Image;
9 |
10 | class Checkbox : public Widget {
11 | protected:
12 | CheckboxListener *mListener;
13 |
14 | public:
15 | int mId;
16 |
17 | bool mChecked;
18 |
19 | Image *mUncheckedImage;
20 | Image *mCheckedImage;
21 |
22 | Rect mCheckedRect;
23 | Rect mUncheckedRect;
24 |
25 | Color mOutlineColor; // These are only used if no image is specified
26 | Color mBkgColor;
27 | Color mCheckColor;
28 |
29 | public:
30 | virtual void SetChecked(bool checked, bool tellListener = true);
31 | virtual bool IsChecked();
32 |
33 | void MouseDown(int x, int y, int theClickCount) override { Widget::MouseDown(x, y, theClickCount); }
34 | void MouseDown(int x, int y, int theBtnNum, int theClickCount) override;
35 | void Draw(Graphics *g) override;
36 |
37 | public:
38 | Checkbox(Image *theUncheckedImage, Image *theCheckedImage, int theId, CheckboxListener *theCheckboxListener);
39 | };
40 | } // namespace Sexy
41 |
42 | #endif //__CHECKBOX_H__
43 |
--------------------------------------------------------------------------------
/src/todlib/FilterEffect.h:
--------------------------------------------------------------------------------
1 | #ifndef __FILTEREFFECT_H__
2 | #define __FILTEREFFECT_H__
3 |
4 | #include
5 | #include
6 |
7 | namespace Sexy {
8 | class Image;
9 | // class MemoryImage;
10 | } // namespace Sexy
11 |
12 | using namespace Sexy;
13 |
14 | enum FilterEffect : int32_t {
15 | FILTER_EFFECT_NONE = -1,
16 | FILTER_EFFECT_WASHED_OUT,
17 | FILTER_EFFECT_LESS_WASHED_OUT,
18 | FILTER_EFFECT_WHITE,
19 | NUM_FILTER_EFFECTS
20 | };
21 |
22 | using ImageFilterMap = std::unordered_map>;
23 | extern ImageFilterMap gFilterMap[FilterEffect::NUM_FILTER_EFFECTS];
24 |
25 | void FilterEffectInitForApp();
26 | void FilterEffectDisposeForApp();
27 | // void FilterEffectDoLumSat(MemoryImage* theImage, float theLum, float theSat);
28 | ///*inline*/ void FilterEffectDoWashedOut(MemoryImage* theImage);
29 | ///*inline*/ void FilterEffectDoLessWashedOut(MemoryImage* theImage);
30 | // void FilterEffectDoWhite(MemoryImage* theImage);
31 | // MemoryImage* FilterEffectCreateImage(Image* theImage, FilterEffect theFilterEffect);
32 | Image *FilterEffectGetImage(Image *theImage, FilterEffect theFilterEffect);
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/src/framework/graphics/Font.h:
--------------------------------------------------------------------------------
1 | #ifndef __FONT_H__
2 | #define __FONT_H__
3 |
4 | #include "Color.h"
5 | #include "framework/Common.h"
6 | #include "framework/misc/Rect.h"
7 | #include
8 |
9 | namespace Sexy {
10 | class Graphics;
11 |
12 | class _Font {
13 | public:
14 | int mAscent;
15 | int mAscentPadding; // How much space is above the avg uppercase char
16 | int mHeight;
17 | int mLineSpacingOffset; // This plus height should get added between lines
18 | public:
19 | _Font();
20 | _Font(const _Font &theFont);
21 | virtual ~_Font();
22 |
23 | virtual int GetAscent();
24 | virtual int GetAscentPadding();
25 | virtual int GetDescent();
26 | virtual int GetHeight();
27 | virtual int GetLineSpacingOffset();
28 | virtual int GetLineSpacing();
29 | virtual int StringWidth(const SexyString &theString);
30 | virtual int CharWidth(SexyChar theChar);
31 | virtual int CharWidthKern(SexyChar theChar, SexyChar thePrevChar);
32 |
33 | virtual void DrawString(
34 | Graphics *g, int theX, int theY, const SexyString &theString, const Color &theColor, const Rect &theClipRect
35 | );
36 |
37 | virtual _Font *Duplicate() = 0;
38 | };
39 | } // namespace Sexy
40 |
41 | #endif //__FONT_H__
42 |
--------------------------------------------------------------------------------
/src/framework/graphics/Font.cpp:
--------------------------------------------------------------------------------
1 | #include "Font.h"
2 | #include "Image.h"
3 |
4 | using namespace Sexy;
5 |
6 | _Font::_Font() {
7 | mAscent = 0;
8 | mAscentPadding = 0;
9 | mHeight = 0;
10 | mLineSpacingOffset = 0;
11 | }
12 |
13 | _Font::_Font(const _Font &theFont)
14 | : mAscent(theFont.mAscent), mAscentPadding(theFont.mAscentPadding), mHeight(theFont.mHeight),
15 | mLineSpacingOffset(theFont.mLineSpacingOffset) {}
16 |
17 | _Font::~_Font() {}
18 |
19 | int _Font::GetAscent() { return mAscent; }
20 |
21 | int _Font::GetAscentPadding() { return mAscentPadding; }
22 |
23 | int _Font::GetDescent() { return mHeight - mAscent; }
24 |
25 | int _Font::GetHeight() { return mHeight; }
26 |
27 | int _Font::GetLineSpacingOffset() { return mLineSpacingOffset; }
28 |
29 | int _Font::GetLineSpacing() { return mHeight + mLineSpacingOffset; }
30 |
31 | int _Font::StringWidth(const SexyString &) { return 0; }
32 |
33 | int _Font::CharWidth(SexyChar theChar) {
34 | const SexyString aString(1, theChar);
35 | return StringWidth(aString);
36 | }
37 |
38 | int _Font::CharWidthKern(SexyChar theChar, SexyChar) { return CharWidth(theChar); }
39 |
40 | void _Font::DrawString(Graphics *, int, int, const SexyString &, const Color &, const Rect &) {}
41 |
--------------------------------------------------------------------------------
/src/lawn/system/TypingCheck.cpp:
--------------------------------------------------------------------------------
1 | #include "TypingCheck.h"
2 | using namespace Sexy;
3 |
4 | // 0x51C470
5 | TypingCheck::TypingCheck(const std::string &thePhrase) { SetPhrase(thePhrase); }
6 |
7 | // 0x51C4D0
8 | void TypingCheck::SetPhrase(const std::string &thePhrase) {
9 | for (size_t i = 0; i < thePhrase.size(); i++)
10 | AddChar(thePhrase[i]);
11 | }
12 |
13 | void TypingCheck::AddKeyCode(Sexy::KeyCode theKeyCode) { mPhrase.append(1, static_cast(theKeyCode)); }
14 |
15 | // 0x51C510
16 | void TypingCheck::AddChar(char theChar) {
17 | theChar = static_cast(tolower(theChar));
18 | const std::string aCharString{theChar};
19 | AddKeyCode(GetKeyCodeFromName(aCharString));
20 | }
21 |
22 | bool TypingCheck::Check() {
23 | if (mRecentTyping.compare(mPhrase) == 0) {
24 | mRecentTyping.clear();
25 | return true;
26 | }
27 | return false;
28 | }
29 |
30 | // 0x51C5A0
31 | bool TypingCheck::Check(Sexy::KeyCode theKeyCode) {
32 | mRecentTyping.append(1, static_cast(theKeyCode));
33 | const size_t aLength = mPhrase.size();
34 | if (aLength == 0) return false;
35 |
36 | if (mRecentTyping.size() > aLength) mRecentTyping = mRecentTyping.substr(1, aLength);
37 |
38 | return Check();
39 | }
40 |
--------------------------------------------------------------------------------
/src/framework/graphics/Color.h:
--------------------------------------------------------------------------------
1 | #ifndef __COLOR_H__
2 | #define __COLOR_H__
3 |
4 | #include "framework/Common.h"
5 |
6 | namespace Sexy {
7 | #pragma pack(push, 1)
8 | struct SexyRGBA {
9 | unsigned char b, g, r, a;
10 | };
11 | #pragma pack(pop)
12 |
13 | class Color {
14 | public:
15 | int mRed;
16 | int mGreen;
17 | int mBlue;
18 | int mAlpha;
19 |
20 | static Color Black;
21 | static Color White;
22 |
23 | public:
24 | Color();
25 | explicit Color(int theColor);
26 | Color(const int theColor, const int theAlpha);
27 | Color(const int theRed, const int theGreen, const int theBlue, const int theAlpha = 0xFF);
28 | explicit Color(const SexyRGBA &theColor);
29 | explicit Color(const uint8_t *theElements);
30 | explicit Color(const int *theElements);
31 |
32 | int GetRed() const;
33 | int GetGreen() const;
34 | int GetBlue() const;
35 | int GetAlpha() const;
36 | uint32_t ToInt() const;
37 | SexyRGBA ToRGBA() const;
38 |
39 | int &operator[](int theIdx);
40 | int operator[](int theIdx) const;
41 | };
42 |
43 | bool operator==(const Color &theColor1, const Color &theColor2);
44 | bool operator!=(const Color &theColor1, const Color &theColor2);
45 | } // namespace Sexy
46 |
47 | #endif //__COLOR_H__
48 |
--------------------------------------------------------------------------------
/src/lawn/system/PoolEffect.h:
--------------------------------------------------------------------------------
1 | #ifndef __POOLEFFECT_H__
2 | #define __POOLEFFECT_H__
3 |
4 | #include "framework/graphics/Image.h"
5 | #include "graphics/VkCommon.h"
6 | #include "graphics/VkImage.h"
7 | #include
8 | #include
9 |
10 | constexpr const int CAUSTIC_IMAGE_WIDTH = 128;
11 | constexpr const int CAUSTIC_IMAGE_HEIGHT = 64;
12 | constexpr const size_t CAUSTIC_SIZE_BYTES =
13 | CAUSTIC_IMAGE_WIDTH * CAUSTIC_IMAGE_HEIGHT * SCALE * SCALE * sizeof(uint32_t);
14 |
15 | class LawnApp;
16 |
17 | class PoolEffect {
18 | public:
19 | std::unique_ptr mCausticGrayscaleImage;
20 | std::array, CAUSTIC_IMAGE_HEIGHT> mMemCausticImage;
21 | std::unique_ptr mCausticImage;
22 |
23 | VkBuffer mStagingBuffer;
24 | VkDeviceMemory mStagingBufferMemory;
25 |
26 | LawnApp *mApp;
27 | int mPoolCounter;
28 |
29 | public:
30 | void PoolEffectInitialize();
31 | void PoolEffectDispose();
32 | void PoolEffectDraw(Sexy::Graphics *g, bool theIsNight);
33 | void UpdateWaterEffect();
34 | unsigned int BilinearLookupFixedPoint(unsigned int u, unsigned int v) const;
35 | // unsigned int BilinearLookup(float u, float v);
36 | void PoolEffectUpdate();
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/framework/widget/HyperlinkWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "HyperlinkWidget.h"
2 | #include "WidgetManager.h"
3 | #include "graphics/Graphics.h"
4 | #include "graphics/ImageFont.h"
5 |
6 | using namespace Sexy;
7 |
8 | HyperlinkWidget::HyperlinkWidget(int theId, ButtonListener *theButtonListener)
9 | : ButtonWidget(theId, theButtonListener), mColor(255, 255, 255), mOverColor(255, 255, 255) {
10 | mDoFinger = true;
11 | mUnderlineOffset = 3;
12 | mUnderlineSize = 1;
13 | }
14 |
15 | void HyperlinkWidget::Draw(Graphics *g) {
16 | /* FIXME
17 | if (mFont == NULL)
18 | mFont = new SysFont(mWidgetManager->mApp, "Arial Unicode MS", 10); //baz changed
19 | */
20 |
21 | int aFontX = (mWidth - mFont->StringWidth(mLabel)) / 2;
22 | int aFontY = (mHeight + mFont->GetAscent()) / 2 - 1;
23 |
24 | if (mIsOver) g->SetColor(mOverColor);
25 | else g->SetColor(mColor);
26 |
27 | g->SetFont(mFont);
28 | g->DrawString(mLabel, aFontX, aFontY);
29 |
30 | for (int i = 0; i < mUnderlineSize; i++)
31 | g->FillRect(aFontX, aFontY + mUnderlineOffset + i, mFont->StringWidth(mLabel), 1);
32 | }
33 |
34 | void HyperlinkWidget::MouseEnter() {
35 | ButtonWidget::MouseEnter();
36 |
37 | MarkDirtyFull();
38 | }
39 |
40 | void HyperlinkWidget::MouseLeave() {
41 | ButtonWidget::MouseLeave();
42 |
43 | MarkDirtyFull();
44 | }
45 |
--------------------------------------------------------------------------------
/src/framework/sound/DummySoundManager.h:
--------------------------------------------------------------------------------
1 | #ifndef __DUMMY_SOUND_MANAGER_H__
2 | #define __DUMMY_SOUND_MANAGER_H__
3 |
4 | #include "DummySoundInstance.h"
5 | #include "SoundManager.h"
6 |
7 | class DummySoundManager : public Sexy::SoundManager {
8 | public:
9 | bool Initialized() override { return true; }
10 |
11 | bool LoadSound(unsigned int, const std::string &) override { return true; }
12 | int LoadSound(const std::string &) override { return 0; }
13 |
14 | void ReleaseSound(unsigned int) override {}
15 |
16 | void SetVolume(double) override {}
17 |
18 | bool SetBaseVolume(unsigned int, double) override { return 0; }
19 | bool SetBasePan(unsigned int, int) override { return 0; }
20 |
21 | Sexy::SoundInstance *GetSoundInstance(unsigned int) override { return &dummy; }
22 |
23 | void ReleaseSounds() override {}
24 |
25 | void ReleaseChannels() override {}
26 |
27 | double GetMasterVolume() override { return 0; }
28 |
29 | void SetMasterVolume(double) override {}
30 |
31 | void Flush() override {}
32 |
33 | // virtual void SetCooperativeWindow(HWND theHWnd) {}
34 | void StopAllSounds() override {}
35 |
36 | int GetFreeSoundId() override { return 0; }
37 | int GetNumSounds() override { return 0; }
38 |
39 | private:
40 | DummySoundInstance dummy;
41 | };
42 |
43 | #endif // __DUMMY_SOUND_MANAGER_H__
44 |
--------------------------------------------------------------------------------
/src/framework/sound/DummyMusicInterface.h:
--------------------------------------------------------------------------------
1 | #ifndef __DUMMY_MUSIC_INTERFACE_H__
2 | #define __DUMMY_MUSIC_INTERFACE_H__
3 |
4 | #include "MusicInterface.h"
5 |
6 | using namespace Sexy;
7 |
8 | class DummyMusicInterface : public MusicInterface {
9 | public:
10 | DummyMusicInterface() {}
11 |
12 | ~DummyMusicInterface() override{};
13 |
14 | bool LoadMusic(int, const std::string &) override { return false; }
15 |
16 | void PlayMusic(int, int, bool) override {}
17 |
18 | void StopMusic(int) override {}
19 |
20 | void PauseMusic(int) override {}
21 |
22 | void ResumeMusic(int) override {}
23 |
24 | void StopAllMusic() override {}
25 |
26 | void UnloadMusic(int) override {}
27 |
28 | void UnloadAllMusic() override {}
29 |
30 | void PauseAllMusic() override {}
31 |
32 | void ResumeAllMusic() override {}
33 |
34 | void FadeIn(int, int, double, bool) override {}
35 |
36 | void FadeOut(int, bool, double) override {}
37 |
38 | void FadeOutAll(bool, double) override {}
39 |
40 | void SetSongVolume(int, double) override {}
41 |
42 | void SetSongMaxVolume(int, double) override {}
43 |
44 | bool IsPlaying(int) override { return false; };
45 |
46 | void SetVolume(double) override {}
47 |
48 | void SetMusicAmplify(int, double) override {}
49 |
50 | void Update() override {}
51 | };
52 |
53 | #endif // __DUMMY_MUSIC_INTERFACE_H__
54 |
--------------------------------------------------------------------------------
/src/lawn/ToolTipWidget.h:
--------------------------------------------------------------------------------
1 | #ifndef __TOOLTIPWIDGET_H__
2 | #define __TOOLTIPWIDGET_H__
3 |
4 | #include "framework/Common.h"
5 |
6 | namespace Sexy {
7 | class Graphics;
8 | }
9 |
10 | class ToolTipWidget {
11 | public:
12 | SexyString mTitle; //+0x0
13 | SexyString mLabel; //+0x1C
14 | SexyString mWarningText; //+0x28
15 | int mX; //+0x54
16 | int mY; //+0x58
17 | int mWidth; //+0x5C
18 | int mHeight; //+0x60
19 | bool mVisible; //+0x64
20 | bool mCenter; //+0x65
21 | int mMinLeft; //+0x68
22 | int mMaxBottom; //+0x6C
23 | int mGetsLinesWidth; //+0x70
24 | int mWarningFlashCounter; //+0x74
25 |
26 | public:
27 | ToolTipWidget();
28 |
29 | void Draw(Sexy::Graphics *g);
30 | void SetLabel(const SexyString &theLabel);
31 | void SetTitle(const SexyString &theTitle);
32 | void SetWarningText(const SexyString &theWarningText);
33 | void CalculateSize();
34 | void GetLines(std::vector &theLines) const;
35 | inline void FlashWarning() { mWarningFlashCounter = 70; }
36 | inline void Update() {
37 | if (mWarningFlashCounter > 0) mWarningFlashCounter--;
38 | }
39 |
40 | inline void SetPosition(int theX, int theY) {
41 | mX = theX;
42 | mY = theY;
43 | }
44 | };
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/src/framework/sound/SoundManager.h:
--------------------------------------------------------------------------------
1 | #ifndef __SOUNDMANAGER_H__
2 | #define __SOUNDMANAGER_H__
3 |
4 | #include "framework/Common.h"
5 |
6 | namespace Sexy {
7 | class SoundInstance;
8 |
9 | #define MAX_SOURCE_SOUNDS 256
10 | #define MAX_CHANNELS 32
11 |
12 | class SoundManager {
13 | public:
14 | SoundManager() {}
15 |
16 | virtual ~SoundManager() {}
17 |
18 | virtual bool Initialized() = 0;
19 |
20 | virtual bool LoadSound(unsigned int theSfxID, const std::string &theFilename) = 0;
21 | virtual int LoadSound(const std::string &theFilename) = 0;
22 | virtual void ReleaseSound(unsigned int theSfxID) = 0;
23 |
24 | virtual void SetVolume(double theVolume) = 0;
25 | virtual bool SetBaseVolume(unsigned int theSfxID, double theBaseVolume) = 0;
26 | virtual bool SetBasePan(unsigned int theSfxID, int theBasePan) = 0;
27 |
28 | virtual SoundInstance *GetSoundInstance(unsigned int theSfxID) = 0;
29 |
30 | virtual void ReleaseSounds() = 0;
31 | virtual void ReleaseChannels() = 0;
32 |
33 | virtual double GetMasterVolume() = 0;
34 | virtual void SetMasterVolume(double theVolume) = 0;
35 |
36 | virtual void Flush() = 0;
37 | // virtual void SetCooperativeWindow(HWND theHWnd) = 0;
38 | virtual void StopAllSounds() = 0;
39 | virtual int GetFreeSoundId() = 0;
40 | virtual int GetNumSounds() = 0;
41 | };
42 | } // namespace Sexy
43 |
44 | #endif //__SOUNDMANAGER_H__
45 |
--------------------------------------------------------------------------------
/src/framework/sound/BassSoundInstance.h:
--------------------------------------------------------------------------------
1 | #ifndef __BASS_SOUND_INSTANCE_H__
2 | #define __BASS_SOUND_INSTANCE_H__
3 |
4 | #include "SoundInstance.h"
5 | #include
6 |
7 | namespace Sexy {
8 | class BassSoundManager;
9 |
10 | class BassSoundInstance : public Sexy::SoundInstance {
11 | public:
12 | BassSoundInstance(HSAMPLE theSourceSound);
13 | ~BassSoundInstance() override;
14 | void Release() override;
15 |
16 | void SetBaseVolume(double /*theBaseVolume*/) override {}
17 |
18 | void SetBasePan(int /*theBasePan*/) override {}
19 |
20 | void SetVolume(double theVolume) override;
21 | void SetPan(int thePosition) override; //-hundredth db to +hundredth db = left to right
22 | void AdjustPitch(double theNumSteps) override;
23 |
24 | int GetSoundPosition() override;
25 | void SetSoundPosition(int thePosition) override;
26 |
27 | bool Play(bool looping, bool autoRelease) override;
28 | void Stop() override;
29 | bool IsPlaying() override;
30 | bool IsReleased() override;
31 | double GetVolume() override;
32 |
33 | private:
34 | void RehupVolume() const;
35 | void RehupPan() const;
36 |
37 | HSAMPLE mSample;
38 | HCHANNEL mChannel;
39 |
40 | bool mAutoRelease = false;
41 | bool mHasPlayed = false;
42 | bool mReleased = false;
43 |
44 | int mPan = 0;
45 | double mVolume = 1.0;
46 |
47 | DWORD mDefaultFrequency = 44100;
48 | };
49 | } // namespace Sexy
50 |
51 | #endif // __BASS_SOUND_INSTANCE_H__
52 |
--------------------------------------------------------------------------------
/src/lawn/LawnMower.h:
--------------------------------------------------------------------------------
1 | #ifndef __LAWNMOWER_H__
2 | #define __LAWNMOWER_H__
3 |
4 | #include "ConstEnums.h"
5 | #include "framework/misc/Rect.h"
6 |
7 | class LawnApp;
8 | class Board;
9 | class Zombie;
10 |
11 | namespace Sexy {
12 | class Graphics;
13 | };
14 |
15 | using namespace Sexy;
16 |
17 | class LawnMower {
18 | public:
19 | LawnApp *mApp; //+0x0
20 | Board *mBoard; //+0x4
21 | float mPosX; //+0x8
22 | float mPosY; //+0xC
23 | int mRenderOrder; //+0x10
24 | int mRow; //+0x14
25 | int mAnimTicksPerFrame; //+0x18
26 | ReanimationID mReanimID; //+0x1C
27 | int mChompCounter; //+0x20
28 | int mRollingInCounter; //+0x24
29 | int mSquishedCounter; //+0x28
30 | LawnMowerState mMowerState; //+0x2C
31 | bool mDead; //+0x30
32 | bool mVisible; //+0x31
33 | LawnMowerType mMowerType; //+0x34
34 | float mAltitude; //+0x38
35 | MowerHeight mMowerHeight; //+0x3C
36 | int mLastPortalX; //+0x40
37 |
38 | public:
39 | void LawnMowerInitialize(int theRow);
40 | void StartMower();
41 | void Update();
42 | void Draw(Graphics *g) const;
43 | void Die();
44 | Rect GetLawnMowerAttackRect();
45 | void UpdatePool();
46 | void MowZombie(Zombie *theZombie);
47 | void SquishMower();
48 | /*inline*/ void EnableSuperMower(bool theEnable);
49 | };
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/src/lawn/system/ProfileMgr.h:
--------------------------------------------------------------------------------
1 | #ifndef __PROFILEMGR_H__
2 | #define __PROFILEMGR_H__
3 |
4 | #include "framework/Common.h"
5 | #include