diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8eaca7a..1481590 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,18 +17,19 @@ on: jobs: build: - name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.arch.name }} + name: ${{ matrix.platform.name }} ${{ matrix.config.name }} runs-on: ${{ matrix.platform.os }} strategy: fail-fast: false matrix: platform: - - { name: Windows VS2019, os: windows-2019 } - - { name: Windows VS2022, os: windows-2022 } - arch: - - { name: X86, flag: Win32 } - - { name: X64, flag: x64 } + - { name: Windows VS2019 X86, os: windows-2019, flags: -A Win32 } + - { name: Windows VS2019 X64, os: windows-2019, flags: -A x64 } + - { name: Windows VS2022 X86, os: windows-2022, flags: -A Win32 } + - { name: Windows VS2022 X64, os: windows-2022, flags: -A x64 } + - { name: Linux GCC, os: ubuntu-latest } + - { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } config: - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE } - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } @@ -37,9 +38,13 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Install Linux Dependencies + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev + - name: Configure shell: bash - run: cmake -A ${{ matrix.arch.flag }} -S . -B build -DCMAKE_INSTALL_PREFIX=install ${{ matrix.platform.flags }} ${{ matrix.config.flags }} + run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install ${{ matrix.platform.flags }} ${{ matrix.config.flags }} - name: Build shell: bash @@ -52,7 +57,7 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v3 with: - name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.arch.name }} + name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }} path: ./install/bin/* - name: Get Artifact @@ -60,7 +65,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') uses: actions/download-artifact@v3 with: - name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.arch.name }} + name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }} - name: Create Release id: create_release @@ -81,5 +86,5 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ${{ steps.get_artifact.outputs.download-path }} - asset_name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.arch.name }}.zip + asset_name: Schiffbruch-${{ matrix.platform.name }}-${{ matrix.config.name }}.zip asset_content_type: application/zip \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fdb739..e88e405 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,10 +7,82 @@ FetchContent_Declare(SFML GIT_TAG 2.6.x) FetchContent_MakeAvailable(SFML) -add_executable(Schiffbruch WIN32 +option(ENABLE_IPO "Enable link-time optimization, improves speed and memory usage (https://en.wikipedia.org/wiki/Interprocedural_optimization)") +if(ENABLE_IPO) + include(CheckIPOSupported) + check_ipo_supported(RESULT IPO_AVAILABLE OUTPUT IPO_ERROR) + if (IPO_AVAILABLE) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION True) + + if (CMAKE_COMPILER_IS_GNUCXX) + message(STATUS "Enabling all link time optimizations") + add_definitions(-fuse-linker-plugin) + else() + message(STATUS "Disabling linker plugin for link time optimization") + endif() + else() + message(STATUS "IPO/LTO not supported: <${IPO_ERROR}>") + endif() +else() + message(STATUS "Not enabling IPO/LTO") +endif() + +option(ENABLE_SANITIZERS "Enable runtime sanitizing (for development)") +if(ENABLE_SANITIZERS) + message("Enabling asan and ubsan") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") +endif() + +add_subdirectory(tools/resgen) + +add_resource(MISC_BMP "bin/images/Misc.BMP") +add_resource(PANEL_PNG "bin/images/Panel.png") +add_resource(GUYANI_BMP "bin/images/GuyAni.bmp") +add_resource(ANIMATION_BMP "bin/images/Animation.BMP") +add_resource(BAUM_BMP "bin/images/Baum.bmp") +add_resource(CURSOR_BMP "bin/images/Cursor.BMP") +add_resource(BUTTONS_BMP "bin/images/Buttons.bmp") +add_resource(SCHRIFT2_BMP "bin/images/Schrift2.bmp") +add_resource(SCHRIFT1_BMP "bin/images/Schrift1.BMP") +add_resource(TEXTFELD_BMP "bin/images/Textfeld.bmp") +add_resource(PAPIER_BMP "bin/images/Papier.bmp") +add_resource(INVENTAR_BMP "bin/images/Inventar.bmp") +add_resource(BAU_BMP "bin/images/Bau.bmp") +add_resource(CREDITS_BMP "bin/images/Credits.bmp") +add_resource(LOGO_BMP "bin/images/Logo.bmp") +add_resource(LOGO_PNG "bin/images/Logo.png") + +add_resource(ABSPANN_WAV "bin/sounds/abspann.wav") +add_resource(ANGEL_WAV "bin/sounds/angel.wav") +add_resource(BAUMFAELLT_WAV "bin/sounds/baumfaellt.wav") +add_resource(BRANDUNG_WAV "bin/sounds/brandung.wav") +add_resource(CRASH_WAV "bin/sounds/crash.wav") +add_resource(ERFINDUNG_WAV "bin/sounds/erfindung.wav") +add_resource(FAELLEN_WAV "bin/sounds/faellen.wav") +add_resource(FEUER_WAV "bin/sounds/feuer.wav") +add_resource(FLUSS_WAV "bin/sounds/fluss.wav") +add_resource(HAMMER_WAV "bin/sounds/hammer.wav") +add_resource(KLICK2_WAV "bin/sounds/klick2.wav") +add_resource(KLICK_WAV "bin/sounds/klick.wav") +add_resource(KNISTERN_WAV "bin/sounds/knistern.wav") +add_resource(LOGO_WAV "bin/sounds/logo.wav") +add_resource(PLATSCH_WAV "bin/sounds/platsch.wav") +add_resource(SCHAUFELN_WAV "bin/sounds/schaufeln.wav") +add_resource(SCHLAGEN_WAV "bin/sounds/schlagen.wav") +add_resource(SCHLEUDER_WAV "bin/sounds/schleuder.wav") +add_resource(SCHNARCHEN_WAV "bin/sounds/schnarchen.wav") +add_resource(SCHWIMMEN_WAV "bin/sounds/schwimmen.wav") +add_resource(STURM_WAV "bin/sounds/sturm.wav") +add_resource(TRINKEN_WAV "bin/sounds/trinken.wav") +add_resource(WALD_WAV "bin/sounds/wald.wav") +add_resource(WOLF_WAV "bin/sounds/wolf.wav") + +include_directories(${PROJECT_BINARY_DIR}) + +add_executable(Schiffbruch src/Action.cpp src/Application.cpp - src/ddutil.cpp src/Direct.cpp src/Game.cpp src/globals.cpp @@ -20,11 +92,11 @@ add_executable(Schiffbruch WIN32 src/Routing.cpp src/Sound.cpp src/World.cpp + src/strings_en.cpp src/Action.hpp src/Application.hpp src/constants.hpp - src/ddutil.h src/Direct.hpp src/extern.hpp src/Game.hpp @@ -38,11 +110,51 @@ add_executable(Schiffbruch WIN32 src/types.hpp src/World.hpp - src/Schiffbruch.rc + ${MISC_BMP} + ${PANEL_PNG} + ${GUYANI_BMP} + ${ANIMATION_BMP} + ${BAUM_BMP} + ${CURSOR_BMP} + ${BUTTONS_BMP} + ${SCHRIFT2_BMP} + ${SCHRIFT1_BMP} + ${TEXTFELD_BMP} + ${PAPIER_BMP} + ${INVENTAR_BMP} + ${BAU_BMP} + ${CREDITS_BMP} + ${LOGO_BMP} + ${LOGO_PNG} + + ${ABSPANN_WAV} + ${ANGEL_WAV} + ${BAUMFAELLT_WAV} + ${BRANDUNG_WAV} + ${CRASH_WAV} + ${ERFINDUNG_WAV} + ${FAELLEN_WAV} + ${FEUER_WAV} + ${FLUSS_WAV} + ${HAMMER_WAV} + ${KLICK2_WAV} + ${KLICK_WAV} + ${KNISTERN_WAV} + ${LOGO_WAV} + ${PLATSCH_WAV} + ${SCHAUFELN_WAV} + ${SCHLAGEN_WAV} + ${SCHLEUDER_WAV} + ${SCHNARCHEN_WAV} + ${SCHWIMMEN_WAV} + ${STURM_WAV} + ${TRINKEN_WAV} + ${WALD_WAV} + ${WOLF_WAV} ) -target_link_libraries(Schiffbruch PRIVATE sfml-graphics sfml-audio sfml-main dxguid ddraw) target_compile_features(Schiffbruch PRIVATE cxx_std_17) +target_link_libraries(Schiffbruch PRIVATE sfml-graphics sfml-audio) # Copy DLLs next to the executable if (WIN32 AND BUILD_SHARED_LIBS) @@ -51,5 +163,4 @@ if (WIN32 AND BUILD_SHARED_LIBS) endif() install(DIRECTORY bin/ DESTINATION ${CMAKE_INSTALL_BINDIR}) - -install(TARGETS Schiffbruch) \ No newline at end of file +install(TARGETS Schiffbruch) diff --git a/bin/images/Logo.png b/bin/images/Logo.png new file mode 100644 index 0000000..a75dee7 Binary files /dev/null and b/bin/images/Logo.png differ diff --git a/bin/images/Panel.bmp b/bin/images/Panel.bmp index cb8571c..ed6f113 100644 Binary files a/bin/images/Panel.bmp and b/bin/images/Panel.bmp differ diff --git a/bin/images/Panel.png b/bin/images/Panel.png new file mode 100644 index 0000000..1e76795 Binary files /dev/null and b/bin/images/Panel.png differ diff --git a/bin/images/Schrift2.bmp b/bin/images/Schrift2.bmp index b246b67..e12cecf 100644 Binary files a/bin/images/Schrift2.bmp and b/bin/images/Schrift2.bmp differ diff --git a/src/Action.cpp b/src/Action.cpp index fbc9ae8..64c7f86 100644 --- a/src/Action.cpp +++ b/src/Action.cpp @@ -9,2340 +9,2841 @@ #include "State.hpp" #include "World.hpp" -namespace Action +namespace Actions { +void handler(Action::Type event) { - void handler(short event) - { - if (event != NOTHING) - { - Routing::MarkRoute(false); - RouteZiel.x = -1; - RouteZiel.y = -1; - } - switch (event) - { - case NOTHING: - break; - case SEARCH: - search(); - break; - case EAT: - eat(); - break; - case DRINK: - drink(); - break; - case LOG: - log(); - break; - case FIELD: - field(); - break; - case DAY_END: - day_end(); - break; - case RESCUED: - rescued(); - break; - case TENT: - tent(); - break; - case SLEEP: - sleep(); - break; - case CANCEL: - cancel(); - break; - case FISH: - fish(); - break; - case BOAT: - boat(); - break; - case UNDOCK: - undock(); - break; - case DOCK: - dock(); - break; - case PIPE: - pipe(); - break; - case DESTROY: - destroy(); - break; - case SOS_SIGN: - sos(); - break; - case HOUSE1: - house1(); - break; - case HOUSE2: - house2(); - break; - case HOUSE3: - house3(); - break; - case FIREPLACE: - fireplace(); - break; - case LIGHT: - light(); - break; - case LOOKOUT: - lookout(); - break; - case TREASURE: - treasure(); - break; - case INTRO: - intro(); - break; - case SLINGSHOT: - slingshot(); - break; - case QUIT: - quit(); - break; - case RESTART: - restart(); - break; - case DAY_RESTART: - day_restart(); - break; - case DEATH: - death(); - break; - } + if (event != Action::NOTHING) { + Routing::MarkRoute(false); + RouteDestination.x = -1; + RouteDestination.y = -1; } - void intro() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - // Intro Route herstellen - Guy.Aktiv = true; - RoutePunkt = -1; - Steps = 0; - Step = 0; - RouteStart.x = Guy.Pos.x; - RouteStart.y = Guy.Pos.y; - RouteZiel.y = Guy.Pos.y; - for (short x = Guy.Pos.x; x < MAXXKACH; x++) // Zielkoordinate für Introroute finden - { - if (Scape[x][Guy.Pos.y].Art != 1) break; - RouteZiel.x = x - 1; - } - Routing::FindTheWay(); - break; - case 2: - Guy.PosScreen.y -= 10; - Guy.Aktiv = true; - Guy.Zustand = GUYSCHIFFDOWN; - PlaySound(Sound::SPLAT, 100); - PlaySound(Sound::CRASH, 100); - break; - case 3: - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = WRACK; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[WRACK].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[WRACK].rcDes.top); - - World::ChangeBootsFahrt(); - Guy.Pos.x += 2; - Guy.PosScreen.y += 10; - Guy.Zustand = GUYSCHWIMMEN; - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y) / 2)); - break; - case 4: - StopSound(Sound::SWIM); // Sound hier sofort stoppen - Guy.Zustand = GUYLINKS; - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2)); - break; - case 5: - Guy.PosAlt = Guy.PosScreen; - Spielzustand = State::GAME; - Guy.Aktion = NOTHING; - PapierText = Renderer::DrawText(INTROTEXT, TXTPAPIER, 1); - Game::SaveGame(); - break; - } - } + switch (event) { + case Action::NOTHING: + break; - void restart() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - ZWEID Erg = Renderer::GetKachel(Guy.PosAlt.x, Guy.PosAlt.y); - if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - else if (RoutePunkt % 2 == 0) - Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen - else - Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); - TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß - break; - case 2: - Guy.Aktiv = true; - if (BootsFahrt) - Guy.Zustand = GUYBOOTWARTEN; - else - Guy.Zustand = GUYWARTEN; - - PapierText = Renderer::DrawText(NEUBEGINNEN, TXTPAPIER, 1); - break; - case 3: - Guy.Aktion = NOTHING; - if (BootsFahrt) - Guy.Zustand = GUYBOOTLINKS; - else - Guy.Zustand = GUYLINKS; - - if (Frage == 1) - { - Game::NeuesSpiel(true); - return; - } - Frage = -1; - break; - } - } + case Action::SEARCH: + search(); + break; - void day_restart() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - ZWEID Erg = Renderer::GetKachel(Guy.PosAlt.x, Guy.PosAlt.y); - if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - else if (RoutePunkt % 2 == 0) - Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen - else - Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); + case Action::EAT: + eat(); + break; - TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß - break; - case 2: - Guy.Aktiv = true; - if (BootsFahrt) - Guy.Zustand = GUYBOOTWARTEN; - else - Guy.Zustand = GUYWARTEN; - - PapierText = Renderer::DrawText(TAGNEU, TXTPAPIER, 1); - break; - case 3: - Guy.Aktion = NOTHING; - if (BootsFahrt) - Guy.Zustand = GUYBOOTLINKS; - else - Guy.Zustand = GUYLINKS; - - if (Frage == 1) - { - Game::NeuesSpiel(false); - return; - } - Frage = -1; - break; - } - } + case Action::DRINK: + drink(); + break; - void quit() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - ZWEID Erg = Renderer::GetKachel(Guy.PosAlt.x, Guy.PosAlt.y); - if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - else if (RoutePunkt % 2 == 0) - Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen - else - Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); + case Action::LOG: + log(); + break; - TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß - break; - case 2: - Guy.Aktiv = true; - if (BootsFahrt) - Guy.Zustand = GUYBOOTWARTEN; - else - Guy.Zustand = GUYWARTEN; - - PapierText = Renderer::DrawText(SPIELVERLASSEN, TXTPAPIER, 1); - break; - case 3: - Guy.Aktion = NOTHING; - if (BootsFahrt) - Guy.Zustand = GUYBOOTLINKS; - else - Guy.Zustand = GUYLINKS; - - if (Frage == 1) - { - if (Guy.Resource[GESUNDHEIT] > 10) - Game::SaveGame(); - - Spielzustand = State::OUTRO; - } - Frage = -1; - break; - } - } + case Action::FIELD: + field(); + break; - void death() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Guy.Aktiv = true; - if (BootsFahrt) - Guy.Zustand = GUYBOOTWARTEN; - else - Guy.Zustand = GUYWARTEN; + case Action::DAY_END: + day_end(); + break; - PapierText = Renderer::DrawText(TOD, TXTPAPIER, 1); - break; - case 2: - if (!BootsFahrt) - { - Guy.Aktiv = true; - Guy.Zustand = GUYHINLEGEN; - } - break; - case 3: - Guy.Aktiv = true; - Nacht = false; - Renderer::Fade(100, 100, 100); - if (BootsFahrt) - Guy.Zustand = GUYBOOTTOD; - else - Guy.Zustand = GUYTOD; + case Action::RESCUED: + rescued(); + break; - break; - case 4: - Guy.Aktiv = true; - Nacht = true; - Guy.Zustand = GUYWARTEN; - PapierText = Renderer::DrawText(TAGNEU, TXTPAPIER, 1); - break; - case 5: - Nacht = false; - if (BootsFahrt) - Guy.Zustand = GUYBOOTLINKS; - else - Guy.Zustand = GUYLINKS; - - Guy.Aktion = NOTHING; - if (Frage == 2) - Spielzustand = State::OUTRO; - else - Game::NeuesSpiel(false); + case Action::TENT: + tent(); + break; - Frage = -1; - break; - } - } + case Action::SLEEP: + sleep(); + break; - void cancel() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x = Guy.PosScreen.x; - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y = Guy.PosScreen.y; + case Action::CANCEL: + cancel(); + break; - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2)); - break; - case 2: - Guy.Aktion = NOTHING; - break; - } - } + case Action::FISH: + fish(); + break; - void destroy() - { - if (Guy.AkNummer == 0) - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken + case Action::BOAT: + boat(); + break; - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite + 4, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe); - break; - case 2: case 4: - Guy.Aktiv = true; - Guy.Zustand = GUYFAELLEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 5); - break; - case 3: case 5: - Guy.Aktiv = true; - Guy.Zustand = GUYSCHLAGEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 5); - break; - case 6: - { - if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == SOS) - Chance -= 0.1f; - - short i = Scape[Guy.Pos.x][Guy.Pos.y].Objekt; // Um sich kurz das Objekt zu merken - - if ((i >= HAUS1) && (i <= HAUS3)) - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = BAUMGROSS; - else - { - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = -1; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = 0; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = 0; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = -1; - } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; + case Action::UNDOCK: + undock(); + break; + + case Action::DOCK: + dock(); + break; + + case Action::PIPE: + pipe(); + break; + + case Action::DESTROY: + destroy(); + break; + + case Action::SOS_SIGN: + sos(); + break; + + case Action::HOUSE1: + house1(); + break; + + case Action::HOUSE2: + house2(); + break; + + case Action::HOUSE3: + house3(); + break; + + case Action::FIREPLACE: + fireplace(); + break; + + case Action::LIGHT: + light(); + break; + + case Action::LOOKOUT: + lookout(); + break; + + case Action::TREASURE: + treasure(); + break; + + case Action::INTRO: + intro(); + break; + + case Action::SLINGSHOT: + slingshot(); + break; + + case Action::QUIT: + quit(); + break; + + case Action::RESTART: + restart(); + break; + + case Action::DAY_RESTART: + day_restart(); + break; - if (i == ROHR) - World::FillRohr(); + case Action::DEATH: + death(); + break; + } +} - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); +void intro() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + // Intro Route herstellen + Guy.IsActive = true; + RoutePunkt = -1; + Steps = 0; + Step = 0; + RouteStart.x = Guy.Pos.x; + RouteStart.y = Guy.Pos.y; + RouteDestination.y = Guy.Pos.y; + + for (short x = Guy.Pos.x; x < MAX_TILES_X; x++) { // Zielkoordinate für Introroute finden + if (Landscape[x][Guy.Pos.y].Terrain != 1) { break; } - case 7: - Guy.Aktion = NOTHING; - break; + + RouteDestination.x = x - 1; } + + Routing::FindTheWay(); + break; + + case 2: + Guy.ScreenPosition.y -= 10; + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_SHIP_DOWN; + PlaySound(Sound::SPLAT, 100); + PlaySound(Sound::CRASH, 100); + break; + + case 3: + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::WRECK_1; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::WRECK_1].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::WRECK_1].targetRect.top); + + World::ToggleIsInBoat(); + Guy.Pos.x += 2; + Guy.ScreenPosition.y += 10; + Guy.AnimationState = Tiles::GUY_SWIM; + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y) / 2)); + break; + + case 4: + StopSound(Sound::SWIM); // Sound hier sofort stoppen + Guy.AnimationState = Tiles::GUY_LEFT; + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2)); + break; + + case 5: + Guy.OriginalPosition = Guy.ScreenPosition; + s_GameState = State::GAME; + Guy.CurrentAction = Action::NOTHING; + PapierText = Renderer::DrawText(INTROTEXT, TXTPAPIER, 1); + Game::SaveGame(); + break; } +} - void search() - { - ZWEID Ziel; - short i; - - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - } - while (true) - { - Ziel.x = Scape[Guy.Pos.x][Guy.Pos.y].xScreen + rand() % KXPIXEL; - Ziel.y = Scape[Guy.Pos.x][Guy.Pos.y].yScreen + rand() % KYPIXEL; - ZWEID Erg = Renderer::GetKachel(Ziel.x, Ziel.y); - if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) - break; // Wenn das gefundene Ziel in der Kachel, dann fertig - } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: case 3: case 5: case 7: - if (BootsFahrt) - { - if (Guy.AkNummer == 1) - { - Guy.Aktiv = true; - Guy.PosScreen.y -= 2; - Guy.Zustand = GUYTAUCHEN1; - PlaySound(Sound::SPLAT, 100); - } - } - else - Routing::ShortRoute(Ziel.x, Ziel.y); +void restart() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: { + Coordinate Erg = Renderer::GetTile(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + + if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) { + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + } else if (RoutePunkt % 2 == 0) { + Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen + } else { + Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); + } - break; - case 2: case 4: case 6: case 8: - Guy.Aktiv = true; - if (BootsFahrt) - { - if (Guy.AkNummer == 2) - Guy.PosScreen.y += 5; - - Guy.Zustand = GUYTAUCHEN2; - } - else - Guy.Zustand = GUYSUCHEN; + TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß + break; + } - World::AddTime(0, 4); - break; - case 9: - if (BootsFahrt) - { - Guy.Aktiv = true; - Guy.Zustand = GUYTAUCHEN3; - PlaySound(Sound::SPLAT, 100); - } - break; - case 10: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 11: - Guy.Aktiv = true; - if (BootsFahrt) - Guy.Zustand = GUYBOOTLINKS; - - // Auf Strand und Fluss - if ((Scape[Guy.Pos.x][Guy.Pos.y].Art == 2) || ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= FLUSS1) && (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= SCHLEUSE6))) - { - if (Guy.Inventar[ROHSTEIN] < 10) - { - PapierText = Renderer::DrawText(ROHSTEINGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHSTEIN] += 3; - - if (Guy.Inventar[ROHSTEIN] > 10) - Guy.Inventar[ROHSTEIN] = 10; - } - else - PapierText = Renderer::DrawText(ROHSTEINZUVIEL, TXTPAPIER, 1); - } - else if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BUSCH) - { - i = rand() % 2; - switch (i) - { - case 0: - if (Guy.Inventar[ROHAST] < 10) - { - PapierText = Renderer::DrawText(ROHASTGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHAST]++; - } - else PapierText = Renderer::DrawText(ROHASTZUVIEL, TXTPAPIER, 1); - break; - case 1: - if (Guy.Inventar[ROHBLATT] < 10) - { - PapierText = Renderer::DrawText(ROHBLATTGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHBLATT]++; - } - else - PapierText = Renderer::DrawText(ROHBLATTZUVIEL, TXTPAPIER, 1); - break; - } - } - else if (((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= BAUM1) && (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= BAUMGROSS)) || - ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= HAUS1) && (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= HAUS3))) - { - i = rand() % 3; - switch (i) - { - case 0: - if (Guy.Inventar[ROHAST] < 10) - { - PapierText = Renderer::DrawText(ROHASTGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHAST]++; - } - else - PapierText = Renderer::DrawText(ROHASTZUVIEL, TXTPAPIER, 1); - - break; - case 1: - if (Guy.Inventar[ROHBLATT] < 10) - { - PapierText = Renderer::DrawText(ROHBLATTGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHBLATT]++; - } - else - PapierText = Renderer::DrawText(ROHBLATTZUVIEL, TXTPAPIER, 1); - - break; - case 2: - if (Guy.Inventar[ROHLIANE] < 10) - { - PapierText = Renderer::DrawText(ROHLIANEGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHLIANE]++; - } - else - PapierText = Renderer::DrawText(ROHLIANEZUVIEL, TXTPAPIER, 1); - - break; - } - } - else if (BootsFahrt) - { - if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == WRACK) - { - if (Guy.Inventar[ROHFERNROHR] == 0) - { - PapierText = Renderer::DrawText(FERNROHRGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHFERNROHR] = 1; - Bmp[BUTTAUSSCHAU].Phase = 0; - Guy.Inventar[ROHHAMMER] = 1; - Bmp[BUTTHAUS1].Phase = 0; - Bmp[BUTTHAUS2].Phase = 0; - Bmp[BUTTHAUS3].Phase = 0; - } - else - PapierText = Renderer::DrawText(NICHTSGEFUNDEN2, TXTPAPIER, 1); - } - else if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == WRACK2) - { - if (Guy.Inventar[ROHKARTE] == 0) - { - PapierText = Renderer::DrawText(KARTEGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHKARTE] = 1; - Bmp[BUTTSCHATZKARTE].Phase = 0; - Guy.Inventar[ROHSCHAUFEL] = 1; - Bmp[BUTTSCHATZ].Phase = 0; - } - else - PapierText = Renderer::DrawText(NICHTSGEFUNDEN2, TXTPAPIER, 1); - } - else - PapierText = Renderer::DrawText(NICHTSGEFUNDEN2, TXTPAPIER, 1); - } - else - PapierText = Renderer::DrawText(NICHTSGEFUNDEN, TXTPAPIER, 1); + case 2: + Guy.IsActive = true; - break; - case 12: - Guy.Aktion = NOTHING; - break; + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_WAITING; + } else { + Guy.AnimationState = Tiles::GUY_WAITING; } - } - void eat() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken + PapierText = Renderer::DrawText(NEUBEGINNEN, TXTPAPIER, 1); + break; + + case 3: + Guy.CurrentAction = Action::NOTHING; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_LEFT; + } else { + Guy.AnimationState = Tiles::GUY_LEFT; } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite / 2, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe + 2); - break; - case 2: case 3: - Guy.Aktiv = true; - Guy.Zustand = GUYESSEN; - World::AddResource(NAHRUNG, 15); - World::AddTime(0, 2); - break; - case 4: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 5: - Guy.Aktion = NOTHING; - break; + + if (Frage == 1) { + Game::NewGame(true); + return; } + + Frage = -1; + break; } +} - void slingshot() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken +void day_restart() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: { + Coordinate Erg = Renderer::GetTile(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + + if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) { + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + } else if (RoutePunkt % 2 == 0) { + Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen + } else { + Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite / 2 - 14, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe + 9); - break; - case 2: - Guy.Aktiv = true; - Guy.Zustand = GUYSCHLEUDER; - Guy.PosScreen.x += 5; - World::AddTime(0, 2); - PlaySound(Sound::SLINGSHOT, 100); - break; - case 3: - Guy.PosScreen.x -= 5; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite / 2 + 6, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe + 2); - break; - case 4: - Guy.Aktiv = true; - Guy.Zustand = GUYSUCHEN; - World::AddResource(NAHRUNG, 5); - World::AddTime(0, 20); - break; - case 5: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 6: - Guy.Aktion = NOTHING; - break; + + TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß + break; + } + + case 2: { + Guy.IsActive = true; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_WAITING; + } else { + Guy.AnimationState = Tiles::GUY_WAITING; } + + PapierText = Renderer::DrawText(TAGNEU, TXTPAPIER, 1); + break; } - void drink() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken + case 3: { + Guy.CurrentAction = Action::NOTHING; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_LEFT; + } else { + Guy.AnimationState = Tiles::GUY_LEFT; } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Routing::ShortRoute(Guy.PosScreen.x - 4, - Guy.PosScreen.y - 2); - break; - case 2: case 3: - Guy.Aktiv = true; - Guy.Zustand = GUYTRINKEN; - World::AddResource(WASSER, 30); - World::AddTime(0, 3); - break; - case 4: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 5: - Guy.Aktion = NOTHING; - break; + + if (Frage == 1) { + Game::NewGame(false); + return; } + + Frage = -1; + break; + } } +} - void log() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite / 2 + 9, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe + 3); - break; - case 2: case 3: case 4: case 5: case 6: - Guy.Aktiv = true; - Guy.Zustand = GUYFAELLEN; - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 10); - break; - case 7: - { - Guy.Aktiv = true; - Guy.Zustand = GUYWARTEN; - short i = Scape[Guy.Pos.x][Guy.Pos.y].Objekt + (BAUM1DOWN - BAUM1); - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = i; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x -= 17; - PlaySound(Sound::TIMBER, 100); - break; - } - case 8: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 9: - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = -1; - Guy.Inventar[ROHSTAMM]++; - if (Guy.Inventar[ROHSTAMM] > 10) Guy.Inventar[ROHSTAMM] = 10; - Guy.Inventar[ROHAST] += 5; - if (Guy.Inventar[ROHAST] > 10) Guy.Inventar[ROHAST] = 10; - Guy.Inventar[ROHBLATT] += 5; - if (Guy.Inventar[ROHBLATT] > 10) Guy.Inventar[ROHBLATT] = 10; - Guy.Inventar[ROHLIANE] += 2; - if (Guy.Inventar[ROHLIANE] > 10) Guy.Inventar[ROHLIANE] = 10; - Guy.Aktion = NOTHING; - break; +void quit() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: { + Coordinate Erg = Renderer::GetTile(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + + if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) { + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + } else if (RoutePunkt % 2 == 0) { + Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen + } else { + Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); } + + TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß + break; } - void fish() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken + case 2: + Guy.IsActive = true; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_WAITING; + } else { + Guy.AnimationState = Tiles::GUY_WAITING; } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - switch (Scape[Guy.Pos.x][Guy.Pos.y].Objekt) - { - case FLUSS1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 35, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); - break; - case FLUSS2: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 19, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); - break; - case FLUSS3: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 22, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 20); - break; - case FLUSS4: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 34, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 23); - break; - case FLUSS6: case FLUSS7: case MUENDUNG2: case QUELLE2: case SCHLEUSE2: case SCHLEUSE3: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 34, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 33); - break; - case FLUSS5: case FLUSS9: case MUENDUNG1: case QUELLE1: case SCHLEUSE1: case SCHLEUSE5: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 20, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 33); - break; - case FLUSS8: case MUENDUNG4: case QUELLE3: case SCHLEUSE4: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 22, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); - break; - case FLUSS10: case MUENDUNG3: case QUELLE4: case SCHLEUSE6: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + 32, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); - break; - } - break; - case 2: - Guy.Aktiv = true; - PlaySound(Sound::FISH, 100); - if (BootsFahrt) - { - Guy.PosScreen.y -= 2; - Guy.Zustand = GUYBOOTANGELN1; - } - switch (Scape[Guy.Pos.x][Guy.Pos.y].Objekt) - { - case FLUSS1: case FLUSS6: case FLUSS7: case MUENDUNG2: case QUELLE2: case SCHLEUSE2: case SCHLEUSE3: - Guy.Zustand = GUYANGELN1LINKS; - break; - case FLUSS2: case FLUSS5: case FLUSS9: case MUENDUNG1: case QUELLE1: case SCHLEUSE1: case SCHLEUSE5: - Guy.Zustand = GUYANGELN1OBEN; - break; - case FLUSS3: case FLUSS8: case MUENDUNG4: case QUELLE3: case SCHLEUSE4: - Guy.Zustand = GUYANGELN1RECHTS; - break; - case FLUSS4: case FLUSS10: case MUENDUNG3: case QUELLE4: case SCHLEUSE6: - Guy.Zustand = GUYANGELN1UNTEN; - break; - } - break; - case 3: case 4: case 5: case 6: - Guy.Aktiv = true; - if (BootsFahrt) Guy.Zustand = GUYBOOTANGELN2; - - switch (Scape[Guy.Pos.x][Guy.Pos.y].Objekt) - { - case FLUSS1: case FLUSS6: case FLUSS7: case MUENDUNG2: case QUELLE2: case SCHLEUSE2: case SCHLEUSE3: - Guy.Zustand = GUYANGELN2LINKS; - break; - case FLUSS2: case FLUSS5: case FLUSS9: case MUENDUNG1: case QUELLE1: case SCHLEUSE1: case SCHLEUSE5: - Guy.Zustand = GUYANGELN2OBEN; - break; - case FLUSS3: case FLUSS8: case MUENDUNG4: case QUELLE3: case SCHLEUSE4: - Guy.Zustand = GUYANGELN2RECHTS; - break; - case FLUSS4: case FLUSS10: case MUENDUNG3: case QUELLE4: case SCHLEUSE6: - Guy.Zustand = GUYANGELN2UNTEN; - break; - } - Guy.Resource[GESUNDHEIT] += 2; - World::AddTime(0, 20); - break; - case 7: - Guy.Aktiv = true; - if (BootsFahrt) Guy.Zustand = GUYBOOTANGELN3; - - switch (Scape[Guy.Pos.x][Guy.Pos.y].Objekt) - { - case FLUSS1: case FLUSS6: case FLUSS7: case MUENDUNG2: case QUELLE2: case SCHLEUSE2: case SCHLEUSE3: - Guy.Zustand = GUYANGELN3LINKS; - break; - case FLUSS2: case FLUSS5: case FLUSS9: case MUENDUNG1: case QUELLE1: case SCHLEUSE1: case SCHLEUSE5: - Guy.Zustand = GUYANGELN3OBEN; - break; - case FLUSS3: case FLUSS8: case MUENDUNG4: case QUELLE3: case SCHLEUSE4: - Guy.Zustand = GUYANGELN3RECHTS; - break; - case FLUSS4: case FLUSS10: case MUENDUNG3: case QUELLE4: case SCHLEUSE6: - Guy.Zustand = GUYANGELN3UNTEN; - break; + + PapierText = Renderer::DrawText(SPIELVERLASSEN, TXTPAPIER, 1); + break; + + case 3: + Guy.CurrentAction = Action::NOTHING; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_LEFT; + } else { + Guy.AnimationState = Tiles::GUY_LEFT; + } + + if (Frage == 1) { + if (Guy.ResourceAmount[Resources::Health] > 10) { + Game::SaveGame(); } - break; - case 8: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 9: - Guy.Resource[NAHRUNG] += 20; - Guy.Aktion = NOTHING; - break; + + s_GameState = State::OUTRO; } + + Frage = -1; + break; } +} - void light() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite / 2 - 10, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y - + Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe + 1); - break; - case 2: - Guy.Aktiv = true; - Guy.Zustand = GUYANZUENDEN; - Guy.PosScreen.x += 5; - World::AddTime(0, 1); - break; - case 3: - Guy.Aktiv = true; - Guy.Zustand = GUYWARTEN; - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = FEUER; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[FEUER].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[FEUER].rcDes.top); - Chance += 2 + 2 * Scape[Guy.Pos.x][Guy.Pos.y].Hoehe; - World::AddTime(0, 2); - Guy.PosScreen.x -= 5; - break; - case 4: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 5: - Guy.Aktion = NOTHING; - break; +void death() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Guy.IsActive = true; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_WAITING; + } else { + Guy.AnimationState = Tiles::GUY_WAITING; } - } - void lookout() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken + PapierText = Renderer::DrawText(TOD, TXTPAPIER, 1); + break; + + case 2: + if (!IsInBoat) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_LAYING_TENT; } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Guy.Aktiv = true; - Guy.Zustand = GUYAUSSCHAU; - World::AddTime(0, 40); - Chance += 1 + Scape[Guy.Pos.x][Guy.Pos.y].Hoehe; - break; - case 2: - Guy.Aktiv = true; - Guy.Zustand = GUYWARTEN; - World::AddTime(0, 40); - break; - case 3: - Guy.Aktiv = true; - Guy.Zustand = GUYAUSSCHAU; - World::AddTime(0, 40); - break; - case 4: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 5: - Chance -= 1 + Scape[Guy.Pos.x][Guy.Pos.y].Hoehe; - Guy.Aktion = NOTHING; - break; + + break; + + case 3: + Guy.IsActive = true; + Night = false; + Renderer::Fade(100, 100, 100); + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_DEAD; + } else { + Guy.AnimationState = Tiles::GUY_DEAD; } - } - void treasure() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; + break; + + case 4: + Guy.IsActive = true; + Night = true; + Guy.AnimationState = Tiles::GUY_WAITING; + PapierText = Renderer::DrawText(TAGNEU, TXTPAPIER, 1); + break; + + case 5: + Night = false; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_LEFT; + } else { + Guy.AnimationState = Tiles::GUY_LEFT; } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Guy.PosScreen.x -= 5; - Guy.PosScreen.y += 1; - Guy.Aktiv = true; - Guy.Zustand = GUYSCHAUFELN; - break; - case 2: - World::AddTime(0, 20); - World::AddResource(WASSER, -10); - World::AddResource(NAHRUNG, -10); - Guy.PosScreen.x += 5; - Guy.PosScreen.y -= 1; - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - if (((Guy.Pos.x == SchatzPos.x) && (Guy.Pos.y == SchatzPos.y)) && - (!SchatzGef)) - { - PapierText = Renderer::DrawText(SCHATZGEFUNDEN, TXTPAPIER, 1); - Guy.Inventar[ROHSTREICHHOLZ] = 1; - Bmp[BUTTANZUENDEN].Phase = 0; - SchatzGef = true; - } - else PapierText = Renderer::DrawText(KEINSCHATZ, TXTPAPIER, 1); - break; - case 3: - Guy.Aktion = NOTHING; - break; + Guy.CurrentAction = Action::NOTHING; + + if (Frage == 2) { + s_GameState = State::OUTRO; + } else { + Game::NewGame(false); } + + Frage = -1; + break; } +} - void field() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[FELD].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = FELD; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[FELD].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[FELD].rcDes.top); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[FELD].Anzahl; +void cancel() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x = Guy.ScreenPosition.x; + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y = Guy.ScreenPosition.y; + + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2)); + break; + + case 2: + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void destroy() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width + 4, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height); + break; + + case 2: + case 4: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CHOP; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 5); + break; + + case 3: + case 5: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_BEAT; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 5); + break; + + case 6: { + if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::SOS) { + Chance -= 0.1f; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + short i = Landscape[Guy.Pos.x][Guy.Pos.y].Object; // Um sich kurz das Objekt zu merken + + if ((i >= Tiles::HOUSE_1) && (i <= Tiles::HOUSE_3)) { + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::INVALID; + } else { + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::INVALID; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = -1; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 22, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 23); - break; - case 4: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 4; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 25, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 21); - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 30); - break; - case 7: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 5; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 28, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 19); - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 30); - break; - case 10: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 6; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 31, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 17); - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 30); - break; - case 13: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 7; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 34, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 15); - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 30); - break; - case 16: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 8; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 36, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 13); - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 30); - break; - case 2: case 3: case 5: case 6: case 8: case 9: case 11: case 12: case 14: case 15: case 17: case 18: - Guy.Aktiv = true; - Guy.Zustand = GUYFELD; - break; - case 19: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = FELD; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[FELD].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[FELD].rcDes.top); - break; - case 20: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Bmp[BUTTSTOP].Phase = -1; - if (Bmp[FELD].First) - { - PapierText = Renderer::DrawText(FELDHILFE, TXTPAPIER, 1); - Bmp[FELD].First = false; - } - Guy.Aktion = NOTHING; - break; + + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + + if (i == Action::PIPE) { + World::FillPipe(); } + + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; } - void day_end() - { - ZWEID Erg; + case 7: + Guy.CurrentAction = Action::NOTHING; + break; + } +} - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Renderer::Fade(100, 90, 90); - Stunden = 12; - Minuten = 0; - TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß - Bmp[BUTTSTOP].Phase = -1; - if ((Guy.Zustand == GUYSCHLAFZELT) || (Guy.Zustand == GUYSCHLAFEN) || - (Guy.Zustand == GUYSCHLAFHAUS) || (BootsFahrt)) - break; - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x = Guy.PosScreen.x; - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y = Guy.PosScreen.y; - Erg = Renderer::GetKachel(Guy.PosAlt.x, Guy.PosAlt.y); - if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - else if (RoutePunkt % 2 == 0) Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen - else Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); - break; - case 2: - Renderer::Fade(95, 80, 80); - Stunden = 12; - Minuten = 0; - if ((Guy.Zustand == GUYSCHLAFZELT) || (Guy.Zustand == GUYSCHLAFEN) || - (Guy.Zustand == GUYSCHLAFHAUS) || (BootsFahrt)) - break; - // Wohnbare Objekte in der Umgebung suchen - Erg.x = -1; - Erg.y = -1; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) || (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3)) - { - Erg.x = Guy.Pos.x; - Erg.y = Guy.Pos.y; - } - else if (Scape[Guy.Pos.x - 1][Guy.Pos.y].Objekt == HAUS3) - { - Erg.x = Guy.Pos.x - 1; - Erg.y = Guy.Pos.y; - } - else if (Scape[Guy.Pos.x][Guy.Pos.y - 1].Objekt == HAUS3) - { - Erg.x = Guy.Pos.x; - Erg.y = Guy.Pos.y - 1; - } - else if (Scape[Guy.Pos.x + 1][Guy.Pos.y].Objekt == HAUS3) - { - Erg.x = Guy.Pos.x + 1; - Erg.y = Guy.Pos.y; - } - else if (Scape[Guy.Pos.x][Guy.Pos.y + 1].Objekt == HAUS3) - { - Erg.x = Guy.Pos.x; - Erg.y = Guy.Pos.y + 1; - } - else if (Scape[Guy.Pos.x - 1][Guy.Pos.y].Objekt == ZELT) - { - Erg.x = Guy.Pos.x - 1; - Erg.y = Guy.Pos.y; - } - else if (Scape[Guy.Pos.x][Guy.Pos.y - 1].Objekt == ZELT) - { - Erg.x = Guy.Pos.x; - Erg.y = Guy.Pos.y - 1; - } - else if (Scape[Guy.Pos.x + 1][Guy.Pos.y].Objekt == ZELT) - { - Erg.x = Guy.Pos.x + 1; - Erg.y = Guy.Pos.y; - } - else if (Scape[Guy.Pos.x][Guy.Pos.y + 1].Objekt == ZELT) - { - Erg.x = Guy.Pos.x; - Erg.y = Guy.Pos.y + 1; +void search() +{ + Coordinate target; + short i; + + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + while (true) { + target.x = Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + rand() % TILE_SIZE_X; + target.y = Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + rand() % TILE_SIZE_Y; + Coordinate Erg = Renderer::GetTile(target.x, target.y); + + if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) { + break; // Wenn das gefundene Ziel in der Kachel, dann fertig + } + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + case 3: + case 5: + case 7: + if (IsInBoat) { + if (Guy.ActionStep == 1) { + Guy.IsActive = true; + Guy.ScreenPosition.y -= 2; + Guy.AnimationState = Tiles::GUY_DIVING_1; + PlaySound(Sound::SPLAT, 100); } - if ((Erg.x != -1) && (Erg.y != -1)) - { - Guy.Pos.x = Erg.x; - Guy.Pos.y = Erg.y; - if ((Scape[Erg.x][Erg.y].Objekt == ZELT) && - (Scape[Erg.x][Erg.y].Phase < Bmp[Scape[Erg.x][Erg.y].Objekt].Anzahl)) - Routing::ShortRoute(Scape[Erg.x][Erg.y].xScreen + Scape[Erg.x][Erg.y].ObPos.x + 3, - Scape[Erg.x][Erg.y].yScreen + Scape[Erg.x][Erg.y].ObPos.y + 20); - else if ((Scape[Erg.x][Erg.y].Objekt == HAUS3) && - (Scape[Erg.x][Erg.y].Phase < Bmp[Scape[Erg.x][Erg.y].Objekt].Anzahl)) - Routing::ShortRoute(Scape[Erg.x][Erg.y].xScreen + Scape[Erg.x][Erg.y].ObPos.x + - Bmp[BAUMGROSS].Breite / 2, - Scape[Erg.x][Erg.y].yScreen + Scape[Erg.x][Erg.y].ObPos.y + - Bmp[BAUMGROSS].Hoehe + 1); + } else { + Routing::ShortRoute(target.x, target.y); + } + + break; + + case 2: + case 4: + case 6: + case 8: + Guy.IsActive = true; + + if (IsInBoat) { + if (Guy.ActionStep == 2) { + Guy.ScreenPosition.y += 5; } - break; - case 3: - Renderer::Fade(90, 70, 70); - Stunden = 12; - Minuten = 0; - if ((Guy.Zustand == GUYSCHLAFZELT) || (Guy.Zustand == GUYSCHLAFEN) || - (Guy.Zustand == GUYSCHLAFHAUS) || (BootsFahrt)) + + Guy.AnimationState = Tiles::GUY_DIVING_2; + } else { + Guy.AnimationState = Tiles::GUY_SEARCH; + } + + World::AddTime(0, 4); + break; + + case 9: + if (IsInBoat) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_DIVING_3; + PlaySound(Sound::SPLAT, 100); + } + + break; + + case 10: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 11: + Guy.IsActive = true; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_LEFT; + } + + // Auf Strand und Fluss + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Terrain == 2) || ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::RIVER_1) && (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::FLOODGATE_6))) { + if (Guy.Inventory[Tiles::RAW_STONE] < 10) { + PapierText = Renderer::DrawText(ROHSTEINGEFUNDEN, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_STONE] += 3; + + if (Guy.Inventory[Tiles::RAW_STONE] > 10) { + Guy.Inventory[Tiles::RAW_STONE] = 10; + } + } else { + PapierText = Renderer::DrawText(ROHSTEINZUVIEL, TXTPAPIER, 1); + } + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::BUSH) { + i = rand() % 2; + + switch (i) { + case 0: + if (Guy.Inventory[Tiles::RAW_TREE_BRANCH] < 10) { + PapierText = Renderer::DrawText(ROHASTGEFUNDEN, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_TREE_BRANCH]++; + } else { + PapierText = Renderer::DrawText(ROHASTZUVIEL, TXTPAPIER, 1); + } + break; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN1; - } - break; - case 4: - Renderer::Fade(70, 60, 60); - Stunden = 12; - Minuten = 0; - if ((Guy.Zustand == GUYSCHLAFZELT) || (Guy.Zustand == GUYSCHLAFEN) || - (Guy.Zustand == GUYSCHLAFHAUS) || (BootsFahrt)) + + case 1: + if (Guy.Inventory[Tiles::RAW_LEAF] < 10) { + PapierText = Renderer::DrawText(STRING_LEAF_FOUND, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_LEAF]++; + } else { + PapierText = Renderer::DrawText(STRING_ALREADY_HAVE_LEAF, TXTPAPIER, 1); + } + break; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYGEHINZELT; - } - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYGEHINHAUS; - } - else - { - Guy.PosScreen.x += 3; - Guy.Aktiv = true; - Guy.Zustand = GUYHINLEGEN; - } - break; - case 5: - Renderer::Fade(55, 50, 55); - Stunden = 12; - Minuten = 0; - if (BootsFahrt) break; - Guy.Aktiv = true; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - if (Guy.Zustand != GUYSCHLAFZELT) Guy.PosScreen.x += 4; - Guy.Zustand = GUYSCHLAFZELT; - } - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - if (Guy.Zustand != GUYSCHLAFHAUS) Guy.PosScreen.x += 14; - Guy.Zustand = GUYSCHLAFHAUS; - } - else Guy.Zustand = GUYSCHLAFEN; - break; - case 6: - Renderer::Fade(25, 25, 35); - Stunden = 12; - Minuten = 0; - if (BootsFahrt) break; - Guy.Aktiv = true; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Guy.Zustand = GUYSCHLAFZELT; - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Guy.Zustand = GUYSCHLAFHAUS; - else Guy.Zustand = GUYSCHLAFEN; - break; - case 7: - Renderer::Fade(0, 0, 0); // Nicht verwirren lassen, da das Bild in Zeige() schwarz übermalt wird - Nacht = true; - Stunden = 12; - Minuten = 0; - PlaySound(Sound::WOLF, 100); - // Falsche Objekte Löschen - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= BAUM1DOWN) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= BAUM4DOWN)) - { - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = -1; - Guy.Inventar[ROHSTAMM]++; - if (Guy.Inventar[ROHSTAMM] > 10) Guy.Inventar[ROHSTAMM] = 10; } + } else if (((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::TREE_1) && (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::TREE_BIG)) || + ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::HOUSE_1) && (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::HOUSE_3))) { + i = rand() % 3; + + switch (i) { + case 0: + if (Guy.Inventory[Tiles::RAW_TREE_BRANCH] < 10) { + PapierText = Renderer::DrawText(ROHASTGEFUNDEN, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_TREE_BRANCH]++; + } else { + PapierText = Renderer::DrawText(ROHASTZUVIEL, TXTPAPIER, 1); + } - // Je nach Schlafort Zustand verändern - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - World::AddResource(GESUNDHEIT, -5); - if (Guy.Resource[GESUNDHEIT] <= 0) - { - Guy.Aktiv = true; - PapierText = Renderer::DrawText(TAGENDE5, TXTPAPIER, 1); - Guy.AkNummer = 2; - Guy.Aktion = DEATH; - Stunden = 0; - Minuten = 0; + break; + + case 1: + if (Guy.Inventory[Tiles::RAW_LEAF] < 10) { + PapierText = Renderer::DrawText(STRING_LEAF_FOUND, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_LEAF]++; + } else { + PapierText = Renderer::DrawText(STRING_ALREADY_HAVE_LEAF, TXTPAPIER, 1); } - else - { - Guy.Aktiv = true; - PapierText = Renderer::DrawText(TAGENDE2, TXTPAPIER, 1); + + break; + + case 2: + if (Guy.Inventory[Tiles::RAW_LIANA] < 10) { + PapierText = Renderer::DrawText(STRING_LIANA_FOUND, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_LIANA]++; + } else { + PapierText = Renderer::DrawText(STRING_LIANA_FULL, TXTPAPIER, 1); } + + break; } - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - World::AddResource(GESUNDHEIT, +20); - Guy.Aktiv = true; - PapierText = Renderer::DrawText(TAGENDE4, TXTPAPIER, 1); - } - else if (BootsFahrt) - { - Guy.Aktiv = true; - Guy.Zustand = GUYBOOTWARTEN; - PapierText = Renderer::DrawText(TAGENDE3, TXTPAPIER, 1); - Guy.AkNummer = 2; - Guy.Aktion = DEATH; - Stunden = 0; - Minuten = 0; - } - else - { - World::AddResource(GESUNDHEIT, -20); - if (Guy.Resource[GESUNDHEIT] <= 0) - { - Guy.Aktiv = true; - PapierText = Renderer::DrawText(TAGENDE5, TXTPAPIER, 1); - Guy.AkNummer = 2; - Guy.Aktion = DEATH; - Stunden = 0; - Minuten = 0; + } else if (IsInBoat) { + if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::WRECK_1) { + if (Guy.Inventory[Tiles::RAW_TELESCOPE] == 0) { + PapierText = Renderer::DrawText(STRING_TELESCOPE_FOUND, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_TELESCOPE] = 1; + Bmp[Tiles::BUTTON_LOOK_OUT].AnimationPhase = 0; + Guy.Inventory[Tiles::RAW_HAMMER] = 1; + Bmp[Tiles::BUTTON_HOUSE_1].AnimationPhase = 0; + Bmp[Tiles::BUTTON_HOUSE_2].AnimationPhase = 0; + Bmp[Tiles::BUTTON_HOUSE_3].AnimationPhase = 0; + } else { + PapierText = Renderer::DrawText(NICHTSGEFUNDEN2, TXTPAPIER, 1); } - else - { - Guy.Aktiv = true; - PapierText = Renderer::DrawText(TAGENDE1, TXTPAPIER, 1); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::WRECK_2) { + if (Guy.Inventory[Tiles::RAW_MAP] == 0) { + PapierText = Renderer::DrawText(KARTEGEFUNDEN, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_MAP] = 1; + Bmp[Tiles::BUTTON_TREASUREMAP].AnimationPhase = 0; + Guy.Inventory[Tiles::RAW_SHOVEL] = 1; + Bmp[Tiles::BUTTON_TREASURE].AnimationPhase = 0; + } else { + PapierText = Renderer::DrawText(NICHTSGEFUNDEN2, TXTPAPIER, 1); } + } else { + PapierText = Renderer::DrawText(NICHTSGEFUNDEN2, TXTPAPIER, 1); } - break; - case 8: - Renderer::Fade(20, 20, 30); - Nacht = false; - Tag++; - Stunden = 0; - Minuten = 0; - // if (BootsFahrt) Game::NeuesSpiel(true); // Später hier tot!! - - Guy.Aktiv = true; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Guy.Zustand = GUYSCHLAFZELT; - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Guy.Zustand = GUYSCHLAFHAUS; - else Guy.Zustand = GUYSCHLAFEN; - break; - case 9: - Renderer::Fade(40, 40, 40); - Stunden = 0; - Minuten = 0; - - Stunden = 0; - Minuten = 0; - Guy.Aktiv = true; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Guy.Zustand = GUYSCHLAFZELT; - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Guy.Zustand = GUYSCHLAFHAUS; - else Guy.Zustand = GUYSCHLAFEN; - break; - case 10: - Renderer::Fade(70, 60, 60); - Stunden = 0; - Minuten = 0; - StopSound(Sound::SNORE); - Guy.Aktiv = true; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.PosScreen.x -= 14; - Guy.Zustand = GUYGEHAUSHAUS; - } - else Guy.Zustand = GUYAUFSTEHEN; - break; - case 11: - Renderer::Fade(90, 80, 80); - Stunden = 0; - Minuten = 0; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN2; - } - break; - case 12: - Renderer::Fade(100, 100, 100); - Stunden = 0; - Minuten = 0; - Guy.Zustand = GUYLINKS; - Guy.Aktion = NOTHING; - if (Guy.Resource[GESUNDHEIT] > 10) Game::SaveGame(); - break; + } else { + PapierText = Renderer::DrawText(NICHTSGEFUNDEN, TXTPAPIER, 1); } + + break; + + case 12: + Guy.CurrentAction = Action::NOTHING; + break; } +} - void rescued() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - ZWEID Erg = Renderer::GetKachel(Guy.PosAlt.x, Guy.PosAlt.y); - if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - else if (RoutePunkt % 2 == 0) Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); //Nur bis zur Mitte der aktuellen Kacheln laufen - else Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); - TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß - break; - case 2: - Guy.Aktiv = true; - Guy.Zustand = GUYWARTEN; - PapierText = Renderer::DrawText(GERETTET, TXTPAPIER, 1); - break; - case 3: - if (Frage == 2) - { - Guy.Aktion = NOTHING; - Frage = -1; - break; - } - Spielzustand = State::RESCUED; - Frage = -1; - break; - case 4: - // Route herstellen - Guy.Aktiv = true; - Guy.Zustand = GUYLINKS; - RoutePunkt = -1; - Steps = 0; - Step = 0; - RouteStart.x = Guy.Pos.x; - RouteStart.y = Guy.Pos.y; - RouteZiel.y = Guy.Pos.y; - for (short x = MAXXKACH - 1; x > 1; x--) // Position des Rettungsschiffs festlegen - { - if (Scape[x][Guy.Pos.y].Art != 1) break; - RouteZiel.x = x + 1; - } - // Schiff hinbauen - Scape[RouteZiel.x][RouteZiel.y].Phase = 0; - Scape[RouteZiel.x][RouteZiel.y].Objekt = GUYSCHIFF; - Scape[RouteZiel.x][RouteZiel.y].ObPos.x = 10; - Scape[RouteZiel.x][RouteZiel.y].ObPos.y = 10; - RouteZiel.x -= 2; - Routing::FindTheWay(); - Guy.Zustand = GUYLINKS; - break; - case 5: - Guy.Zustand = GUYLINKS; - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2)); - break; - case 6: - Guy.Pos.x += 2; - Guy.Zustand = GUYSCHWIMMEN; - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2)); - break; - case 7: - Guy.PosScreen.y -= 10; - if (!BootsFahrt) World::ChangeBootsFahrt(); - Guy.Aktiv = true; - Guy.Zustand = GUYSCHIFF; - RoutePunkt = -1; - Steps = 0; - Step = 0; - RouteStart.x = Guy.Pos.x; - RouteStart.y = Guy.Pos.y; - RouteZiel.y = Guy.Pos.y; - RouteZiel.x = MAXXKACH - 2; - Routing::FindTheWay(); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[MEERWELLEN].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[MEERWELLEN].rcDes.top); - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = MEERWELLEN; - break; - case 8: - Guy.Aktiv = true; - Guy.Zustand = GUYSCHIFF; - break; - case 9: - Guy.Aktion = NOTHING; - Guy.Zustand = GUYLINKS; - Spielzustand = State::OUTRO; - break; - } +void eat() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width / 2, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height + 2); + break; + + case 2: + case 3: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_EAT; + World::AddResource(Resources::Food, 15); + World::AddTime(0, 2); + break; + + case 4: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 5: + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void slingshot() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width / 2 - 14, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height + 9); + break; + + case 2: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_SLINGSHOT; + Guy.ScreenPosition.x += 5; + World::AddTime(0, 2); + PlaySound(Sound::SLINGSHOT, 100); + break; + + case 3: + Guy.ScreenPosition.x -= 5; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width / 2 + 6, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height + 2); + break; + + case 4: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_SEARCH; + World::AddResource(Resources::Food, 5); + World::AddTime(0, 20); + break; + + case 5: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 6: + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void drink() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Routing::ShortRoute(Guy.ScreenPosition.x - 4, + Guy.ScreenPosition.y - 2); + break; + + case 2: + case 3: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_DRINK; + World::AddResource(Resources::Water, 30); + World::AddTime(0, 3); + break; + + case 4: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 5: + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void log() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken } - void tent() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = ZELT; - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[ZELT].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[ZELT].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[ZELT].rcDes.top); + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width / 2 + 9, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height + 3); + break; + + case 2: + case 3: + case 4: + case 5: + case 6: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CHOP; + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 10); + break; + + case 7: { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_WAITING; + short i = Landscape[Guy.Pos.x][Guy.Pos.y].Object + (Tiles::TREE_DOWN_1 - Tiles::TREE_1); + Landscape[Guy.Pos.x][Guy.Pos.y].Object = i; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x -= 17; + PlaySound(Sound::TIMBER, 100); + break; + } + + case 8: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 9: + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::INVALID; + Guy.Inventory[Tiles::RAW_TREE_TRUNK]++; + + if (Guy.Inventory[Tiles::RAW_TREE_TRUNK] > 10) { + Guy.Inventory[Tiles::RAW_TREE_TRUNK] = 10; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + Guy.Inventory[Tiles::RAW_TREE_BRANCH] += 5; + + if (Guy.Inventory[Tiles::RAW_TREE_BRANCH] > 10) { + Guy.Inventory[Tiles::RAW_TREE_BRANCH] = 10; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 22, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 12); - break; - case 2: case 3: case 12: case 13: - Guy.Aktiv = true; - Guy.Zustand = GUYBINDENUNTEN; - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 15); + + Guy.Inventory[Tiles::RAW_LEAF] += 5; + + if (Guy.Inventory[Tiles::RAW_LEAF] > 10) { + Guy.Inventory[Tiles::RAW_LEAF] = 10; + } + + Guy.Inventory[Tiles::RAW_LIANA] += 2; + + if (Guy.Inventory[Tiles::RAW_LIANA] > 10) { + Guy.Inventory[Tiles::RAW_LIANA] = 10; + } + + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void fish() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + switch (Landscape[Guy.Pos.x][Guy.Pos.y].Object) { + case Tiles::RIVER_1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 35, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); break; - case 4: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 2; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 31, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 20); + + case Tiles::RIVER_2: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 19, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); break; - case 5: - Routing::ShortRoute(Guy.PosAlt.x, - Guy.PosAlt.y); + + case Tiles::RIVER_3: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 22, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 20); break; - case 6: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 3, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 20); + case Tiles::RIVER_4: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 34, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 23); break; - case 7: case 8: - Guy.Aktiv = true; - Guy.Zustand = GUYBINDENOBEN; - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 15); + + case Tiles::RIVER_6: + case Tiles::RIVER_7: + case Tiles::RIVER_END_2: + case Tiles::RIVER_START_2: + case Tiles::FLOODGATE_2: + case Tiles::FLOODGATE_3: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 34, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 33); break; - case 9: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 3; - Routing::ShortRoute(Guy.PosAlt.x, - Guy.PosAlt.y); + + case Tiles::RIVER_5: + case Tiles::RIVER_9: + case Tiles::RIVER_END_1: + case Tiles::RIVER_START_1: + case Tiles::FLOODGATE_1: + case Tiles::FLOODGATE_5: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 20, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 33); break; - case 10: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 31, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 20); + + case Tiles::RIVER_8: + case Tiles::RIVER_END_4: + case Tiles::RIVER_START_3: + case Tiles::FLOODGATE_4: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 22, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); break; - case 11: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 22, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 12); + + case Tiles::RIVER_10: + case Tiles::RIVER_END_3: + case Tiles::RIVER_START_4: + case Tiles::FLOODGATE_6: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + 32, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + 26); break; - case 14: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 31, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 20); + } + + break; + + case 2: + Guy.IsActive = true; + PlaySound(Sound::FISH, 100); + + if (IsInBoat) { + Guy.ScreenPosition.y -= 2; + Guy.AnimationState = Tiles::GUY_BOAT_FISHING_1; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].Object) { + case Tiles::RIVER_1: + case Tiles::RIVER_6: + case Tiles::RIVER_7: + case Tiles::RIVER_END_2: + case Tiles::RIVER_START_2: + case Tiles::FLOODGATE_2: + case Tiles::FLOODGATE_3: + Guy.AnimationState = Tiles::GUY_FISHING_LEFT_1; + break; + + case Tiles::RIVER_2: + case Tiles::RIVER_5: + case Tiles::RIVER_9: + case Tiles::RIVER_END_1: + case Tiles::RIVER_START_1: + case Tiles::FLOODGATE_1: + case Tiles::FLOODGATE_5: + Guy.AnimationState = Tiles::GUY_FISHING_ABOVE_1; + break; + + case Tiles::RIVER_3: + case Tiles::RIVER_8: + case Tiles::RIVER_END_4: + case Tiles::RIVER_START_3: + case Tiles::FLOODGATE_4: + Guy.AnimationState = Tiles::GUY_FISHING_RIGHT_1; + break; + + case Tiles::RIVER_4: + case Tiles::RIVER_10: + case Tiles::RIVER_END_3: + case Tiles::RIVER_START_4: + case Tiles::FLOODGATE_6: + Guy.AnimationState = Tiles::GUY_FISHING_BELOW_1; break; - case 15: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); + } + + break; + + case 3: + case 4: + case 5: + case 6: + Guy.IsActive = true; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_FISHING_2; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].Object) { + case Tiles::RIVER_1: + case Tiles::RIVER_6: + case Tiles::RIVER_7: + case Tiles::RIVER_END_2: + case Tiles::RIVER_START_2: + case Tiles::FLOODGATE_2: + case Tiles::FLOODGATE_3: + Guy.AnimationState = Tiles::GUY_FISHING_LEFT_2; + break; + + case Tiles::RIVER_2: + case Tiles::RIVER_5: + case Tiles::RIVER_9: + case Tiles::RIVER_END_1: + case Tiles::RIVER_START_1: + case Tiles::FLOODGATE_1: + case Tiles::FLOODGATE_5: + Guy.AnimationState = Tiles::GUY_FISHING_ABOVE_2; + break; + + case Tiles::RIVER_3: + case Tiles::RIVER_8: + case Tiles::RIVER_END_4: + case Tiles::RIVER_START_3: + case Tiles::FLOODGATE_4: + Guy.AnimationState = Tiles::GUY_FISHING_RIGHT_2; + break; + + case Tiles::RIVER_4: + case Tiles::RIVER_10: + case Tiles::RIVER_END_3: + case Tiles::RIVER_START_4: + case Tiles::FLOODGATE_6: + Guy.AnimationState = Tiles::GUY_FISHING_BELOW_2; break; - case 16: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Bmp[BUTTSTOP].Phase = -1; - if (Bmp[ZELT].First) - { - PapierText = Renderer::DrawText(ZELTHILFE, TXTPAPIER, 1); - Bmp[ZELT].First = false; - } - Guy.Aktion = NOTHING; + } + + Guy.ResourceAmount[Resources::Health] += 2; + World::AddTime(0, 20); + break; + + case 7: + Guy.IsActive = true; + + if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_FISHING_3; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].Object) { + case Tiles::RIVER_1: + case Tiles::RIVER_6: + case Tiles::RIVER_7: + case Tiles::RIVER_END_2: + case Tiles::RIVER_START_2: + case Tiles::FLOODGATE_2: + case Tiles::FLOODGATE_3: + Guy.AnimationState = Tiles::GUY_FISHING_LEFT_3; + break; + + case Tiles::RIVER_2: + case Tiles::RIVER_5: + case Tiles::RIVER_9: + case Tiles::RIVER_END_1: + case Tiles::RIVER_START_1: + case Tiles::FLOODGATE_1: + case Tiles::FLOODGATE_5: + Guy.AnimationState = Tiles::GUY_FISHING_ABOVE_3; + break; + + case Tiles::RIVER_3: + case Tiles::RIVER_8: + case Tiles::RIVER_END_4: + case Tiles::RIVER_START_3: + case Tiles::FLOODGATE_4: + Guy.AnimationState = Tiles::GUY_FISHING_RIGHT_3; + break; + + case Tiles::RIVER_4: + case Tiles::RIVER_10: + case Tiles::RIVER_END_3: + case Tiles::RIVER_START_4: + case Tiles::FLOODGATE_6: + Guy.AnimationState = Tiles::GUY_FISHING_BELOW_3; break; } + + break; + + case 8: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 9: + Guy.ResourceAmount[Resources::Food] += 20; + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void light() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width / 2 - 10, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height + 1); + break; + + case 2: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_SET_FIRE; + Guy.ScreenPosition.x += 5; + World::AddTime(0, 1); + break; + + case 3: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_WAITING; + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::FIRE; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::FIRE].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::FIRE].targetRect.top); + Chance += 2 + 2 * Landscape[Guy.Pos.x][Guy.Pos.y].Height; + World::AddTime(0, 2); + Guy.ScreenPosition.x -= 5; + break; + + case 4: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 5: + Guy.CurrentAction = Action::NOTHING; + break; } +} - void boat() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = BOOT; - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[BOOT].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[BOOT].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[BOOT].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[BOOT].rcDes.top); +void lookout() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_LOOK_OUT; + World::AddTime(0, 40); + Chance += 1 + Landscape[Guy.Pos.x][Guy.Pos.y].Height; + break; + + case 2: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_WAITING; + World::AddTime(0, 40); + break; + + case 3: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_LOOK_OUT; + World::AddTime(0, 40); + break; + + case 4: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 5: + Chance -= 1 + Landscape[Guy.Pos.x][Guy.Pos.y].Height; + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void treasure() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Guy.ScreenPosition.x -= 5; + Guy.ScreenPosition.y += 1; + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_SHOVEL; + break; + + case 2: + World::AddTime(0, 20); + World::AddResource(Resources::Water, -10); + World::AddResource(Resources::Food, -10); + Guy.ScreenPosition.x += 5; + Guy.ScreenPosition.y -= 1; + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + + if (((Guy.Pos.x == SchatzPos.x) && (Guy.Pos.y == SchatzPos.y)) && + (!SchatzGef)) { + PapierText = Renderer::DrawText(SCHATZGEFUNDEN, TXTPAPIER, 1); + Guy.Inventory[Tiles::RAW_MATCH] = 1; + Bmp[Tiles::BUTTON_IGNITE].AnimationPhase = 0; + SchatzGef = true; + } else { + PapierText = Renderer::DrawText(KEINSCHATZ, TXTPAPIER, 1); } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + break; + + case 3: + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void field() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::FIELD].RequiredRawMaterials[i]; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 30, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 21); - break; - case 2: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 29, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 20); - break; - case 3: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 28, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 19); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[BOOT].Anzahl + 1); + + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::FIELD; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::FIELD].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::FIELD].targetRect.top); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::FIELD].AnimationPhaseCount; + } + + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 22, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 23); + break; + + case 4: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 4; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 25, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 21); + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 30); + break; + + case 7: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 5; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 28, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 19); + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 30); + break; + + case 10: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 6; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 31, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 17); + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 30); + break; + + case 13: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 7; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 34, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 15); + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 30); + break; + + case 16: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 8; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 36, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 13); + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 30); + break; + + case 2: + case 3: + case 5: + case 6: + case 8: + case 9: + case 11: + case 12: + case 14: + case 15: + case 17: + case 18: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_FARMING; + break; + + case 19: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::FIELD; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::FIELD].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::FIELD].targetRect.top); + break; + + case 20: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if (Bmp[Tiles::FIELD].First) { + PapierText = Renderer::DrawText(FELDHILFE, TXTPAPIER, 1); + Bmp[Tiles::FIELD].First = false; + } + + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void day_end() +{ + Coordinate Erg; + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Renderer::Fade(100, 90, 90); + Hours = 12; + Minutes = 0; + TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if ((Guy.AnimationState == Tiles::GUY_SLEEPING_TENT) || (Guy.AnimationState == Tiles::GUY_SLEEPING) || + (Guy.AnimationState == Tiles::GUY_SLEEP_HOUSE) || (IsInBoat)) { break; - case 4: case 5: case 6: case 8: case 9: case 10: case 12: case 13: case 14: - Guy.Aktiv = true; - Guy.Zustand = GUYSCHLAGEN; - World::AddResource(WASSER, -2); - World::AddResource(NAHRUNG, -2); - World::AddTime(0, 15); + } + + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x = Guy.ScreenPosition.x; + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y = Guy.ScreenPosition.y; + Erg = Renderer::GetTile(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + + if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) { + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + } else if (RoutePunkt % 2 == 0) { + Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); // Nur bis zur Mitte der aktuellen Kacheln laufen + } else { + Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); + } + + break; + + case 2: + Renderer::Fade(95, 80, 80); + Hours = 12; + Minutes = 0; + + if ((Guy.AnimationState == Tiles::GUY_SLEEPING_TENT) || (Guy.AnimationState == Tiles::GUY_SLEEPING) || + (Guy.AnimationState == Tiles::GUY_SLEEP_HOUSE) || (IsInBoat)) { break; - case 7: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 22, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 16); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[BOOT].Anzahl + 2); + } + + // Wohnbare Objekte in der Umgebung suchen + Erg.x = -1; + Erg.y = -1; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) || (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3)) { + Erg.x = Guy.Pos.x; + Erg.y = Guy.Pos.y; + } else if (Landscape[Guy.Pos.x - 1][Guy.Pos.y].Object == Tiles::HOUSE_3) { + Erg.x = Guy.Pos.x - 1; + Erg.y = Guy.Pos.y; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Object == Tiles::HOUSE_3) { + Erg.x = Guy.Pos.x; + Erg.y = Guy.Pos.y - 1; + } else if (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Object == Tiles::HOUSE_3) { + Erg.x = Guy.Pos.x + 1; + Erg.y = Guy.Pos.y; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Object == Tiles::HOUSE_3) { + Erg.x = Guy.Pos.x; + Erg.y = Guy.Pos.y + 1; + } else if (Landscape[Guy.Pos.x - 1][Guy.Pos.y].Object == Tiles::TENT) { + Erg.x = Guy.Pos.x - 1; + Erg.y = Guy.Pos.y; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Object == Tiles::TENT) { + Erg.x = Guy.Pos.x; + Erg.y = Guy.Pos.y - 1; + } else if (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Object == Tiles::TENT) { + Erg.x = Guy.Pos.x + 1; + Erg.y = Guy.Pos.y; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Object == Tiles::TENT) { + Erg.x = Guy.Pos.x; + Erg.y = Guy.Pos.y + 1; + } + + if ((Erg.x != -1) && (Erg.y != -1)) { + Guy.Pos.x = Erg.x; + Guy.Pos.y = Erg.y; + + if ((Landscape[Erg.x][Erg.y].Object == Tiles::TENT) && + (Landscape[Erg.x][Erg.y].AnimationPhase < Bmp[Landscape[Erg.x][Erg.y].Object].AnimationPhaseCount)) + Routing::ShortRoute(Landscape[Erg.x][Erg.y].xScreen + Landscape[Erg.x][Erg.y].ObjectPosOffset.x + 3, + Landscape[Erg.x][Erg.y].yScreen + Landscape[Erg.x][Erg.y].ObjectPosOffset.y + 20); + else if ((Landscape[Erg.x][Erg.y].Object == Tiles::HOUSE_3) && + (Landscape[Erg.x][Erg.y].AnimationPhase < Bmp[Landscape[Erg.x][Erg.y].Object].AnimationPhaseCount)) + Routing::ShortRoute(Landscape[Erg.x][Erg.y].xScreen + Landscape[Erg.x][Erg.y].ObjectPosOffset.x + + Bmp[Tiles::TREE_BIG].Width / 2, + Landscape[Erg.x][Erg.y].yScreen + Landscape[Erg.x][Erg.y].ObjectPosOffset.y + + Bmp[Tiles::TREE_BIG].Height + 1); + } + + break; + + case 3: + Renderer::Fade(90, 70, 70); + Hours = 12; + Minutes = 0; + + if ((Guy.AnimationState == Tiles::GUY_SLEEPING_TENT) || (Guy.AnimationState == Tiles::GUY_SLEEPING) || + (Guy.AnimationState == Tiles::GUY_SLEEP_HOUSE) || (IsInBoat)) { break; - case 11: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 14, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 11); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[BOOT].Anzahl + 3); + } + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_1; + } + + break; + + case 4: + Renderer::Fade(70, 60, 60); + Hours = 12; + Minutes = 0; + + if ((Guy.AnimationState == Tiles::GUY_SLEEPING_TENT) || (Guy.AnimationState == Tiles::GUY_SLEEPING) || + (Guy.AnimationState == Tiles::GUY_SLEEP_HOUSE) || (IsInBoat)) { break; - case 15: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); + } + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_ENTER_TENT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_ENTER_HOUSE; + } else { + Guy.ScreenPosition.x += 3; + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_LAYING_TENT; + } + + break; + + case 5: + Renderer::Fade(55, 50, 55); + Hours = 12; + Minutes = 0; + + if (IsInBoat) { break; - case 16: - if (Scape[Guy.Pos.x - 1][Guy.Pos.y].Art == 1) - { - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = 0; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = 10; - } - else if (Scape[Guy.Pos.x][Guy.Pos.y - 1].Art == 1) - { - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 1; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = 25; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = 10; - } - else if (Scape[Guy.Pos.x + 1][Guy.Pos.y].Art == 1) - { - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = 30; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = 27; - } - else if (Scape[Guy.Pos.x][Guy.Pos.y + 1].Art == 1) - { - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 1; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = 0; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = 28; + } + + Guy.IsActive = true; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + if (Guy.AnimationState != Tiles::GUY_SLEEPING_TENT) { + Guy.ScreenPosition.x += 4; } - Bmp[BUTTSTOP].Phase = -1; - if (Bmp[BOOT].First) - { - PapierText = Renderer::DrawText(BOOTHILFE, TXTPAPIER, 1); - Bmp[BOOT].First = false; + + Guy.AnimationState = Tiles::GUY_SLEEPING_TENT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + if (Guy.AnimationState != Tiles::GUY_SLEEP_HOUSE) { + Guy.ScreenPosition.x += 14; } - Guy.Aktion = NOTHING; + + Guy.AnimationState = Tiles::GUY_SLEEP_HOUSE; + } else { + Guy.AnimationState = Tiles::GUY_SLEEPING; + } + + break; + + case 6: + Renderer::Fade(25, 25, 35); + Hours = 12; + Minutes = 0; + + if (IsInBoat) { break; } - } - void pipe() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = ROHR; - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[ROHR].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[ROHR].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[ROHR].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[ROHR].rcDes.top); + Guy.IsActive = true; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.AnimationState = Tiles::GUY_SLEEPING_TENT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.AnimationState = Tiles::GUY_SLEEP_HOUSE; + } else { + Guy.AnimationState = Tiles::GUY_SLEEPING; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + break; + + case 7: + Renderer::Fade(0, 0, 0);// Don't get confused as the picture in Show () will be painted over in black + Night = true; + Hours = 12; + Minutes = 0; + PlaySound(Sound::WOLF, 100); + + // Falsche Objekte Löschen + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::TREE_DOWN_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::TREE_DOWN_4)) { + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::INVALID; + Guy.Inventory[Tiles::RAW_TREE_TRUNK]++; + + if (Guy.Inventory[Tiles::RAW_TREE_TRUNK] > 10) { + Guy.Inventory[Tiles::RAW_TREE_TRUNK] = 10; + } } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 30, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 21); - break; - case 2: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 29, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 20); - break; - case 3: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 28, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 15); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[ROHR].Anzahl + 1); - break; - case 4: case 5: case 6: case 11: case 12: case 13: - Guy.Aktiv = true; - Guy.Zustand = GUYSCHLAGEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 5); - break; - case 7: case 8: case 9: case 14: case 15: case 16: - Guy.Aktiv = true; - Guy.Zustand = GUYFAELLEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 5); - break; - case 10: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 17, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 13); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[ROHR].Anzahl + 2); - break; - case 17: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 18: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - World::FillRohr(); - Bmp[BUTTSTOP].Phase = -1; - if (Bmp[ROHR].First) - { - PapierText = Renderer::DrawText(ROHRHILFE, TXTPAPIER, 1); - Bmp[ROHR].First = false; + + // Je nach Schlafort Zustand verändern + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + World::AddResource(Resources::Health, -5); + + if (Guy.ResourceAmount[Resources::Health] <= 0) { + Guy.IsActive = true; + PapierText = Renderer::DrawText(TAGENDE5, TXTPAPIER, 1); + Guy.ActionStep = 2; + Guy.CurrentAction = Action::DEATH; + Hours = 0; + Minutes = 0; + } else { + Guy.IsActive = true; + PapierText = Renderer::DrawText(TAGENDE2, TXTPAPIER, 1); + } + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + World::AddResource(Resources::Health, +20); + Guy.IsActive = true; + PapierText = Renderer::DrawText(TAGENDE4, TXTPAPIER, 1); + } else if (IsInBoat) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_BOAT_WAITING; + PapierText = Renderer::DrawText(TAGENDE3, TXTPAPIER, 1); + Guy.ActionStep = 2; + Guy.CurrentAction = Action::DEATH; + Hours = 0; + Minutes = 0; + } else { + World::AddResource(Resources::Health, -20); + + if (Guy.ResourceAmount[Resources::Health] <= 0) { + Guy.IsActive = true; + PapierText = Renderer::DrawText(TAGENDE5, TXTPAPIER, 1); + Guy.ActionStep = 2; + Guy.CurrentAction = Action::DEATH; + Hours = 0; + Minutes = 0; + } else { + Guy.IsActive = true; + PapierText = Renderer::DrawText(TAGENDE1, TXTPAPIER, 1); } - Guy.Aktion = NOTHING; - break; } - } - void sos() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = SOS; - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[SOS].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[SOS].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[SOS].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[SOS].rcDes.top); + break; + + case 8: + Renderer::Fade(20, 20, 30); + Night = false; + Tag++; + Hours = 0; + Minutes = 0; + // if (BootsFahrt) Game::NeuesSpiel(true); // Später hier tot!! + + Guy.IsActive = true; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.AnimationState = Tiles::GUY_SLEEPING_TENT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.AnimationState = Tiles::GUY_SLEEP_HOUSE; + } else { + Guy.AnimationState = Tiles::GUY_SLEEPING; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + break; + + case 9: + Renderer::Fade(40, 40, 40); + Hours = 0; + Minutes = 0; + + Hours = 0; + Minutes = 0; + Guy.IsActive = true; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.AnimationState = Tiles::GUY_SLEEPING_TENT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.AnimationState = Tiles::GUY_SLEEP_HOUSE; + } else { + Guy.AnimationState = Tiles::GUY_SLEEPING; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 4, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 13); - break; - case 4: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 12, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 17); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[SOS].Anzahl + 1); - break; - case 7: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 12, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 9); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[SOS].Anzahl + 2); - break; - case 10: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 19, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 12); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[SOS].Anzahl + 3); - break; - case 13: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 21, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 5); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[SOS].Anzahl + 4); - break; - case 16: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 28, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 8); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[SOS].Anzahl + 5); - break; - case 2: case 5: case 8: case 11: case 14: case 17: - Guy.Aktiv = true; - Guy.PosScreen.x += 4; - Guy.Zustand = GUYHINLEGEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 1); - break; - case 3: case 6: case 9: case 12: case 15: case 18: - Guy.Aktiv = true; - Guy.PosScreen.x -= 4; - Guy.Zustand = GUYAUFSTEHEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 1); - break; - case 19: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); + + break; + + case 10: + Renderer::Fade(70, 60, 60); + Hours = 0; + Minutes = 0; + StopSound(Sound::SNORE); + Guy.IsActive = true; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.ScreenPosition.x -= 14; + Guy.AnimationState = Tiles::GUY_EXIT_HOUSE; + } else { + Guy.AnimationState = Tiles::GUY_STAND_UP; + } + + break; + + case 11: + Renderer::Fade(90, 80, 80); + Hours = 0; + Minutes = 0; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_2; + } + + break; + + case 12: + Renderer::Fade(100, 100, 100); + Hours = 0; + Minutes = 0; + Guy.AnimationState = Tiles::GUY_LEFT; + Guy.CurrentAction = Action::NOTHING; + + if (Guy.ResourceAmount[Resources::Health] > 10) { + Game::SaveGame(); + } + + break; + } +} + +void rescued() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: { + Coordinate Erg = Renderer::GetTile(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + + if ((Erg.x == Guy.Pos.x) && (Erg.y == Guy.Pos.y)) { + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + } else if (RoutePunkt % 2 == 0) { + Routing::ShortRoute(RouteKoor[RoutePunkt].x, RouteKoor[RoutePunkt].y); //Nur bis zur Mitte der aktuellen Kacheln laufen + } else { + Routing::ShortRoute(RouteKoor[RoutePunkt + 1].x, RouteKoor[RoutePunkt + 1].y); + } + + TwoClicks = -1; // Keine Ahnung warum ich das hier machen muß + break; + } + + case 2: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_WAITING; + PapierText = Renderer::DrawText(GERETTET, TXTPAPIER, 1); + break; + + case 3: + if (Frage == 2) { + Guy.CurrentAction = Action::NOTHING; + Frage = -1; break; - case 20: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Art == 0) || (Scape[Guy.Pos.x][Guy.Pos.y].Art == 4)) - Chance += 1; - else Chance += 2; // Dürfte nur noch der Strand übrig sein - Bmp[BUTTSTOP].Phase = -1; - if (Bmp[SOS].First) - { - PapierText = Renderer::DrawText(SOSHILFE, TXTPAPIER, 1); - Bmp[SOS].First = false; + } + + s_GameState = State::RESCUED; + Frage = -1; + break; + + case 4: + // Route herstellen + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_LEFT; + RoutePunkt = -1; + Steps = 0; + Step = 0; + RouteStart.x = Guy.Pos.x; + RouteStart.y = Guy.Pos.y; + RouteDestination.y = Guy.Pos.y; + + for (short x = MAX_TILES_X - 1; x > 1; x--) { // Position des Rettungsschiffs festlegen + if (Landscape[x][Guy.Pos.y].Terrain != 1) { + break; } - Guy.Aktion = NOTHING; - break; + + RouteDestination.x = x + 1; + } + + // Schiff hinbauen + Landscape[RouteDestination.x][RouteDestination.y].AnimationPhase = 0; + Landscape[RouteDestination.x][RouteDestination.y].Object = Tiles::GUY_SHIP; + Landscape[RouteDestination.x][RouteDestination.y].ObjectPosOffset.x = 10; + Landscape[RouteDestination.x][RouteDestination.y].ObjectPosOffset.y = 10; + RouteDestination.x -= 2; + Routing::FindTheWay(); + Guy.AnimationState = Tiles::GUY_LEFT; + break; + + case 5: + Guy.AnimationState = Tiles::GUY_LEFT; + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2)); + break; + + case 6: + Guy.Pos.x += 2; + Guy.AnimationState = Tiles::GUY_SWIM; + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2)); + break; + + case 7: + Guy.ScreenPosition.y -= 10; + + if (!IsInBoat) { + World::ToggleIsInBoat(); } + + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_SHIP; + RoutePunkt = -1; + Steps = 0; + Step = 0; + RouteStart.x = Guy.Pos.x; + RouteStart.y = Guy.Pos.y; + RouteDestination.y = Guy.Pos.y; + RouteDestination.x = MAX_TILES_X - 2; + Routing::FindTheWay(); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::SEA_WAVES].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::SEA_WAVES].targetRect.top); + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::SEA_WAVES; + break; + + case 8: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_SHIP; + break; + + case 9: + Guy.CurrentAction = Action::NOTHING; + Guy.AnimationState = Tiles::GUY_LEFT; + s_GameState = State::OUTRO; + break; } +} + +void tent() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::TENT; + printf("drawing tent: %d\n", Landscape[Guy.Pos.x][Guy.Pos.y].Object); - void fireplace() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = FEUERSTELLE; - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[FEUERSTELLE].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[FEUERSTELLE].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = static_cast(Bmp[FEUERSTELLE].rcDes.left); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = static_cast(Bmp[FEUERSTELLE].rcDes.top); + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::TENT].RequiredRawMaterials[i]; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::TENT].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::TENT].targetRect.top); + } + + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 22, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 12); + break; + + case 2: + case 3: + case 12: + case 13: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_TIE_DOWN; + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 15); + break; + + case 4: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 2; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 31, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 20); + break; + + case 5: + Routing::ShortRoute(Guy.OriginalPosition.x, + Guy.OriginalPosition.y); + break; + + case 6: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 3, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 20); + + break; + + case 7: + case 8: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_TIE_UP; + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 15); + break; + + case 9: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 3; + Routing::ShortRoute(Guy.OriginalPosition.x, + Guy.OriginalPosition.y); + break; + + case 10: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 31, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 20); + break; + + case 11: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 22, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 12); + break; + + case 14: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 31, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 20); + break; + + case 15: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 16: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if (Bmp[Tiles::TENT].First) { + PapierText = Renderer::DrawText(ZELTHILFE, TXTPAPIER, 1); + Bmp[Tiles::TENT].First = false; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 4, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 16); - break; - case 2: - Guy.Aktiv = true; - Guy.PosScreen.x += 4; - Guy.Zustand = GUYHINLEGEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 1); - break; - case 3: - Guy.Aktiv = true; - Guy.PosScreen.x -= 4; - Guy.Zustand = GUYAUFSTEHEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 1); - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[FEUERSTELLE].Anzahl + 1); - break; - case 4: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 15); - break; - case 5: case 6: case 7: - Guy.Aktiv = true; - Guy.Zustand = GUYBINDENOBEN; - World::AddResource(WASSER, -1); - World::AddResource(NAHRUNG, -1); - World::AddTime(0, 1); - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer != 5) - Scape[Guy.Pos.x][Guy.Pos.y].Phase = - static_cast(Bmp[FEUERSTELLE].Anzahl + Scape[Guy.Pos.x][Guy.Pos.y].AkNummer - 4); - break; - case 8: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 9: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Bmp[BUTTSTOP].Phase = -1; - if (Bmp[FEUERSTELLE].First) - { - PapierText = Renderer::DrawText(FEUERSTELLEHILFE, TXTPAPIER, 1); - Bmp[FEUERSTELLE].First = false; - } - Guy.Aktion = NOTHING; - break; + + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void boat() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::BOAT; + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::BOAT].RequiredRawMaterials[i]; } + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::BOAT].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::BOAT].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::BOAT].targetRect.top); + } + + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; } - void house1() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[HAUS1].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[HAUS1].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = HAUS1; + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 30, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 21); + break; + + case 2: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 29, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 20); + break; + + case 3: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 28, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 19); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::BOAT].AnimationPhaseCount + 1); + break; + + case 4: + case 5: + case 6: + case 8: + case 9: + case 10: + case 12: + case 13: + case 14: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_BEAT; + World::AddResource(Resources::Water, -2); + World::AddResource(Resources::Food, -2); + World::AddTime(0, 15); + break; + + case 7: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 22, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 16); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::BOAT].AnimationPhaseCount + 2); + break; + + case 11: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 14, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 11); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::BOAT].AnimationPhaseCount + 3); + break; + + case 15: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 16: + if (Landscape[Guy.Pos.x - 1][Guy.Pos.y].Terrain == 1) { + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = 10; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Terrain == 1) { + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 1; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = 25; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = 10; + } else if (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Terrain == 1) { + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = 30; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = 27; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Terrain == 1) { + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 1; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = 28; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if (Bmp[Tiles::BOAT].First) { + PapierText = Renderer::DrawText(BOOTHILFE, TXTPAPIER, 1); + Bmp[Tiles::BOAT].First = false; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + - Bmp[BAUMGROSS].Breite / 2 - 3, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + - Bmp[BAUMGROSS].Hoehe + 1); - break; - case 2: case 3: case 4: case 5: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER; - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 6: case 7: case 8: case 9: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS1].Anzahl + 1); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 10: case 11: case 12: case 13: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS1].Anzahl + 2); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 14: case 15: case 16: case 17: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS1].Anzahl + 3); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 18: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 19: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Bmp[BUTTSTOP].Phase = -1; - Guy.Aktion = NOTHING; - break; + + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void pipe() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::PIPE; + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::PIPE].RequiredRawMaterials[i]; } + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::PIPE].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::PIPE].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::PIPE].targetRect.top); + } + + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; } - void house2() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[HAUS2].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[HAUS2].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = HAUS2; + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 30, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 21); + break; + + case 2: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 29, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 20); + break; + + case 3: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 28, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 15); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::PIPE].AnimationPhaseCount + 1); + break; + + case 4: + case 5: + case 6: + case 11: + case 12: + case 13: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_BEAT; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 5); + break; + + case 7: + case 8: + case 9: + case 14: + case 15: + case 16: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CHOP; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 5); + break; + + case 10: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 17, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 13); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::PIPE].AnimationPhaseCount + 2); + break; + + case 17: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 18: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + World::FillPipe(); + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if (Bmp[Tiles::PIPE].First) { + PapierText = Renderer::DrawText(ROHRHILFE, TXTPAPIER, 1); + Bmp[Tiles::PIPE].First = false; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void sos() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::SOS; + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::SOS].RequiredRawMaterials[i]; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + - Bmp[BAUMGROSS].Breite / 2, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + - Bmp[BAUMGROSS].Hoehe + 1); - break; - case 2: - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN1; - World::AddResource(NAHRUNG, -1); - World::AddResource(WASSER, -1); - World::AddTime(0, 1); - break; - case 3: case 4: case 5: case 6: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 7: case 8: case 9: case 10: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS2].Anzahl + 1); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 11: case 12: case 13: case 14: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS2].Anzahl + 2); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 15: case 16: case 17: case 18: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS2].Anzahl + 3); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 19: - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS2].Anzahl + 4); - World::AddResource(NAHRUNG, -1); - World::AddResource(WASSER, -1); - World::AddTime(0, 1); - break; - case 20: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 21: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Bmp[BUTTSTOP].Phase = -1; - Guy.Aktion = NOTHING; - break; + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::SOS].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::SOS].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::SOS].targetRect.top); + } + + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 4, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 13); + break; + + case 4: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 12, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 17); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::SOS].AnimationPhaseCount + 1); + break; + + case 7: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 12, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 9); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::SOS].AnimationPhaseCount + 2); + break; + + case 10: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 19, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 12); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::SOS].AnimationPhaseCount + 3); + break; + + case 13: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 21, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 5); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::SOS].AnimationPhaseCount + 4); + break; + + case 16: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 28, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 8); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::SOS].AnimationPhaseCount + 5); + break; + + case 2: + case 5: + case 8: + case 11: + case 14: + case 17: + Guy.IsActive = true; + Guy.ScreenPosition.x += 4; + Guy.AnimationState = Tiles::GUY_LAYING_TENT; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 1); + break; + + case 3: + case 6: + case 9: + case 12: + case 15: + case 18: + Guy.IsActive = true; + Guy.ScreenPosition.x -= 4; + Guy.AnimationState = Tiles::GUY_STAND_UP; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 1); + break; + + case 19: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 20: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Terrain == 0) || (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain == 4)) { + Chance += 1; + } else { + Chance += 2; // Dürfte nur noch der Strand übrig sein } + + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if (Bmp[Tiles::SOS].First) { + PapierText = Renderer::DrawText(SOSHILFE, TXTPAPIER, 1); + Bmp[Tiles::SOS].First = false; + } + + Guy.CurrentAction = Action::NOTHING; + break; } +} - void house3() - { - if (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - for (short i = 0; i < BILDANZ; i++) - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] = Bmp[HAUS3].Rohstoff[i]; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = Bmp[HAUS3].Anzahl; - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = HAUS3; +void fireplace() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::BONFIRE; + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::BONFIRE].RequiredRawMaterials[i]; } - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer++; - if (!World::CheckRohstoff()) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer--; - return; + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::BONFIRE].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::BONFIRE].targetRect.left); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::BONFIRE].targetRect.top); + } + + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 4, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 16); + break; + + case 2: + Guy.IsActive = true; + Guy.ScreenPosition.x += 4; + Guy.AnimationState = Tiles::GUY_LAYING_TENT; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 1); + break; + + case 3: + Guy.IsActive = true; + Guy.ScreenPosition.x -= 4; + Guy.AnimationState = Tiles::GUY_STAND_UP; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 1); + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::BONFIRE].AnimationPhaseCount + 1); + break; + + case 4: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 15); + break; + + case 5: + case 6: + case 7: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_TIE_UP; + World::AddResource(Resources::Water, -1); + World::AddResource(Resources::Food, -1); + World::AddTime(0, 1); + + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep != 5) + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = + static_cast(Bmp[Tiles::BONFIRE].AnimationPhaseCount + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep - 4); + + break; + + case 8: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 9: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if (Bmp[Tiles::BONFIRE].First) { + PapierText = Renderer::DrawText(FEUERSTELLEHILFE, TXTPAPIER, 1); + Bmp[Tiles::BONFIRE].First = false; } - switch (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + - Bmp[BAUMGROSS].Breite / 2, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + - Bmp[BAUMGROSS].Hoehe + 1); - break; - case 2: - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN1; - World::AddResource(NAHRUNG, -1); - World::AddResource(WASSER, -1); - World::AddTime(0, 1); - break; - case 3: case 4: case 5: case 6: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 7: case 8: case 9: case 10: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS3].Anzahl + 1); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 11: case 12: case 13: case 14: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS3].Anzahl + 2); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 15: case 16: case 17: case 18: - Guy.Aktiv = true; - Guy.Zustand = GUYHAMMER2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS3].Anzahl + 3); - World::AddResource(NAHRUNG, -0.5); - World::AddResource(WASSER, -0.5); - World::AddTime(0, 1); - break; - case 19: - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN2; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = static_cast(Bmp[HAUS3].Anzahl + 4); - World::AddResource(NAHRUNG, -1); - World::AddResource(WASSER, -1); - World::AddTime(0, 1); - break; - case 20: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - break; - case 21: - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - Bmp[BUTTSTOP].Phase = -1; - if (Bmp[HAUS3].First) - { - PapierText = Renderer::DrawText(HAUS3HILFE, TXTPAPIER, 1); - Bmp[HAUS3].First = false; - } - Guy.Aktion = NOTHING; - break; + + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void house1() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::HOUSE_1].RequiredRawMaterials[i]; } + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::HOUSE_1].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::HOUSE_1; } - void sleep() - { - if (Guy.AkNummer == 0) - { - Guy.PosAlt = Guy.PosScreen; // Die Originalposition merken - } - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 3, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 20); - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + - Bmp[BAUMGROSS].Breite / 2 + 1, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + - Bmp[BAUMGROSS].Hoehe + 1); - break; - case 2: - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN1; - World::AddResource(NAHRUNG, -1); - World::AddResource(WASSER, -1); - } - break; - case 3: - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYGEHINZELT; - } - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYGEHINHAUS; - } - else - { - Guy.PosScreen.x += 3; - Guy.Aktiv = true; - Guy.Zustand = GUYHINLEGEN; - } - break; - case 4: case 5: - Guy.Aktiv = true; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - if (Guy.AkNummer == 4) Guy.PosScreen.x += 4; - Guy.Zustand = GUYSCHLAFZELT; - } - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - if (Guy.AkNummer == 4) Guy.PosScreen.x += 14; - Guy.Zustand = GUYSCHLAFHAUS; - } - else Guy.Zustand = GUYSCHLAFEN; - World::AddResource(GESUNDHEIT, 5); - World::AddTime(0, 30); - break; - case 6: - Guy.Aktiv = true; - StopSound(Sound::SNORE); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.PosScreen.x -= 14; - Guy.Zustand = GUYGEHAUSHAUS; - } - else Guy.Zustand = GUYAUFSTEHEN; - break; - case 7: - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - { - Guy.Aktiv = true; - Guy.Zustand = GUYKLETTERN2; - World::AddResource(NAHRUNG, -1); - World::AddResource(WASSER, -1); - } - break; - case 8: - Routing::ShortRoute(Guy.PosAlt.x, Guy.PosAlt.y); - Guy.Aktion = NOTHING; - break; + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Tiles::TREE_BIG].Width / 2 - 3, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Tiles::TREE_BIG].Height + 1); + break; + + case 2: + case 3: + case 4: + case 5: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_1; + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 6: + case 7: + case 8: + case 9: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_1; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_1].AnimationPhaseCount + 1); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 10: + case 11: + case 12: + case 13: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_1; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_1].AnimationPhaseCount + 2); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 14: + case 15: + case 16: + case 17: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_1; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_1].AnimationPhaseCount + 3); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 18: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 19: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void house2() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::HOUSE_2].RequiredRawMaterials[i]; } + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::HOUSE_2].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::HOUSE_2; } - void undock() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].xScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + 14, - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + 11); - break; - case 2: - World::ChangeBootsFahrt(); - Guy.PosScreen.x = Scape[Guy.Pos.x][Guy.Pos.y].xScreen + - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x + - Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite / 2; - Guy.PosScreen.y = Scape[Guy.Pos.x][Guy.Pos.y].yScreen + - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y + - Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe / 2; - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = -1; - if (Scape[Guy.Pos.x - 1][Guy.Pos.y].Art == 1) Guy.Pos.x--; - else if (Scape[Guy.Pos.x][Guy.Pos.y - 1].Art == 1) Guy.Pos.y--; - else if (Scape[Guy.Pos.x + 1][Guy.Pos.y].Art == 1) Guy.Pos.x++; - else if (Scape[Guy.Pos.x][Guy.Pos.y + 1].Art == 1) Guy.Pos.y++; - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2)); + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; - break; - case 3: - Guy.Aktion = NOTHING; - Guy.PosAlt.x = Guy.PosScreen.x; - Guy.PosAlt.y = Guy.PosScreen.y; - break; + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Tiles::TREE_BIG].Width / 2, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Tiles::TREE_BIG].Height + 1); + break; + + case 2: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_1; + World::AddResource(Resources::Food, -1); + World::AddResource(Resources::Water, -1); + World::AddTime(0, 1); + break; + + case 3: + case 4: + case 5: + case 6: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 7: + case 8: + case 9: + case 10: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_2].AnimationPhaseCount + 1); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 11: + case 12: + case 13: + case 14: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_2].AnimationPhaseCount + 2); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 15: + case 16: + case 17: + case 18: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_2].AnimationPhaseCount + 3); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 19: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_2].AnimationPhaseCount + 4); + World::AddResource(Resources::Food, -1); + World::AddResource(Resources::Water, -1); + World::AddTime(0, 1); + break; + + case 20: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 21: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void house3() +{ + if (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] = Bmp[Tiles::HOUSE_3].RequiredRawMaterials[i]; } + + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = Bmp[Tiles::HOUSE_3].AnimationPhaseCount; + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::HOUSE_3; } - void dock() - { - Guy.AkNummer++; - switch (Guy.AkNummer) - { - case 1: - if (Scape[Guy.Pos.x - 1][Guy.Pos.y].Art != 1) - { - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y) / 2)); - } - else if (Scape[Guy.Pos.x][Guy.Pos.y - 1].Art != 1) - { - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].y) / 2)); - } - else if (Scape[Guy.Pos.x + 1][Guy.Pos.y].Art != 1) - { - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2)); - } - else if (Scape[Guy.Pos.x][Guy.Pos.y + 1].Art != 1) - { - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].y) / 2)); - } - break; - case 2: - if (Scape[Guy.Pos.x - 1][Guy.Pos.y].Art != 1) - { - Guy.Pos.x--; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; - } - else if (Scape[Guy.Pos.x][Guy.Pos.y - 1].Art != 1) - { - Guy.Pos.y--; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 1; - } - else if (Scape[Guy.Pos.x + 1][Guy.Pos.y].Art != 1) - { - Guy.Pos.x++; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 0; + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep++; + + if (!World::CheckRawMaterials()) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep--; + return; + } + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Tiles::TREE_BIG].Width / 2, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Tiles::TREE_BIG].Height + 1); + break; + + case 2: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_1; + World::AddResource(Resources::Food, -1); + World::AddResource(Resources::Water, -1); + World::AddTime(0, 1); + break; + + case 3: + case 4: + case 5: + case 6: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 7: + case 8: + case 9: + case 10: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_3].AnimationPhaseCount + 1); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 11: + case 12: + case 13: + case 14: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_3].AnimationPhaseCount + 2); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 15: + case 16: + case 17: + case 18: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_HAMMER_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_3].AnimationPhaseCount + 3); + World::AddResource(Resources::Food, -0.5); + World::AddResource(Resources::Water, -0.5); + World::AddTime(0, 1); + break; + + case 19: + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_2; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = static_cast(Bmp[Tiles::HOUSE_3].AnimationPhaseCount + 4); + World::AddResource(Resources::Food, -1); + World::AddResource(Resources::Water, -1); + World::AddTime(0, 1); + break; + + case 20: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + break; + + case 21: + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + if (Bmp[Tiles::HOUSE_3].First) { + PapierText = Renderer::DrawText(HAUS3HILFE, TXTPAPIER, 1); + Bmp[Tiles::HOUSE_3].First = false; + } + + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void sleep() +{ + if (Guy.ActionStep == 0) { + Guy.OriginalPosition = Guy.ScreenPosition; // Die Originalposition merken + } + + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 3, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 20); + else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Tiles::TREE_BIG].Width / 2 + 1, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Tiles::TREE_BIG].Height + 1); + + break; + + case 2: + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_1; + World::AddResource(Resources::Food, -1); + World::AddResource(Resources::Water, -1); + } + + break; + + case 3: + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_ENTER_TENT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_ENTER_HOUSE; + } else { + Guy.ScreenPosition.x += 3; + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_LAYING_TENT; + } + + break; + + case 4: + case 5: + Guy.IsActive = true; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + if (Guy.ActionStep == 4) { + Guy.ScreenPosition.x += 4; } - else if (Scape[Guy.Pos.x][Guy.Pos.y + 1].Art != 1) - { - Guy.Pos.y++; - Scape[Guy.Pos.x][Guy.Pos.y].Phase = 1; + + Guy.AnimationState = Tiles::GUY_SLEEPING_TENT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + if (Guy.ActionStep == 4) { + Guy.ScreenPosition.x += 14; } - Scape[Guy.Pos.x][Guy.Pos.y].Objekt = BOOT; - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = Bmp[BOOT].AkAnzahl; + Guy.AnimationState = Tiles::GUY_SLEEP_HOUSE; + } else { + Guy.AnimationState = Tiles::GUY_SLEEPING; + } + + World::AddResource(Resources::Health, 5); + World::AddTime(0, 30); + break; - World::ChangeBootsFahrt(); - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.x = Guy.PosScreen.x - - Scape[Guy.Pos.x][Guy.Pos.y].xScreen - - Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Breite / 2; - Scape[Guy.Pos.x][Guy.Pos.y].ObPos.y = Guy.PosScreen.y - - Scape[Guy.Pos.x][Guy.Pos.y].yScreen - - Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Hoehe / 2; + case 6: + Guy.IsActive = true; + StopSound(Sound::SNORE); - Routing::ShortRoute(((Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2), - ((Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2)); + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.ScreenPosition.x -= 14; + Guy.AnimationState = Tiles::GUY_EXIT_HOUSE; + } else { + Guy.AnimationState = Tiles::GUY_STAND_UP; + } - break; - case 3: - Guy.Aktion = NOTHING; - Guy.PosAlt.x = Guy.PosScreen.x; - Guy.PosAlt.y = Guy.PosScreen.y; - break; + break; + + case 7: + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.IsActive = true; + Guy.AnimationState = Tiles::GUY_CLIMBING_2; + World::AddResource(Resources::Food, -1); + World::AddResource(Resources::Water, -1); + } + + break; + + case 8: + Routing::ShortRoute(Guy.OriginalPosition.x, Guy.OriginalPosition.y); + Guy.CurrentAction = Action::NOTHING; + break; + } +} + +void undock() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + 14, + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + 11); + break; + + case 2: + World::ToggleIsInBoat(); + Guy.ScreenPosition.x = Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width / 2; + Guy.ScreenPosition.y = Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y + + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height / 2; + Landscape[Guy.Pos.x][Guy.Pos.y].Object = -1; + + if (Landscape[Guy.Pos.x - 1][Guy.Pos.y].Terrain == 1) { + Guy.Pos.x--; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Terrain == 1) { + Guy.Pos.y--; + } else if (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Terrain == 1) { + Guy.Pos.x++; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Terrain == 1) { + Guy.Pos.y++; + } + + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2)); + + break; + + case 3: + Guy.CurrentAction = Action::NOTHING; + Guy.OriginalPosition.x = Guy.ScreenPosition.x; + Guy.OriginalPosition.y = Guy.ScreenPosition.y; + break; + } +} + +void dock() +{ + Guy.ActionStep++; + + switch (Guy.ActionStep) { + case 1: + if (Landscape[Guy.Pos.x - 1][Guy.Pos.y].Terrain != 1) { + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y) / 2)); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Terrain != 1) { + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].y) / 2)); + } else if (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Terrain != 1) { + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2)); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Terrain != 1) { + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].y) / 2)); } + + break; + + case 2: + if (Landscape[Guy.Pos.x - 1][Guy.Pos.y].Terrain != 1) { + Guy.Pos.x--; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Terrain != 1) { + Guy.Pos.y--; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 1; + } else if (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Terrain != 1) { + Guy.Pos.x++; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 0; + } else if (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Terrain != 1) { + Guy.Pos.y++; + Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase = 1; + } + + Landscape[Guy.Pos.x][Guy.Pos.y].Object = Tiles::BOAT; + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = Bmp[Tiles::BOAT].RequiredActionCases; + + World::ToggleIsInBoat(); + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.x = Guy.ScreenPosition.x - + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen - + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Width / 2; + Landscape[Guy.Pos.x][Guy.Pos.y].ObjectPosOffset.y = Guy.ScreenPosition.y - + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen - + Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Height / 2; + + Routing::ShortRoute(((Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2), + ((Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2)); + + break; + + case 3: + Guy.CurrentAction = Action::NOTHING; + Guy.OriginalPosition.x = Guy.ScreenPosition.x; + Guy.OriginalPosition.y = Guy.ScreenPosition.y; + break; } +} } // namesapce Action diff --git a/src/Action.hpp b/src/Action.hpp index fac0e64..d40889f 100644 --- a/src/Action.hpp +++ b/src/Action.hpp @@ -5,73 +5,74 @@ namespace Action { - // Actions - enum Actions : short - { - NOTHING = 0, - SEARCH = 1, - EAT = 2, - DRINK = 3, - LOG = 4, - FIELD = 5, - DAY_END = 6, - RESCUED = 7, - TENT = 8, - SLEEP = 9, - CANCEL = 10, - FISH = 11, - BOAT = 12, - UNDOCK = 13, - DOCK = 14, - PIPE = 15, - DESTROY = 16, - SOS_SIGN = 17, - HOUSE1 = 18, - HOUSE2 = 19, - HOUSE3 = 20, - FIREPLACE = 21, - LIGHT = 22, - LOOKOUT = 23, - TREASURE = 24, - INTRO = 25, - SLINGSHOT = 26, - QUIT = 27, - RESTART = 28, - DEATH = 29, - DAY_RESTART = 30, - }; +enum Type : short { + NOTHING = 0, + SEARCH = 1, + EAT = 2, + DRINK = 3, + LOG = 4, + FIELD = 5, + DAY_END = 6, + RESCUED = 7, + TENT = 8, + SLEEP = 9, + CANCEL = 10, + FISH = 11, + BOAT = 12, + UNDOCK = 13, + DOCK = 14, + PIPE = 15, + DESTROY = 16, + SOS_SIGN = 17, + HOUSE1 = 18, + HOUSE2 = 19, + HOUSE3 = 20, + FIREPLACE = 21, + LIGHT = 22, + LOOKOUT = 23, + TREASURE = 24, + INTRO = 25, + SLINGSHOT = 26, + QUIT = 27, + RESTART = 28, + DEATH = 29, + DAY_RESTART = 30, +}; +} + +namespace Actions { - void handler(short event); +void handler(Action::Type event); - // Aktionen - void search(); // Kacheln durchsuchen - void eat(); // Früchte essen - void drink(); // Wasser trinken - void log(); // Bäume fällen - void field(); // Feld anlegen - void day_end(); // Wenn der Tag zu Ende ist - void rescued(); // Wenn man gerettet wird - void tent(); // Zelt bauen - void sleep(); // Schlafen - void cancel(); // Aktion abbrechen - void fish(); // Aktion abbrechen - void boat(); // Boot bauen - void undock(); // Vom Strand aus ins Meer ablegen - void dock(); // Vom Meer an den Strand anlegen - void pipe(); // Bewässerungsrohr bauen - void destroy(); // Objekt abreissen - void sos(); // SOS schreiben - void house1(); // Leiter bauen - void house2(); // Plattform bauen - void house3(); // Baumhaus bauen - void fireplace(); // Feuerstelle aufstapeln - void light(); // Feuerstelle anzuenden - void lookout(); // Ausschau halten - void treasure(); // Nach Schatz graben - void intro(); // Intro aktionen - void slingshot(); // Jagdaktion - void quit(); // Fragt, ob man es wirklich verlassen will - void restart(); // Fragt, ob man das Spiel neu beginnen will - void day_restart(); // Fragt, ob man den Tag neu beginnen will - void death(); // Sterben +// Aktionen +void search(); // Kacheln durchsuchen +void eat(); // Früchte essen +void drink(); // Wasser trinken +void log(); // Bäume fällen +void field(); // Feld anlegen +void day_end(); // Wenn der Tag zu Ende ist +void rescued(); // Wenn man gerettet wird +void tent(); // Zelt bauen +void sleep(); // Schlafen +void cancel(); // Aktion abbrechen +void fish(); // Aktion abbrechen +void boat(); // Boot bauen +void undock(); // Vom Strand aus ins Meer ablegen +void dock(); // Vom Meer an den Strand anlegen +void pipe(); // Bewässerungsrohr bauen +void destroy(); // Objekt abreissen +void sos(); // SOS schreiben +void house1(); // Leiter bauen +void house2(); // Plattform bauen +void house3(); // Baumhaus bauen +void fireplace(); // Feuerstelle aufstapeln +void light(); // Feuerstelle anzuenden +void lookout(); // Ausschau halten +void treasure(); // Nach Schatz graben +void intro(); // Intro aktionen +void slingshot(); // Jagdaktion +void quit(); // Fragt, ob man es wirklich verlassen will +void restart(); // Fragt, ob man das Spiel neu beginnen will +void day_restart(); // Fragt, ob man den Tag neu beginnen will +void death(); // Sterben } diff --git a/src/Application.cpp b/src/Application.cpp index 6356cb4..e2eeb5d 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -15,22 +15,44 @@ #include #include #include +#include -Application::Application(const std::string& name, HINSTANCE instance_handle) - : m_window({MAXX, MAXY}, name, sf::Style::Fullscreen) - , m_name(name) - , m_time(std::time(nullptr)) +Application *Application::s_instance; + +Application::Application(const std::string &name) + : m_window({MAX_SCREEN_X, MAX_SCREEN_Y}, name, sf::Style::None) +, m_name(name) +, m_time(std::time(nullptr)) { - // Set globals - g_hInst = instance_handle; + // Ensure borderless windowed mode + const sf::Vector2u size(sf::VideoMode::getDesktopMode().width, sf::VideoMode::getDesktopMode().height) ; + m_window.setSize(size); + m_window.setPosition({0, 0}); + + s_instance = this; + + m_screenContent.create(MAX_SCREEN_X, MAX_SCREEN_Y); + m_screenContent.clear(sf::Color::Transparent); + m_textOverlay.create(MAX_SCREEN_X, MAX_SCREEN_Y); + m_textOverlay.clear(sf::Color::Transparent); + m_landscape.create(2 * MAX_SURFACE_X, 2 * MAX_SURFACE_Y); + m_landscape.clear(sf::Color::Transparent); + + m_window.setMouseCursorVisible(false); + + puts(name.data()); Sound::Init(); - Soundzustand = 1; // Activate sound + s_SoundState = 1; // Activate sound - Direct::InitDDraw(m_window.getSystemHandle()); + if (!Direct::InitDDraw()) { + puts("Failed to init graphics"); + exit(1); + } - Spielzustand = State::LOGO; + s_GameState = State::LOGO; Game::InitWaves(); // Nur zum Wavinitialisieren + Game::InitStructs(); srand(static_cast(std::time(nullptr))); // Random initialisieren } @@ -38,20 +60,34 @@ Application::Application(const std::string& name, HINSTANCE instance_handle) void Application::process_events() { sf::Event event; - while (m_window.pollEvent(event)) - { - if (event.type == sf::Event::Closed) - { + + while (m_window.pollEvent(event)) { + switch(event.type){ + case sf::Event::Closed: Direct::finiObjects(); m_window.close(); - } - else if (event.type == sf::Event::KeyReleased) - { - if (event.key.code == sf::Keyboard::F4) - { + break; + case sf::Event::MouseButtonPressed: + case sf::Event::MouseButtonReleased: + if (s_GameState == State::GAME) { + sf::Vector2f mappedPos = m_window.mapPixelToCoords(sf::Vector2i(event.mouseButton.x, event.mouseButton.y)); + Direct::CheckMouse(Coordinate({short(mappedPos.x), short(mappedPos.y)})); + } + break; + case sf::Event::MouseMoved: + if (s_GameState == State::GAME) { + sf::Vector2f mappedPos = m_window.mapPixelToCoords(sf::Vector2i(event.mouseMove.x, event.mouseMove.y)); + Direct::CheckMouse(Coordinate({short(mappedPos.x), short(mappedPos.y)})); + } + break; + case sf::Event::KeyReleased: + if (event.key.code == sf::Keyboard::F4) { Direct::finiObjects(); m_window.close(); } + break; + default: + break; } } } @@ -60,100 +96,151 @@ void Application::run() { sf::Clock timer; - while (m_window.isOpen()) - { + sf::Texture texture; + sf::Sprite sprite; + sprite.setTexture(m_screenContent.getTexture()); + + sf::Sprite landscape; + landscape.setTexture(m_landscape.getTexture()); + sf::Sprite text; + text.setTexture(m_textOverlay.getTexture()); + + while (m_window.isOpen()) { + m_window.clear(sf::Color::Black); process_events(); + CurrentFrame++; + FPS = 60; + + // BilderproSec ausgeben + // /* + // Renderer::HideText(TXTFPS); + // TextBereich[TXTFPS].HasText = true; + // std::sprintf(StdString, "%d", LastBild); + // Renderer::DrawString(StdString,(short)TextBereich[TXTFPS].textRect.left,(short)TextBereich[TXTFPS].textRect.top,1); + // */ + + if (s_GameState == State::LOGO) { + if (Direct::CheckKey() == 2) { // Das Keyboard abfragen + continue; + } + Renderer::ShowLogo(); // Bild auffrischen + } else if ((s_GameState == State::INTRO) || (s_GameState == State::RESCUED)) { + if (Direct::CheckKey() == 0) { // Das Keyboard abfragen + m_window.close(); + break; + } - if (timer.getElapsedTime() > sf::milliseconds(1000)) - { - while (true) - { - Bild++; - std::time_t Zeitsave = std::time(nullptr); - if (m_time + 5 < Zeitsave) - { - m_time = Zeitsave; - LastBild = (LastBild + Bild / 5) / 2; - Bild = 0; - if (LastBild == 0) - LastBild = 50; - - // BilderproSec ausgeben - /* - Renderer::Textloeschen(TXTFPS); - TextBereich[TXTFPS].Aktiv = true; - std::sprintf(StdString, "%d", LastBild); - Renderer::DrawString(StdString,(short)TextBereich[TXTFPS].rcText.left,(short)TextBereich[TXTFPS].rcText.top,1); - */ - } + Math::Animationen(); // Animationen weiterschalten - if (Spielzustand == State::LOGO) - { - if (Direct::CheckKey() == 2) // Das Keyboard abfragen - break; + if (!Guy.IsActive) { // Aktionen starten + Actions::handler(Guy.CurrentAction); + } - Renderer::ZeigeLogo(); // Bild auffrischen - } - else if ((Spielzustand == State::INTRO) || (Spielzustand == State::RESCUED)) - { - if (Direct::CheckKey() == 0) // Das Keyboard abfragen - { - m_window.close(); - break; - } - - Math::Animationen(); // Animationen weiterschalten - if (!Guy.Aktiv) // Aktionen starten - Action::handler(Guy.Aktion); - - Renderer::ZeigeIntro(); // Bild auffrischen - } - else if (Spielzustand == State::GAME) - { - // Hide system cursor - SetCursor(nullptr); - - if ((Stunden >= 12) && (Minuten != 0) && (Guy.Aktion != Action::DAY_END)) // Hier ist der Tag zuende - { - if (Guy.Aktion == Action::LOOKOUT) - Chance -= 1 + Scape[Guy.Pos.x][Guy.Pos.y].Hoehe; - - Guy.Aktiv = false; - Guy.AkNummer = 0; - Guy.Aktion = Action::DAY_END; - } - - World::CheckSpzButton(); // Die Spezialkn�pfe umschalten - Direct::CheckMouse(); // Den MouseZustand abchecken - if (Direct::CheckKey() == 0) // Das Keyboard abfragen - { - m_window.close(); - break; - } - Renderer::LimitScroll(); // Das Scrollen an die Grenzen der Landschaft anpassen - Math::Animationen(); // Die Animationsphasen weiterschalten - if (!Guy.Aktiv) // Die Aktionen starten - Action::handler(Guy.Aktion); - Renderer::Zeige(); // Das Bild zeichnen - } - else if (Spielzustand == State::OUTRO) - { - if (Direct::CheckKey() == 0) - { - m_window.close(); - break; - } - - Math::AbspannCalc(); - Renderer::ZeigeAbspann(); + Renderer::ShowIntro(); // Bild auffrischen + } else if (s_GameState == State::GAME) { + if ((Hours >= 12) && (Minutes != 0) && (Guy.CurrentAction != Action::DAY_END)) { // Hier ist der Tag zuende + if (Guy.CurrentAction == Action::LOOKOUT) { + Chance -= 1 + Landscape[Guy.Pos.x][Guy.Pos.y].Height; } + + Guy.IsActive = false; + Guy.ActionStep = 0; + Guy.CurrentAction = Action::DAY_END; + } + + World::UpdateButtons(); // Die Spezialkn�pfe umschalten + + if (Direct::CheckKey() == 0) { // Das Keyboard abfragen + m_window.close(); + break; + } + + Renderer::LimitScroll(); // Das Scrollen an die Grenzen der Landschaft anpassen + Math::Animationen(); // Die Animationsphasen weiterschalten + + if (!Guy.IsActive) { // Die Aktionen starten + Actions::handler(Guy.CurrentAction); + } + + Renderer::Show(); // Das Bild zeichnen + } else if (s_GameState == State::OUTRO) { + if (Direct::CheckKey() == 0) { + m_window.close(); + break; } - timer.restart(); + Math::AbspannCalc(); + Renderer::ShowCredits(); } + sprite.setColor(s_darknessColor); + landscape.setColor(s_darknessColor); + + m_landscape.display(); + landscape.setPosition(m_landscapeOffset); + m_window.draw(landscape); + + m_screenContent.display(); + m_window.draw(sprite); + m_screenContent.clear(sf::Color::Transparent); + + m_textOverlay.display(); + m_window.draw(text); + + m_window.display(); + sf::sleep(sf::milliseconds(16)); // idk, try 60 fps or something } } void Application::update() { } + +void Application::drawToScreen(const sf::Drawable &sprite) +{ + s_instance->m_screenContent.draw(sprite); +} + +void Application::drawSprite(const sf::Sprite &sprite) +{ + s_instance->m_screenContent.draw(sprite); +} + +void Application::clearText(const int x, const int y, const int width, const int height) +{ + sf::RectangleShape shape(sf::Vector2f(width, height)); + shape.setPosition(x, y); + shape.setFillColor(sf::Color::Transparent); + s_instance->m_textOverlay.draw(shape, sf::RenderStates(sf::BlendMode(sf::BlendMode::SrcAlpha, sf::BlendMode::Zero))); +} + +void Application::drawToText(const sf::Sprite &sprite) +{ + s_instance->m_textOverlay.draw(sprite); +} + +void Application::clearLandscape() +{ + s_instance->m_landscape.clear(); +} + +void Application::drawToLandscape(const sf::Sprite &sprite) +{ + s_instance->m_landscape.draw(sprite); +} + +void Application::setLandscapeOffset(const int x, const int y) +{ + s_instance->m_landscapeOffset.x = -x; + s_instance->m_landscapeOffset.y = -y; +} + +void Application::clearScreenContent(const sf::Color &color) +{ + s_instance->m_screenContent.clear(color); +} + +sf::Image Application::landscapeImage() +{ + s_instance->m_landscape.display(); + return s_instance->m_landscape.getTexture().copyToImage(); +} diff --git a/src/Application.hpp b/src/Application.hpp index bee4737..0e8ec4a 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -4,23 +4,45 @@ #include "extern.hpp" #include +#include #include class Application { public: - Application(const std::string& name, HINSTANCE instance_handle); + Application(const std::string &name); void run(); void update(); + static void drawToScreen(const sf::Drawable &sprite); + static void clearScreenContent(const sf::Color &color = sf::Color::Transparent); + static void drawSprite(const sf::Sprite &sprite); + + + static void clearText(const int x, const int y, const int width, const int height); + static void drawToText(const sf::Sprite &sprite); + + static void clearLandscape(); + static void drawToLandscape(const sf::Sprite &sprite); + static void setLandscapeOffset(const int x, const int y); + + static sf::Image landscapeImage(); + private: void process_events(); private: - sf::Window m_window; + sf::RenderWindow m_window; + sf::RenderTexture m_screenContent; + sf::RenderTexture m_textOverlay; + sf::RenderTexture m_landscape; std::string m_name; std::time_t m_time; // Beginning of the second + sf::Vector2f m_landscapeOffset; + + // TODO: get rid of + static Application *s_instance; }; diff --git a/src/Direct.cpp b/src/Direct.cpp index 86728c3..d26867f 100644 --- a/src/Direct.cpp +++ b/src/Direct.cpp @@ -10,498 +10,570 @@ #include "State.hpp" #include "World.hpp" +#include "bin/images/Animation.BMP.hpp" +#include "bin/images/Bau.bmp.hpp" +#include "bin/images/Baum.bmp.hpp" +#include "bin/images/Buttons.bmp.hpp" +#include "bin/images/Credits.bmp.hpp" +#include "bin/images/Cursor.BMP.hpp" +#include "bin/images/GuyAni.bmp.hpp" +#include "bin/images/Inventar.bmp.hpp" +#include "bin/images/Logo.png.hpp" +#include "bin/images/Misc.BMP.hpp" +#include "bin/images/Panel.png.hpp" +#include "bin/images/Papier.bmp.hpp" +#include "bin/images/Schrift1.BMP.hpp" +#include "bin/images/Schrift2.bmp.hpp" +#include "bin/images/Textfeld.bmp.hpp" + #include -namespace Direct -{ - LPDIRECTDRAW4 lpDD = nullptr; // DirectDraw object - bool Button0down; // linke Maustaste gedrückt gehalten - bool Button1down; // rechte Maustaste gedrückt gehalten +namespace Direct { +//LPDIRECTDRAW4 lpDD = nullptr; // DirectDraw object +bool Button0down; // linke Maustaste gedrückt gehalten +bool Button1down; // rechte Maustaste gedrückt gehalten - void finiObjects() - { - if (lpDD != nullptr) - { - if (lpDDSPrimary != nullptr) - { - lpDDSPrimary->Release(); - lpDDSPrimary = nullptr; - } - if (lpDDPal != nullptr) - { - lpDDPal->Release(); - lpDDPal = nullptr; - } - lpDD->Release(); - lpDD = nullptr; +void finiObjects() +{ +// if (lpDD != nullptr) { + if (screenTexture != nullptr) { +// lpDDSPrimary->Release(); + delete screenTexture; + screenTexture = nullptr; } + delete minimapPlayerTexture; + delete minimapPlayerSprite; + + delete s_creditsSprite; + +// if (lpDDPal != nullptr) { +// lpDDPal->Release(); +// lpDDPal = nullptr; +// } + +// lpDD->Release(); +// lpDD = nullptr; +// } +} + +bool InitDDraw() +{ +// DDSCAPS2 ddscaps; +// LPDIRECTDRAW pDD; + minimapPlayerTexture = Renderer::createEmptyTexture(2, 2, sf::Color::Red); + minimapPlayerSprite = new sf::Sprite; + minimapPlayerSprite->setTexture(*minimapPlayerTexture); + + s_creditsSprite = new sf::Sprite; + + s_darknessColor = sf::Color::White; + + lpDDSBack = Renderer::createEmptyTexture(MAX_SCREEN_X, MAX_SCREEN_Y, sf::Color(0, 0, 0)); +#if 0 + // Create the main DirectDraw object + HRESULT ddrval = dx_DirectDrawCreate(nullptr, &pDD, nullptr); + + if (ddrval != DD_OK) { + goto error; } - void InitDDraw(HWND hWnd) - { - DDSCAPS2 ddscaps; - LPDIRECTDRAW pDD; - - // Create the main DirectDraw object - HRESULT ddrval = DirectDrawCreate(nullptr, &pDD, nullptr); - if (ddrval != DD_OK) - goto error; - ddrval = pDD->QueryInterface(IID_IDirectDraw4, reinterpret_cast(& lpDD)); - if (ddrval != DD_OK) - goto error; - - // Get exclusive mode - ddrval = lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); - if (ddrval != DD_OK) - goto error; - - // Set the video mode to 800x600x16 - ddrval = lpDD->SetDisplayMode(MAXX, MAXY, 32, 0, 0); - if (ddrval != DD_OK) +// ddrval = pDD->QueryInterface(IID_IDirectDraw, reinterpret_cast(& lpDD)); +// if (ddrval != DD_OK) +// goto error; + + // Get exclusive mode +// ddrval = lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); +// if (ddrval != DD_OK) +// goto error; + + // Set the video mode to 800x600x16 + ddrval = lpDD->SetDisplayMode(MAX_SCREEN_X, MAX_SCREEN_Y, 32); + + if (ddrval != DD_OK) { + switch (ddrval) { + case DDERR_GENERIC: + case DDERR_INVALIDMODE: + case DDERR_INVALIDOBJECT: + +// case DDERR_INVALIDPARAMS: + case DDERR_LOCKEDSURFACES: + case DDERR_NOEXCLUSIVEMODE: + case DDERR_SURFACEBUSY: +// case DDERR_UNSUPPORTED: +// case DDERR_UNSUPPORTEDMODE: { - switch (ddrval) - { - case DDERR_GENERIC: - case DDERR_INVALIDMODE: - case DDERR_INVALIDOBJECT: - case DDERR_INVALIDPARAMS: - case DDERR_LOCKEDSURFACES: - case DDERR_NOEXCLUSIVEMODE: - case DDERR_SURFACEBUSY: - case DDERR_UNSUPPORTED: - case DDERR_UNSUPPORTEDMODE: - { - MessageBeep(MB_OK); - break; - } - case DDERR_WASSTILLDRAWING: - ; - } - - goto error; +// MessageBeep(MB_OK); + break; } - ZeroMemory(&ddsd2, sizeof(ddsd2)); - ddsd2.dwSize = sizeof(ddsd2); - - // Create the primary surface with 1 back buffer - ZeroMemory(&ddsd, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; - ddsd.dwBackBufferCount = 1; // Anzahl ?? - ddrval = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, nullptr); - if (ddrval != DD_OK) - goto error; - - // für gamma-ablenden - lpDDSPrimary->QueryInterface(IID_IDirectDrawGammaControl, reinterpret_cast(&lpDDGammaControl)); - lpDDGammaControl->GetGammaRamp(0, &DDGammaOld); - lpDDGammaControl->GetGammaRamp(0, &DDGammaRamp); - - ddscaps.dwCaps = DDSCAPS_BACKBUFFER; - ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); - - if (ddrval != DD_OK) - goto error; - - ddsd.dwSize = sizeof(ddsd); // Tell DirectDraw which members are valid. - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - // In diese Surface sollen die Bausteine geladen werden - lpDD->CreateSurface(&ddsd, &lpDDSMisc, nullptr); - lpDDSMisc = DDLoadBitmap(lpDD, Misc, 0, 0); - DDSetColorKey(lpDDSMisc, RGB(255, 0, 255)); - // In diese Surface sollen das Panel geladen werden - lpDD->CreateSurface(&ddsd, &lpDDSPanel, nullptr); - lpDDSPanel = DDLoadBitmap(lpDD, Panel, 0, 0); - DDSetColorKey(lpDDSPanel, RGB(255, 0, 255)); - // In diese Surface sollen die Animation der Figur gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSGuyAni, nullptr); - lpDDSGuyAni = DDLoadBitmap(lpDD, GuyAni, 0, 0); - DDSetColorKey(lpDDSGuyAni, RGB(255, 0, 255)); - // In diese Surface sollen die Landschaftsanimationen gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSAnimation, nullptr); - lpDDSAnimation = DDLoadBitmap(lpDD, Animation, 0, 0); - DDSetColorKey(lpDDSAnimation, RGB(255, 0, 255)); - // In diese Surface soll die Schrift1 gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSSchrift1, nullptr); - lpDDSSchrift1 = DDLoadBitmap(lpDD, Schrift1, 0, 0); - DDSetColorKey(lpDDSSchrift1, RGB(255, 0, 255)); - // In diese Surface soll die Schrift2 gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSSchrift2, nullptr); - lpDDSSchrift2 = DDLoadBitmap(lpDD, Schrift2, 0, 0); - DDSetColorKey(lpDDSSchrift2, RGB(255, 0, 255)); - // In diese Surface soll das Papier gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSPapier, nullptr); - lpDDSPapier = DDLoadBitmap(lpDD, Papier, 0, 0); - DDSetColorKey(lpDDSPapier, RGB(255, 0, 255)); - // In diese Surface solln die Bäume gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSBaum, nullptr); - lpDDSBaum = DDLoadBitmap(lpDD, Baum, 0, 0); - DDSetColorKey(lpDDSBaum, RGB(255, 0, 255)); - // In diese Surface solln die Cursor gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSCursor, nullptr); - lpDDSCursor = DDLoadBitmap(lpDD, Cursorbmp, 0, 0); - DDSetColorKey(lpDDSCursor, RGB(255, 0, 255)); - // In diese Surface solln die Buttons gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSButtons, nullptr); - lpDDSButtons = DDLoadBitmap(lpDD, Buttons, 0, 0); - DDSetColorKey(lpDDSButtons, RGB(255, 0, 255)); - // In diese Surface solln das TextFeld gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSTextFeld, nullptr); - lpDDSTextFeld = DDLoadBitmap(lpDD, TextFeld, 0, 0); - DDSetColorKey(lpDDSTextFeld, RGB(255, 0, 255)); - // In diese Surface solln das Inventar gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSInventar, nullptr); - lpDDSInventar = DDLoadBitmap(lpDD, Inventarbmp, 0, 0); - DDSetColorKey(lpDDSInventar, RGB(255, 0, 255)); - // In diese Surface solln die Bauwerke gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSBau, nullptr); - lpDDSBau = DDLoadBitmap(lpDD, Bau, 0, 0); - DDSetColorKey(lpDDSBau, RGB(255, 0, 255)); - // In diese Surface solln die Credits gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSCredits, nullptr); - lpDDSCredits = DDLoadBitmap(lpDD, Credits, 0, 0); - DDSetColorKey(lpDDSCredits, RGB(0, 0, 0)); //Ausnahmsweise schwarz - // In diese Surface solln das Logo gespeichert werden - lpDD->CreateSurface(&ddsd, &lpDDSLogo, nullptr); - lpDDSLogo = DDLoadBitmap(lpDD, Logo, 0, 0); - - ZeroMemory(&ddsd, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); // Tell DirectDraw which members are valid. - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - // In diese Surface soll die MiniMap gespeichert werden - ddsd.dwWidth = 2 * MAXXKACH; - ddsd.dwHeight = 2 * MAXYKACH; - lpDD->CreateSurface(&ddsd, &lpDDSKarte, nullptr); - // In diese Surface soll die Landschaft gespeichert werden - ddsd.dwWidth = MAXSCAPEX; - ddsd.dwHeight = MAXSCAPEY; - lpDD->CreateSurface(&ddsd, &lpDDSScape, nullptr); - // In diese Surface soll die Schrift gespeichert werden - ddsd.dwWidth = MAXX; - ddsd.dwHeight = MAXY; - lpDD->CreateSurface(&ddsd, &lpDDSSchrift, nullptr); - DDSetColorKey(lpDDSSchrift, RGB(255, 0, 255)); - // In diese Surface soll die Schatzkarte gespeichert werden - ddsd.dwWidth = SKARTEX; - ddsd.dwHeight = SKARTEY; - lpDD->CreateSurface(&ddsd, &lpDDSSchatzkarte, nullptr); - - - ddbltfx.dwSize = sizeof(ddbltfx); - ddpf.dwSize = sizeof(ddpf); - lpDDSSchrift->GetPixelFormat(&ddpf); - - error: - if (ddrval != DD_OK) - { - finiObjects(); - MessageBox(hWnd, ("DirectDraw Init FAILED: " + std::to_string(ddrval)).c_str(), "Landscape", MB_OK); - DestroyWindow(hWnd); + case DDERR_WASSTILLDRAWING: + ; } + + goto error; + } +#endif + +// ZeroMemory(&ddsd2, sizeof(ddsd2)); +// ddsd2.dwSize = sizeof(ddsd2); + +// // Create the primary surface with 1 back buffer +// ZeroMemory(&ddsd, sizeof(ddsd)); +// ddsd.dwSize = sizeof(ddsd); +//// ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; +//// ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; +// ddsd.dwBackBufferCount = 1; // Anzahl ?? +// screenTexture = new sf::Texture; +// ddrval = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, nullptr); + +// if (ddrval != DD_OK) { +// goto error; +// } + + // für gamma-ablenden +// lpDDSPrimary->QueryInterface(IID_IDirectDrawGammaControl, reinterpret_cast(&lpDDGammaControl)); +// lpDDGammaControl->GetGammaRamp(0, &DDGammaOld); +// lpDDGammaControl->GetGammaRamp(0, &DDGammaRamp); + +// ddscaps.dwCaps = DDSCAPS_BACKBUFFER; +// ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); + +// if (ddrval != DD_OK) { +// goto error; +// } + +// ddsd.dwSize = sizeof(ddsd); // Tell DirectDraw which members are valid. +// ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; +// ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + // In diese Surface sollen die Bausteine geladen werden + lpDDSMisc = Renderer::loadTexture(resource_Misc_BMP_data, resource_Misc_BMP_size); + if (!lpDDSMisc) { + puts("Failed to load misc"); + return false; } - void Reset() - { - Button0down = false; - Button1down = false; + // In diese Surface sollen die Animation der Figur gespeichert werden + lpDDSGuyAni = Renderer::loadTexture(resource_GuyAni_bmp_data, resource_GuyAni_bmp_size); + if (!lpDDSGuyAni) { + puts("failed to load guyani.bmp"); + return false; } - void CheckMouse() - { - // Mausbewegung - short xDiff = MousePosition.x - sf::Mouse::getPosition().x; // Die Differenz zur vorherigen Position ((Für Scrollen) - MousePosition.x = sf::Mouse::getPosition().x; - if (MousePosition.x < 0) - MousePosition.x = 0; - if (MousePosition.x > MAXX - 2) - MousePosition.x = MAXX - 2; - short yDiff = MousePosition.y - sf::Mouse::getPosition().y; // Die Differenz zur vorherigen Position ((Für Scrollen) - MousePosition.y = sf::Mouse::getPosition().y; - if (MousePosition.y < 0) - MousePosition.y = 0; - if (MousePosition.y > MAXY - 2) - MousePosition.y = MAXY - 2; - - if (TwoClicks == -1) - { - if (Guy.Aktiv) - { - if (Math::InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSTOP].rcDes) && (Bmp[BUTTSTOP].Phase != -1)) - CursorTyp = CUPFEIL; - else - CursorTyp = CUUHR; + // In diese Surface sollen das Panel geladen werden + lpDDSPanel = Renderer::loadTexture(resource_Panel_png_data, resource_Panel_png_size); + if (!lpDDSPanel) { + puts("failed to load panel.png"); + return false; + } + + // In diese Surface sollen die Landschaftsanimationen gespeichert werden + lpDDSAnimation = Renderer::loadTexture(resource_Animation_BMP_data, resource_Animation_BMP_size); + if (!lpDDSAnimation) { + puts("failed to load animation.bmp"); + return false; + } + + // In diese Surface soll die Schrift1 gespeichert werden + lpDDSSchrift1 = Renderer::loadTexture(resource_Schrift1_BMP_data, resource_Schrift1_BMP_size); + if (!lpDDSSchrift1) { + puts("failed to load schrift1"); + return false; + } + + // In diese Surface soll die Schrift2 gespeichert werden + lpDDSSchrift2 = Renderer::loadTexture(resource_Schrift2_bmp_data, resource_Schrift2_bmp_size); + if (!lpDDSSchrift2) { + puts("failed to load schrift2"); + return false; + } + + // In diese Surface soll das Papier gespeichert werden + lpDDSPaper = Renderer::loadTexture(resource_Papier_bmp_data, resource_Papier_bmp_size); + if (!lpDDSPaper) { + puts("failed to load papier.bmp"); + return false; + } + + // In diese Surface solln die Bäume gespeichert werden + lpDDSBaum = Renderer::loadTexture(resource_Baum_bmp_data, resource_Baum_bmp_size); + if (!lpDDSBaum) { + puts("failed to load baum.bmp"); + return false; + } + + // In diese Surface solln die Cursor gespeichert werden + lpDDSCursor = Renderer::loadTexture(resource_Cursor_BMP_data, resource_Cursor_BMP_size); + if (!lpDDSCursor) { + puts("failed to load texture.bmp"); + return false; + } + + // In diese Surface solln die Buttons gespeichert werden + lpDDSButtons = Renderer::loadTexture(resource_Buttons_bmp_data, resource_Buttons_bmp_size); + if (!lpDDSButtons) { + puts("failed to load buttons.bmp"); + return false; + } + + // In diese Surface solln das TextFeld gespeichert werden + lpDDSTextFeld = Renderer::loadTexture(resource_Textfeld_bmp_data, resource_Textfeld_bmp_size); + if (!lpDDSTextFeld) { + puts("failed to load textfeld.bmp"); + return false; + } + + // In diese Surface solln das Inventar gespeichert werden + lpDDSInventar = Renderer::loadTexture(resource_Inventar_bmp_data, resource_Inventar_bmp_size); + if (!lpDDSInventar) { + puts("failed to load inventar.bmp"); + return false; + } + + // In diese Surface solln die Bauwerke gespeichert werden + lpDDSBau = Renderer::loadTexture(resource_Bau_bmp_data, resource_Bau_bmp_size); + if (!lpDDSBau) { + puts("failed to load bau.bmp"); + return false; + } + + // In diese Surface solln die Credits gespeichert werden + lpDDSCredits = Renderer::loadTexture(resource_Credits_bmp_data, resource_Credits_bmp_size, sf::Color::Black); + if (!lpDDSCredits) { + puts("failed to load credits.bmp"); + return false; + } + + // In diese Surface solln das Logo gespeichert werden + lpDDSLogo = Renderer::loadTexture(resource_Logo_png_data, resource_Logo_png_size); + if (!lpDDSLogo) { + puts("failed to load logo.png"); + return false; + } + + // In diese Surface soll die MiniMap gespeichert werden + lpDDSKarte = Renderer::createEmptyTexture(2 * MAX_TILES_X, 2 * MAX_TILESY, sf::Color::Transparent); + + // The landscape should be saved in this surface +// lpDDSScape = Renderer::createEmptyTexture(2 * MAX_SURFACE_X, 2 * MAX_SURFACE_Y, sf::Color::Transparent); + + // In diese Surface soll die Schrift gespeichert werden +// lpDDSSchrift = Renderer::createEmptyTexture(2 * MAX_SCREEN_X, 2 * MAX_SCREEN_Y, sf::Color::Transparent); + + // In diese Surface soll die Schatzkarte gespeichert werden + lpDDSSchatzkarte = Renderer::createEmptyTexture(2 * TREASUREMAP_WIDTH, 2 * TREASUREMAP_HEIGHT, sf::Color::Transparent); +// s_treasureMapSprite = new sf::Sprite; +// s_treasureMapSprite->setTexture(*lpDDSSchatzkarte); + + return true; +} + +void Reset() +{ + Button0down = false; + Button1down = false; +} + +void CheckMouse(const Coordinate newMousePos) +{ + // Mausbewegung + short xDiff = MousePosition.x - newMousePos.x; // Die Differenz zur vorherigen Position ((Für Scrollen) + + MousePosition.x = newMousePos.x; + + if (MousePosition.x < 0) { + MousePosition.x = 0; + } + + if (MousePosition.x > MAX_SCREEN_X - 2) { + MousePosition.x = MAX_SCREEN_X - 2; + } + + short yDiff = MousePosition.y - newMousePos.y; // Die Differenz zur vorherigen Position ((Für Scrollen) + MousePosition.y = newMousePos.y; + + if (MousePosition.y < 0) { + MousePosition.y = 0; + } + + if (MousePosition.y > MAX_SCREEN_Y - 2) { + MousePosition.y = MAX_SCREEN_Y - 2; + if (yDiff < 0) { + yDiff = 0; + } + } + + if (TwoClicks == -1) { + if (Guy.IsActive) { + if (Math::InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_STOP].targetRect) && (Bmp[Tiles::BUTTON_STOP].AnimationPhase != -1)) { + CursorTyp = Tiles::CURSOR_ARROW; + } else { + CursorTyp = Tiles::CURSOR_CLOCK; } - else - CursorTyp = CUPFEIL; + } else { + CursorTyp = Tiles::CURSOR_ARROW; } + } - short Button = -1; // Welcher Knopf ist gedrückt worden - short Push = 0; // Knopf gedrückt(1) oder losgelassen(-1) oder gedrückt(0) gehalten + short Button = -1; // Welcher Knopf ist gedrückt worden + short Push = 0; // Knopf gedrückt(1) oder losgelassen(-1) oder gedrückt(0) gehalten - if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) - { - Button = 0; - if (Button0down) - Push = 0; - else - { - Push = 1; - Button0down = true; - } + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + Button = 0; + + if (Button0down) { + Push = 0; + } else { + Push = 1; + Button0down = true; } - else - { - if (Button0down) - { - Button = 0; - Push = -1; - Button0down = false; - } + } else { + if (Button0down) { + Button = 0; + Push = -1; + Button0down = false; } + } - if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) - { - Button = 1; - if (Button1down) - Push = 0; - else - { - Push = 1; - Button1down = true; - } + if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) { + Button = 1; + + if (Button1down) { + Push = 0; + } else { + Push = 1; + Button1down = true; } - else - { - if (Button1down) - { - Button = 1; - Push = -1; - Button1down = false; - } + } else { + if (Button1down) { + Button = 1; + Push = -1; + Button1down = false; } + } - // Wenn ein Text steht, dann bei Mausdruck Text weg - if (PapierText != -1) - { - if (Frage == 0) - { - if (Math::InRect(MousePosition.x, MousePosition.y, Bmp[JA].rcDes)) - { - CursorTyp = CUPFEIL; - if ((Button == 0) && (Push == 1)) - { - Frage = 1; - Renderer::Textloeschen(TXTPAPIER); - PapierText = -1; - Guy.Aktiv = false; - PlaySound(Sound::CLICK2, 100); - } + // Wenn ein Text steht, dann bei Mausdruck Text weg + if (PapierText != -1) { + if (Frage == 0) { + if (Math::InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::YES].targetRect)) { + CursorTyp = Tiles::CURSOR_ARROW; + + if ((Button == 0) && (Push == 1)) { + Frage = 1; + Renderer::HideText(TXTPAPIER); + PapierText = -1; + Guy.IsActive = false; + PlaySound(Sound::CLICK2, 100); } - else if (Math::InRect(MousePosition.x, MousePosition.y, Bmp[NEIN].rcDes)) - { - CursorTyp = CUPFEIL; - if ((Button == 0) && (Push == 1)) - { - Frage = 2; - Renderer::Textloeschen(TXTPAPIER); - PapierText = -1; - Guy.Aktiv = false; - PlaySound(Sound::CLICK2, 100); - } + } else if (Math::InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::NO].targetRect)) { + CursorTyp = Tiles::CURSOR_ARROW; + + if ((Button == 0) && (Push == 1)) { + Frage = 2; + Renderer::HideText(TXTPAPIER); + PapierText = -1; + Guy.IsActive = false; + PlaySound(Sound::CLICK2, 100); } - else if ((Button == 0) && (Push == 1)) - PlaySound(Sound::CLICK, 100); - } - else if ((Button != -1) && (Push == 1)) - { - Renderer::Textloeschen(TXTPAPIER); - PapierText = -1; - Guy.Aktiv = false; + } else if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK, 100); } - return; + } else if ((Button != -1) && (Push == 1)) { + Renderer::HideText(TXTPAPIER); + PapierText = -1; + Guy.IsActive = false; } - // Animationen und Text löschen (werden dann von den MouseIn.. Sachen neu angestellt - Renderer::Textloeschen(TXTTEXTFELD); - Math::ButtAniAus(); + return; + } - // Wenn der Guy aktiv dann linke Mouse-Buttons ignorieren - if ((Guy.Aktiv) && (Button == 0)) - { - if (!(Math::InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSTOP].rcDes)) || - (Bmp[BUTTSTOP].Phase == -1)) - Button = -1; + // Animationen und Text löschen (werden dann von den MouseIn.. Sachen neu angestellt + Renderer::HideText(TXTTEXTFELD); + Math::ButtAniAus(); + + // Wenn der Guy aktiv dann linke Mouse-Buttons ignorieren + if ((Guy.IsActive) && (Button == 0)) { + if (!(Math::InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_STOP].targetRect)) || + (Bmp[Tiles::BUTTON_STOP].AnimationPhase == -1)) { + Button = -1; } + } - // die Maus ist in der Spielflaeche -> - if (Math::InRect(MousePosition.x, MousePosition.y, rcSpielflaeche)) - Math::MouseInSpielflaeche(Button, Push, xDiff, yDiff); - // die Maus ist im Panel -> - if (Math::InRect(MousePosition.x, MousePosition.y, rcPanel)) - Math::MouseInPanel(Button, Push); + // die Maus ist in der Spielflaeche -> + if (Math::InRect(MousePosition.x, MousePosition.y, rcPlayingSurface)) { + Math::UpdateMousePosition(Button, Push, xDiff, yDiff); } - short CheckKey() - { - if (Spielzustand == State::LOGO) - { - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || sf::Keyboard::isKeyPressed(sf::Keyboard::Return) || - sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) // Logo Abbrechen - { - StopSound(Sound::LOGO); - Game::NeuesSpiel(false); - return 2; - } + // die Maus ist im Panel -> + if (Math::InRect(MousePosition.x, MousePosition.y, rcPanel)) { + Math::MouseInPanel(Button, Push); + } +} + +short CheckKey() +{ + if (s_GameState == State::LOGO) { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || sf::Keyboard::isKeyPressed(sf::Keyboard::Return) || + sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) { // Logo Abbrechen + StopSound(Sound::LOGO); + Game::NewGame(false); + return 2; } - else if (Spielzustand == State::INTRO) - { - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || sf::Keyboard::isKeyPressed(sf::Keyboard::Return) || - sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) // Intro Abbrechen - { - StopSound(Sound::STORM); // Sound hier sofort stoppen - StopSound(Sound::SWIM); // Sound hier sofort stoppen - Guy.Aktiv = false; - for (short x = Guy.Pos.x; x < MAXXKACH; x++) - { - Guy.Pos.x = x; - World::Entdecken(); - if (Scape[Guy.Pos.x][Guy.Pos.y].Art != 1) - break; + } else if (s_GameState == State::INTRO) { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || sf::Keyboard::isKeyPressed(sf::Keyboard::Return) || + sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) { // Intro Abbrechen + StopSound(Sound::STORM); // Sound hier sofort stoppen + StopSound(Sound::SWIM); // Sound hier sofort stoppen + Guy.IsActive = false; + + for (short x = Guy.Pos.x; x < MAX_TILES_X; x++) { + Guy.Pos.x = x; + World::UpdateDiscovered(); + + if (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain != 1) { + break; } - Scape[Guy.Pos.x - 2][Guy.Pos.y].Objekt = WRACK; - Scape[Guy.Pos.x - 2][Guy.Pos.y].ObPos.x = static_cast(Bmp[WRACK].rcDes.left); - Scape[Guy.Pos.x - 2][Guy.Pos.y].ObPos.y = static_cast(Bmp[WRACK].rcDes.top); - - Guy.PosScreen.x = - (Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2; - Guy.PosScreen.y = - (Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2; - RouteStart.x = -1; - RouteStart.y = -1; - RouteZiel.x = -1; - RouteZiel.y = -1; - Camera.x = Guy.PosScreen.x - static_cast(rcSpielflaeche.right / 2); - Camera.y = Guy.PosScreen.y - static_cast(rcSpielflaeche.bottom / 2); - if (BootsFahrt) World::ChangeBootsFahrt(); - Guy.Zustand = GUYLINKS; - Guy.Aktion = Action::NOTHING; - Spielzustand = State::GAME; - Guy.PosAlt = Guy.PosScreen; - Game::SaveGame(); - return 1; } - } - else if (Spielzustand == State::RESCUED) - { - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || sf::Keyboard::isKeyPressed(sf::Keyboard::Return) || - sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) - { - Spielzustand = State::OUTRO; - return 1; + + Landscape[Guy.Pos.x - 2][Guy.Pos.y].Object = Tiles::WRECK_1; + Landscape[Guy.Pos.x - 2][Guy.Pos.y].ObjectPosOffset.x = static_cast(Bmp[Tiles::WRECK_1].targetRect.left); + Landscape[Guy.Pos.x - 2][Guy.Pos.y].ObjectPosOffset.y = static_cast(Bmp[Tiles::WRECK_1].targetRect.top); + + Guy.ScreenPosition.x = + (Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2; + Guy.ScreenPosition.y = + (Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2; + RouteStart.x = -1; + RouteStart.y = -1; + RouteDestination.x = -1; + RouteDestination.y = -1; + Camera.x = Guy.ScreenPosition.x - static_cast(rcPlayingSurface.right / 2); + Camera.y = Guy.ScreenPosition.y - static_cast(rcPlayingSurface.bottom / 2); + + if (IsInBoat) { + World::ToggleIsInBoat(); } + + Guy.AnimationState = Tiles::GUY_LEFT; + Guy.CurrentAction = Action::NOTHING; + s_GameState = State::GAME; + Guy.OriginalPosition = Guy.ScreenPosition; + Game::SaveGame(); + return 1; + } + } else if (s_GameState == State::RESCUED) { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || sf::Keyboard::isKeyPressed(sf::Keyboard::Return) || + sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) { + s_GameState = State::OUTRO; + return 1; + } + } else if (s_GameState == State::GAME) { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) { + Camera.x += 10; } - else if (Spielzustand == State::GAME) - { - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) - Camera.x += 10; - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) - Camera.x -= 10; - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) - Camera.y += 10; - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) - Camera.y -= 10; - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) - { - Guy.AkNummer = 0; - Guy.Aktiv = false; - Guy.Aktion = Action::QUIT; - } - if (sf::Keyboard::isKeyPressed(sf::Keyboard::F11)) - { - Guy.AkNummer = 0; - Guy.Aktiv = false; - Guy.Aktion = Action::RESTART; - } - if (sf::Keyboard::isKeyPressed(sf::Keyboard::G)) - { - Gitter = !Gitter; - World::Generate(); - } - if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)) - { - LAnimation = !LAnimation; - World::Generate(); - } - // Development - /* - if (sf::Keyboard::isKeyPressed(sf::Keyboard::C)) - { - short x,y; - for (y=0;y -namespace Direct -{ - // finished with all objects we use; release them - void finiObjects(); +namespace Direct { +// finished with all objects we use; release them +void finiObjects(); - void InitDDraw(HWND hWnd); // DirectDraw initialisieren - void Reset(); - void CheckMouse(); // Maus abfragen - short CheckKey(); // Tastatur abfragen +bool InitDDraw(); // DirectDraw initialisieren +void Reset(); +void CheckMouse(const Coordinate newMousePos); // Maus abfragen +short CheckKey(); // Tastatur abfragen } diff --git a/src/Game.cpp b/src/Game.cpp index 5ea4588..c2af752 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -10,2447 +10,2444 @@ #include -namespace Game +namespace Game { +void SaveGame() { - void SaveGame() - { - std::ofstream ofs("save.dat", std::ios::binary); - if (!ofs) return; - - ofs.write(reinterpret_cast(Scape), sizeof(Scape)); - ofs.write(reinterpret_cast(&Guy), sizeof(Guy)); - ofs.write(reinterpret_cast(&BootsFahrt), sizeof(BootsFahrt)); - ofs.write(reinterpret_cast(&Camera), sizeof(Camera)); - ofs.write(reinterpret_cast(&Chance), sizeof(Chance)); - ofs.write(reinterpret_cast(&Gitter), sizeof(Gitter)); - ofs.write(reinterpret_cast(&HauptMenue), sizeof(HauptMenue)); - ofs.write(reinterpret_cast(&LAnimation), sizeof(LAnimation)); - ofs.write(reinterpret_cast(&Minuten), sizeof(Minuten)); - ofs.write(reinterpret_cast(&ScapeGrenze), sizeof(ScapeGrenze)); - ofs.write(reinterpret_cast(&SchatzPos), sizeof(SchatzPos)); - ofs.write(reinterpret_cast(&Spielzustand), sizeof(Spielzustand)); - ofs.write(reinterpret_cast(&Stunden), sizeof(Stunden)); - ofs.write(reinterpret_cast(&Tag), sizeof(Tag)); - ofs.write(reinterpret_cast(TextBereich), sizeof(TextBereich)); - ofs.write(reinterpret_cast(&SchatzGef), sizeof(SchatzGef)); - - for (short i = 0; i < BILDANZ; i++) - { - ofs.write(reinterpret_cast(&Bmp[i].Animation), sizeof(Bmp[i].Animation)); - ofs.write(reinterpret_cast(&Bmp[i].Phase), sizeof(Bmp[i].Phase)); - ofs.write(reinterpret_cast(&Bmp[i].First), sizeof(Bmp[i].First)); - } + std::ofstream ofs("save.dat", std::ios::binary); + + if (!ofs) { + return; } - bool LoadGame() - { - std::ifstream ifs("save.dat", std::ios::binary); // | ios::nocreate); - if (!ifs) return (false); - - ifs.read(reinterpret_cast(Scape), sizeof(Scape)); - ifs.read(reinterpret_cast(&Guy), sizeof(Guy)); - ifs.read(reinterpret_cast(&BootsFahrt), sizeof(BootsFahrt)); - ifs.read(reinterpret_cast(&Camera), sizeof(Camera)); - ifs.read(reinterpret_cast(&Chance), sizeof(Chance)); - ifs.read(reinterpret_cast(&Gitter), sizeof(Gitter)); - ifs.read(reinterpret_cast(&HauptMenue), sizeof(HauptMenue)); - ifs.read(reinterpret_cast(&LAnimation), sizeof(LAnimation)); - ifs.read(reinterpret_cast(&Minuten), sizeof(Minuten)); - ifs.read(reinterpret_cast(&ScapeGrenze), sizeof(ScapeGrenze)); - ifs.read(reinterpret_cast(&SchatzPos), sizeof(SchatzPos)); - ifs.read(reinterpret_cast(&Spielzustand), sizeof(Spielzustand)); - ifs.read(reinterpret_cast(&Stunden), sizeof(Stunden)); - ifs.read(reinterpret_cast(&Tag), sizeof(Tag)); - ifs.read(reinterpret_cast(TextBereich), sizeof(TextBereich)); - ifs.read(reinterpret_cast(&SchatzGef), sizeof(SchatzGef)); - - for (short i = 0; i < BILDANZ; i++) - { - ifs.read(reinterpret_cast(&Bmp[i].Animation), sizeof(Bmp[i].Animation)); - ifs.read(reinterpret_cast(&Bmp[i].Phase), sizeof(Bmp[i].Phase)); - ifs.read(reinterpret_cast(&Bmp[i].First), sizeof(Bmp[i].First)); - } - return (true); + ofs.write(reinterpret_cast(Landscape), sizeof(Landscape)); + ofs.write(reinterpret_cast(&Guy), sizeof(Guy)); + ofs.write(reinterpret_cast(&IsInBoat), sizeof(IsInBoat)); + ofs.write(reinterpret_cast(&Camera), sizeof(Camera)); + ofs.write(reinterpret_cast(&Chance), sizeof(Chance)); + ofs.write(reinterpret_cast(&Gitter), sizeof(Gitter)); + ofs.write(reinterpret_cast(&HauptMenue), sizeof(HauptMenue)); + ofs.write(reinterpret_cast(&LAnimation), sizeof(LAnimation)); + ofs.write(reinterpret_cast(&Minutes), sizeof(Minutes)); + ofs.write(reinterpret_cast(&ScapeGrenze), sizeof(ScapeGrenze)); + ofs.write(reinterpret_cast(&SchatzPos), sizeof(SchatzPos)); + ofs.write(reinterpret_cast(&s_GameState), sizeof(s_GameState)); + ofs.write(reinterpret_cast(&Hours), sizeof(Hours)); + ofs.write(reinterpret_cast(&Tag), sizeof(Tag)); + ofs.write(reinterpret_cast(TextBereich), sizeof(TextBereich)); + ofs.write(reinterpret_cast(&SchatzGef), sizeof(SchatzGef)); + + for (short i = 0; i < SPRITE_COUNT; i++) { + ofs.write(reinterpret_cast(&Bmp[i].IsAnimationRunning), sizeof(Bmp[i].IsAnimationRunning)); + ofs.write(reinterpret_cast(&Bmp[i].AnimationPhase), sizeof(Bmp[i].AnimationPhase)); + ofs.write(reinterpret_cast(&Bmp[i].First), sizeof(Bmp[i].First)); } +} - void InitStructs() - { - short i, k; - - // BILD - // Standardbildinitialisierung - for (i = 0; i < BILDANZ; i++) - { - Bmp[i].Animation = false; - Bmp[i].Anzahl = 0; - Bmp[i].Geschwindigkeit = 0; - Bmp[i].Phase = 0; - Bmp[i].Surface = nullptr; - Bmp[i].rcSrc.left = 0; - Bmp[i].rcSrc.right = 0; - Bmp[i].rcSrc.top = 0; - Bmp[i].rcSrc.bottom = 0; - Bmp[i].rcDes.left = 0; - Bmp[i].rcDes.right = 0; - Bmp[i].rcDes.top = 0; - Bmp[i].rcDes.bottom = 0; - Bmp[i].Breite = 0; - Bmp[i].Hoehe = 0; - Bmp[i].Sound = 0; - for (k = 0; k < BILDANZ; k++) - Bmp[i].Rohstoff[k] = 0; - Bmp[i].AkAnzahl = 0; - Bmp[i].First = true; - } +bool LoadGame() +{ + std::ifstream ifs("save.dat", std::ios::binary); // | ios::nocreate); - // Guy - for (i = GUYLINKS; i <= GUYUNTEN; i++) - { - Bmp[i].Animation = false; - Bmp[i].Anzahl = 4; - Bmp[i].Geschwindigkeit = 20; - Bmp[i].Phase = 0; - Bmp[i].Surface = lpDDSGuyAni; - Bmp[i].rcSrc.left = 7 * (i - GUYLINKS); - Bmp[i].rcSrc.right = 7 + 7 * (i - GUYLINKS); - Bmp[i].rcSrc.top = 0; - Bmp[i].rcSrc.bottom = 18; - Bmp[i].Breite = 7; - Bmp[i].Hoehe = 18; - } + if (!ifs) { + return (false); + } - for (i = GUYSUCHEN; i <= GUYSCHLEUDER; i++) - { - Bmp[i].Animation = false; - Bmp[i].Phase = 0; - Bmp[i].Surface = lpDDSGuyAni; - } - Bmp[GUYSUCHEN].Anzahl = 4; - Bmp[GUYSUCHEN].Geschwindigkeit = 4; - Bmp[GUYSUCHEN].rcSrc.left = 28; - Bmp[GUYSUCHEN].rcSrc.right = 39; - Bmp[GUYSUCHEN].rcSrc.top = 0; - Bmp[GUYSUCHEN].rcSrc.bottom = 14; - Bmp[GUYSUCHEN].Breite = 11; - Bmp[GUYSUCHEN].Hoehe = 14; - Bmp[GUYSUCHEN].Sound = Sound::CRACKLE; - - Bmp[GUYESSEN].Anzahl = 4; - Bmp[GUYESSEN].Geschwindigkeit = 4; - Bmp[GUYESSEN].rcSrc.left = 39; - Bmp[GUYESSEN].rcSrc.right = 39 + 7; - Bmp[GUYESSEN].rcSrc.top = 0; - Bmp[GUYESSEN].rcSrc.bottom = 17; - Bmp[GUYESSEN].Breite = 7; - Bmp[GUYESSEN].Hoehe = 17; - Bmp[GUYESSEN].Sound = Sound::CRACKLE; - - Bmp[GUYTRINKEN].Anzahl = 5; - Bmp[GUYTRINKEN].Geschwindigkeit = 4; - Bmp[GUYTRINKEN].rcSrc.left = 46; - Bmp[GUYTRINKEN].rcSrc.right = 46 + 9; - Bmp[GUYTRINKEN].rcSrc.top = 0; - Bmp[GUYTRINKEN].rcSrc.bottom = 13; - Bmp[GUYTRINKEN].Breite = 9; - Bmp[GUYTRINKEN].Hoehe = 13; - Bmp[GUYTRINKEN].Sound = Sound::DRINK; - - Bmp[GUYFAELLEN].Anzahl = 4; - Bmp[GUYFAELLEN].Geschwindigkeit = 6; - Bmp[GUYFAELLEN].rcSrc.left = 55; - Bmp[GUYFAELLEN].rcSrc.right = 55 + 15; - Bmp[GUYFAELLEN].rcSrc.top = 0; - Bmp[GUYFAELLEN].rcSrc.bottom = 19; - Bmp[GUYFAELLEN].Breite = 15; - Bmp[GUYFAELLEN].Hoehe = 19; - Bmp[GUYFAELLEN].Sound = Sound::LOG; - - Bmp[GUYWARTEN].Anzahl = 4; - Bmp[GUYWARTEN].Geschwindigkeit = 2; - Bmp[GUYWARTEN].rcSrc.left = 70; - Bmp[GUYWARTEN].rcSrc.right = 70 + 7; - Bmp[GUYWARTEN].rcSrc.top = 0; - Bmp[GUYWARTEN].rcSrc.bottom = 18; - Bmp[GUYWARTEN].Breite = 7; - Bmp[GUYWARTEN].Hoehe = 18; - - Bmp[GUYFELD].Anzahl = 4; - Bmp[GUYFELD].Geschwindigkeit = 4; - Bmp[GUYFELD].rcSrc.left = 78; - Bmp[GUYFELD].rcSrc.right = 78 + 19; - Bmp[GUYFELD].rcSrc.top = 0; - Bmp[GUYFELD].rcSrc.bottom = 18; - Bmp[GUYFELD].Breite = 19; - Bmp[GUYFELD].Hoehe = 18; - - Bmp[GUYBINDENOBEN].Anzahl = 2; - Bmp[GUYBINDENOBEN].Geschwindigkeit = 1; - Bmp[GUYBINDENOBEN].rcSrc.left = 97; - Bmp[GUYBINDENOBEN].rcSrc.right = 97 + 8; - Bmp[GUYBINDENOBEN].rcSrc.top = 0; - Bmp[GUYBINDENOBEN].rcSrc.bottom = 18; - Bmp[GUYBINDENOBEN].Breite = 8; - Bmp[GUYBINDENOBEN].Hoehe = 18; - - Bmp[GUYBINDENUNTEN].Anzahl = 2; - Bmp[GUYBINDENUNTEN].Geschwindigkeit = 1; - Bmp[GUYBINDENUNTEN].rcSrc.left = 98; - Bmp[GUYBINDENUNTEN].rcSrc.right = 98 + 7; - Bmp[GUYBINDENUNTEN].rcSrc.top = 36; - Bmp[GUYBINDENUNTEN].rcSrc.bottom = 36 + 18; - Bmp[GUYBINDENUNTEN].Breite = 7; - Bmp[GUYBINDENUNTEN].Hoehe = 18; - - Bmp[GUYSCHLAFZELT].Anzahl = 2; - Bmp[GUYSCHLAFZELT].Geschwindigkeit = 1; - Bmp[GUYSCHLAFZELT].rcSrc.left = 105; - Bmp[GUYSCHLAFZELT].rcSrc.right = 105 + 20; - Bmp[GUYSCHLAFZELT].rcSrc.top = 54; - Bmp[GUYSCHLAFZELT].rcSrc.bottom = 54 + 10; - Bmp[GUYSCHLAFZELT].Breite = 20; - Bmp[GUYSCHLAFZELT].Hoehe = 10; - Bmp[GUYSCHLAFZELT].Sound = Sound::SNORE; - - Bmp[GUYSCHLAFEN].Anzahl = 2; - Bmp[GUYSCHLAFEN].Geschwindigkeit = 1; - Bmp[GUYSCHLAFEN].rcSrc.left = 125; - Bmp[GUYSCHLAFEN].rcSrc.right = 125 + 17; - Bmp[GUYSCHLAFEN].rcSrc.top = 36; - Bmp[GUYSCHLAFEN].rcSrc.bottom = 36 + 18; - Bmp[GUYSCHLAFEN].Breite = 17; - Bmp[GUYSCHLAFEN].Hoehe = 18; - Bmp[GUYSCHLAFEN].Sound = Sound::SNORE; - - Bmp[GUYGEHINZELT].Anzahl = 3; - Bmp[GUYGEHINZELT].Geschwindigkeit = 4; - Bmp[GUYGEHINZELT].rcSrc.left = 105; - Bmp[GUYGEHINZELT].rcSrc.right = 105 + 7; - Bmp[GUYGEHINZELT].rcSrc.top = 0; - Bmp[GUYGEHINZELT].rcSrc.bottom = 0 + 18; - Bmp[GUYGEHINZELT].Breite = 7; - Bmp[GUYGEHINZELT].Hoehe = 18; - - Bmp[GUYHINLEGEN].Anzahl = 2; - Bmp[GUYHINLEGEN].Geschwindigkeit = 2; - Bmp[GUYHINLEGEN].rcSrc.left = 125; - Bmp[GUYHINLEGEN].rcSrc.right = 125 + 17; - Bmp[GUYHINLEGEN].rcSrc.top = 0; - Bmp[GUYHINLEGEN].rcSrc.bottom = 0 + 18; - Bmp[GUYHINLEGEN].Breite = 17; - Bmp[GUYHINLEGEN].Hoehe = 18; - - Bmp[GUYAUFSTEHEN].Anzahl = 2; - Bmp[GUYAUFSTEHEN].Geschwindigkeit = 2; - Bmp[GUYAUFSTEHEN].rcSrc.left = 142; - Bmp[GUYAUFSTEHEN].rcSrc.right = 142 + 9; - Bmp[GUYAUFSTEHEN].rcSrc.top = 0; - Bmp[GUYAUFSTEHEN].rcSrc.bottom = 0 + 18; - Bmp[GUYAUFSTEHEN].Breite = 9; - Bmp[GUYAUFSTEHEN].Hoehe = 18; - - Bmp[GUYANGELN1LINKS].Anzahl = 6; - Bmp[GUYANGELN1LINKS].Geschwindigkeit = 6; - Bmp[GUYANGELN1LINKS].rcSrc.left = 151; - Bmp[GUYANGELN1LINKS].rcSrc.right = 151 + 16; - Bmp[GUYANGELN1LINKS].rcSrc.top = 0; - Bmp[GUYANGELN1LINKS].rcSrc.bottom = 0 + 17; - Bmp[GUYANGELN1LINKS].Breite = 16; - Bmp[GUYANGELN1LINKS].Hoehe = 17; - - Bmp[GUYANGELN1OBEN].Anzahl = 6; - Bmp[GUYANGELN1OBEN].Geschwindigkeit = 6; - Bmp[GUYANGELN1OBEN].rcSrc.left = 167; - Bmp[GUYANGELN1OBEN].rcSrc.right = 167 + 16; - Bmp[GUYANGELN1OBEN].rcSrc.top = 0; - Bmp[GUYANGELN1OBEN].rcSrc.bottom = 0 + 17; - Bmp[GUYANGELN1OBEN].Breite = 16; - Bmp[GUYANGELN1OBEN].Hoehe = 17; - - Bmp[GUYANGELN1RECHTS].Anzahl = 6; - Bmp[GUYANGELN1RECHTS].Geschwindigkeit = 6; - Bmp[GUYANGELN1RECHTS].rcSrc.left = 183; - Bmp[GUYANGELN1RECHTS].rcSrc.right = 183 + 14; - Bmp[GUYANGELN1RECHTS].rcSrc.top = 0; - Bmp[GUYANGELN1RECHTS].rcSrc.bottom = 0 + 17; - Bmp[GUYANGELN1RECHTS].Breite = 14; - Bmp[GUYANGELN1RECHTS].Hoehe = 17; - - Bmp[GUYANGELN1UNTEN].Anzahl = 6; - Bmp[GUYANGELN1UNTEN].Geschwindigkeit = 6; - Bmp[GUYANGELN1UNTEN].rcSrc.left = 197; - Bmp[GUYANGELN1UNTEN].rcSrc.right = 197 + 14; - Bmp[GUYANGELN1UNTEN].rcSrc.top = 0; - Bmp[GUYANGELN1UNTEN].rcSrc.bottom = 0 + 17; - Bmp[GUYANGELN1UNTEN].Breite = 14; - Bmp[GUYANGELN1UNTEN].Hoehe = 17; - - Bmp[GUYANGELN2LINKS].Anzahl = 4; - Bmp[GUYANGELN2LINKS].Geschwindigkeit = 3; - Bmp[GUYANGELN2LINKS].rcSrc.left = 211; - Bmp[GUYANGELN2LINKS].rcSrc.right = 211 + 16; - Bmp[GUYANGELN2LINKS].rcSrc.top = 0; - Bmp[GUYANGELN2LINKS].rcSrc.bottom = 0 + 16; - Bmp[GUYANGELN2LINKS].Breite = 16; - Bmp[GUYANGELN2LINKS].Hoehe = 16; - - Bmp[GUYANGELN2OBEN].Anzahl = 4; - Bmp[GUYANGELN2OBEN].Geschwindigkeit = 3; - Bmp[GUYANGELN2OBEN].rcSrc.left = 227; - Bmp[GUYANGELN2OBEN].rcSrc.right = 227 + 16; - Bmp[GUYANGELN2OBEN].rcSrc.top = 0; - Bmp[GUYANGELN2OBEN].rcSrc.bottom = 0 + 16; - Bmp[GUYANGELN2OBEN].Breite = 16; - Bmp[GUYANGELN2OBEN].Hoehe = 16; - - Bmp[GUYANGELN2RECHTS].Anzahl = 4; - Bmp[GUYANGELN2RECHTS].Geschwindigkeit = 3; - Bmp[GUYANGELN2RECHTS].rcSrc.left = 243; - Bmp[GUYANGELN2RECHTS].rcSrc.right = 243 + 14; - Bmp[GUYANGELN2RECHTS].rcSrc.top = 0; - Bmp[GUYANGELN2RECHTS].rcSrc.bottom = 0 + 15; - Bmp[GUYANGELN2RECHTS].Breite = 14; - Bmp[GUYANGELN2RECHTS].Hoehe = 15; - - Bmp[GUYANGELN2UNTEN].Anzahl = 4; - Bmp[GUYANGELN2UNTEN].Geschwindigkeit = 3; - Bmp[GUYANGELN2UNTEN].rcSrc.left = 257; - Bmp[GUYANGELN2UNTEN].rcSrc.right = 257 + 14; - Bmp[GUYANGELN2UNTEN].rcSrc.top = 0; - Bmp[GUYANGELN2UNTEN].rcSrc.bottom = 0 + 15; - Bmp[GUYANGELN2UNTEN].Breite = 14; - Bmp[GUYANGELN2UNTEN].Hoehe = 15; - - Bmp[GUYANGELN3LINKS].Anzahl = 3; - Bmp[GUYANGELN3LINKS].Geschwindigkeit = 2; - Bmp[GUYANGELN3LINKS].rcSrc.left = 271; - Bmp[GUYANGELN3LINKS].rcSrc.right = 271 + 16; - Bmp[GUYANGELN3LINKS].rcSrc.top = 0; - Bmp[GUYANGELN3LINKS].rcSrc.bottom = 0 + 16; - Bmp[GUYANGELN3LINKS].Breite = 16; - Bmp[GUYANGELN3LINKS].Hoehe = 16; - - Bmp[GUYANGELN3OBEN].Anzahl = 3; - Bmp[GUYANGELN3OBEN].Geschwindigkeit = 2; - Bmp[GUYANGELN3OBEN].rcSrc.left = 285; - Bmp[GUYANGELN3OBEN].rcSrc.right = 285 + 16; - Bmp[GUYANGELN3OBEN].rcSrc.top = 0; - Bmp[GUYANGELN3OBEN].rcSrc.bottom = 0 + 16; - Bmp[GUYANGELN3OBEN].Breite = 16; - Bmp[GUYANGELN3OBEN].Hoehe = 16; - - Bmp[GUYANGELN3RECHTS].Anzahl = 3; - Bmp[GUYANGELN3RECHTS].Geschwindigkeit = 2; - Bmp[GUYANGELN3RECHTS].rcSrc.left = 299; - Bmp[GUYANGELN3RECHTS].rcSrc.right = 299 + 14; - Bmp[GUYANGELN3RECHTS].rcSrc.top = 0; - Bmp[GUYANGELN3RECHTS].rcSrc.bottom = 0 + 15; - Bmp[GUYANGELN3RECHTS].Breite = 14; - Bmp[GUYANGELN3RECHTS].Hoehe = 15; - - Bmp[GUYANGELN3UNTEN].Anzahl = 3; - Bmp[GUYANGELN3UNTEN].Geschwindigkeit = 2; - Bmp[GUYANGELN3UNTEN].rcSrc.left = 313; - Bmp[GUYANGELN3UNTEN].rcSrc.right = 313 + 14; - Bmp[GUYANGELN3UNTEN].rcSrc.top = 0; - Bmp[GUYANGELN3UNTEN].rcSrc.bottom = 0 + 15; - Bmp[GUYANGELN3UNTEN].Breite = 14; - Bmp[GUYANGELN3UNTEN].Hoehe = 15; - - Bmp[GUYSCHLAGEN].Anzahl = 4; - Bmp[GUYSCHLAGEN].Geschwindigkeit = 7; - Bmp[GUYSCHLAGEN].rcSrc.left = 327; - Bmp[GUYSCHLAGEN].rcSrc.right = 327 + 12; - Bmp[GUYSCHLAGEN].rcSrc.top = 0; - Bmp[GUYSCHLAGEN].rcSrc.bottom = 0 + 24; - Bmp[GUYSCHLAGEN].Breite = 12; - Bmp[GUYSCHLAGEN].Hoehe = 24; - Bmp[GUYSCHLAGEN].Sound = Sound::HIT; - - Bmp[GUYBOOTLINKS].Anzahl = 6; - Bmp[GUYBOOTLINKS].Geschwindigkeit = 10; - Bmp[GUYBOOTLINKS].rcSrc.left = 339; - Bmp[GUYBOOTLINKS].rcSrc.right = 339 + 26; - Bmp[GUYBOOTLINKS].rcSrc.top = 0; - Bmp[GUYBOOTLINKS].rcSrc.bottom = 0 + 21; - Bmp[GUYBOOTLINKS].Breite = 26; - Bmp[GUYBOOTLINKS].Hoehe = 21; - - Bmp[GUYBOOTOBEN].Anzahl = 6; - Bmp[GUYBOOTOBEN].Geschwindigkeit = 10; - Bmp[GUYBOOTOBEN].rcSrc.left = 365; - Bmp[GUYBOOTOBEN].rcSrc.right = 365 + 26; - Bmp[GUYBOOTOBEN].rcSrc.top = 0; - Bmp[GUYBOOTOBEN].rcSrc.bottom = 0 + 21; - Bmp[GUYBOOTOBEN].Breite = 26; - Bmp[GUYBOOTOBEN].Hoehe = 21; - - Bmp[GUYBOOTRECHTS].Anzahl = 6; - Bmp[GUYBOOTRECHTS].Geschwindigkeit = 10; - Bmp[GUYBOOTRECHTS].rcSrc.left = 391; - Bmp[GUYBOOTRECHTS].rcSrc.right = 391 + 26; - Bmp[GUYBOOTRECHTS].rcSrc.top = 0; - Bmp[GUYBOOTRECHTS].rcSrc.bottom = 0 + 21; - Bmp[GUYBOOTRECHTS].Breite = 26; - Bmp[GUYBOOTRECHTS].Hoehe = 21; - - Bmp[GUYBOOTUNTEN].Anzahl = 6; - Bmp[GUYBOOTUNTEN].Geschwindigkeit = 10; - Bmp[GUYBOOTUNTEN].rcSrc.left = 417; - Bmp[GUYBOOTUNTEN].rcSrc.right = 417 + 26; - Bmp[GUYBOOTUNTEN].rcSrc.top = 0; - Bmp[GUYBOOTUNTEN].rcSrc.bottom = 0 + 21; - Bmp[GUYBOOTUNTEN].Breite = 26; - Bmp[GUYBOOTUNTEN].Hoehe = 21; - - Bmp[GUYBOOTANGELN1].Anzahl = 6; - Bmp[GUYBOOTANGELN1].Geschwindigkeit = 6; - Bmp[GUYBOOTANGELN1].rcSrc.left = 443; - Bmp[GUYBOOTANGELN1].rcSrc.right = 443 + 26; - Bmp[GUYBOOTANGELN1].rcSrc.top = 0; - Bmp[GUYBOOTANGELN1].rcSrc.bottom = 0 + 25; - Bmp[GUYBOOTANGELN1].Breite = 26; - Bmp[GUYBOOTANGELN1].Hoehe = 25; - - Bmp[GUYBOOTANGELN2].Anzahl = 4; - Bmp[GUYBOOTANGELN2].Geschwindigkeit = 3; - Bmp[GUYBOOTANGELN2].rcSrc.left = 469; - Bmp[GUYBOOTANGELN2].rcSrc.right = 469 + 26; - Bmp[GUYBOOTANGELN2].rcSrc.top = 0; - Bmp[GUYBOOTANGELN2].rcSrc.bottom = 0 + 25; - Bmp[GUYBOOTANGELN2].Breite = 26; - Bmp[GUYBOOTANGELN2].Hoehe = 25; - - Bmp[GUYBOOTANGELN3].Anzahl = 3; - Bmp[GUYBOOTANGELN3].Geschwindigkeit = 2; - Bmp[GUYBOOTANGELN3].rcSrc.left = 495; - Bmp[GUYBOOTANGELN3].rcSrc.right = 495 + 26; - Bmp[GUYBOOTANGELN3].rcSrc.top = 0; - Bmp[GUYBOOTANGELN3].rcSrc.bottom = 0 + 25; - Bmp[GUYBOOTANGELN3].Breite = 26; - Bmp[GUYBOOTANGELN3].Hoehe = 25; - - Bmp[GUYTAUCHEN1].Anzahl = 5; - Bmp[GUYTAUCHEN1].Geschwindigkeit = 5; - Bmp[GUYTAUCHEN1].rcSrc.left = 521; - Bmp[GUYTAUCHEN1].rcSrc.right = 521 + 26; - Bmp[GUYTAUCHEN1].rcSrc.top = 0; - Bmp[GUYTAUCHEN1].rcSrc.bottom = 0 + 27; - Bmp[GUYTAUCHEN1].Breite = 26; - Bmp[GUYTAUCHEN1].Hoehe = 27; - - Bmp[GUYTAUCHEN2].Anzahl = 4; - Bmp[GUYTAUCHEN2].Geschwindigkeit = 3; - Bmp[GUYTAUCHEN2].rcSrc.left = 547; - Bmp[GUYTAUCHEN2].rcSrc.right = 547 + 26; - Bmp[GUYTAUCHEN2].rcSrc.top = 0; - Bmp[GUYTAUCHEN2].rcSrc.bottom = 0 + 17; - Bmp[GUYTAUCHEN2].Breite = 26; - Bmp[GUYTAUCHEN2].Hoehe = 17; - - Bmp[GUYTAUCHEN3].Anzahl = 2; - Bmp[GUYTAUCHEN3].Geschwindigkeit = 2; - Bmp[GUYTAUCHEN3].rcSrc.left = 573; - Bmp[GUYTAUCHEN3].rcSrc.right = 573 + 26; - Bmp[GUYTAUCHEN3].rcSrc.top = 0; - Bmp[GUYTAUCHEN3].rcSrc.bottom = 0 + 17; - Bmp[GUYTAUCHEN3].Breite = 26; - Bmp[GUYTAUCHEN3].Hoehe = 17; - - Bmp[GUYHAMMER].Anzahl = 2; - Bmp[GUYHAMMER].Geschwindigkeit = 4; - Bmp[GUYHAMMER].rcSrc.left = 599; - Bmp[GUYHAMMER].rcSrc.right = 599 + 9; - Bmp[GUYHAMMER].rcSrc.top = 0; - Bmp[GUYHAMMER].rcSrc.bottom = 0 + 18; - Bmp[GUYHAMMER].Breite = 9; - Bmp[GUYHAMMER].Hoehe = 18; - Bmp[GUYHAMMER].Sound = Sound::HAMMER; - - Bmp[GUYKLETTERN1].Anzahl = 6; - Bmp[GUYKLETTERN1].Geschwindigkeit = 2; - Bmp[GUYKLETTERN1].rcSrc.left = 608; - Bmp[GUYKLETTERN1].rcSrc.right = 608 + 7; - Bmp[GUYKLETTERN1].rcSrc.top = 0; - Bmp[GUYKLETTERN1].rcSrc.bottom = 0 + 34; - Bmp[GUYKLETTERN1].Breite = 7; - Bmp[GUYKLETTERN1].Hoehe = 34; - - Bmp[GUYKLETTERN2].Anzahl = 6; - Bmp[GUYKLETTERN2].Geschwindigkeit = 2; - Bmp[GUYKLETTERN2].rcSrc.left = 615; - Bmp[GUYKLETTERN2].rcSrc.right = 615 + 7; - Bmp[GUYKLETTERN2].rcSrc.top = 0; - Bmp[GUYKLETTERN2].rcSrc.bottom = 0 + 34; - Bmp[GUYKLETTERN2].Breite = 7; - Bmp[GUYKLETTERN2].Hoehe = 34; - - Bmp[GUYHAMMER2].Anzahl = 2; - Bmp[GUYHAMMER2].Geschwindigkeit = 4; - Bmp[GUYHAMMER2].rcSrc.left = 622; - Bmp[GUYHAMMER2].rcSrc.right = 622 + 7; - Bmp[GUYHAMMER2].rcSrc.top = 0; - Bmp[GUYHAMMER2].rcSrc.bottom = 0 + 34; - Bmp[GUYHAMMER2].Breite = 7; - Bmp[GUYHAMMER2].Hoehe = 34; - Bmp[GUYHAMMER2].Sound = Sound::HAMMER; - - Bmp[GUYGEHINHAUS].Anzahl = 3; - Bmp[GUYGEHINHAUS].Geschwindigkeit = 2; - Bmp[GUYGEHINHAUS].rcSrc.left = 631; - Bmp[GUYGEHINHAUS].rcSrc.right = 631 + 9; - Bmp[GUYGEHINHAUS].rcSrc.top = 0; - Bmp[GUYGEHINHAUS].rcSrc.bottom = 0 + 34; - Bmp[GUYGEHINHAUS].Breite = 9; - Bmp[GUYGEHINHAUS].Hoehe = 34; - - Bmp[GUYSCHLAFHAUS].Anzahl = 2; - Bmp[GUYSCHLAFHAUS].Geschwindigkeit = 1; - Bmp[GUYSCHLAFHAUS].rcSrc.left = 640; - Bmp[GUYSCHLAFHAUS].rcSrc.right = 640 + 10; - Bmp[GUYSCHLAFHAUS].rcSrc.top = 0; - Bmp[GUYSCHLAFHAUS].rcSrc.bottom = 0 + 34; - Bmp[GUYSCHLAFHAUS].Breite = 10; - Bmp[GUYSCHLAFHAUS].Hoehe = 34; - Bmp[GUYSCHLAFHAUS].Sound = Sound::SNORE; - - Bmp[GUYGEHAUSHAUS].Anzahl = 3; - Bmp[GUYGEHAUSHAUS].Geschwindigkeit = 2; - Bmp[GUYGEHAUSHAUS].rcSrc.left = 650; - Bmp[GUYGEHAUSHAUS].rcSrc.right = 650 + 9; - Bmp[GUYGEHAUSHAUS].rcSrc.top = 0; - Bmp[GUYGEHAUSHAUS].rcSrc.bottom = 0 + 34; - Bmp[GUYGEHAUSHAUS].Breite = 9; - Bmp[GUYGEHAUSHAUS].Hoehe = 34; - - Bmp[GUYANZUENDEN].Anzahl = 6; - Bmp[GUYANZUENDEN].Geschwindigkeit = 5; - Bmp[GUYANZUENDEN].rcSrc.left = 659; - Bmp[GUYANZUENDEN].rcSrc.right = 659 + 19; - Bmp[GUYANZUENDEN].rcSrc.top = 0; - Bmp[GUYANZUENDEN].rcSrc.bottom = 0 + 18; - Bmp[GUYANZUENDEN].Breite = 19; - Bmp[GUYANZUENDEN].Hoehe = 18; - - Bmp[GUYAUSSCHAU].Anzahl = 4; - Bmp[GUYAUSSCHAU].Geschwindigkeit = 1; - Bmp[GUYAUSSCHAU].rcSrc.left = 678; - Bmp[GUYAUSSCHAU].rcSrc.right = 678 + 10; - Bmp[GUYAUSSCHAU].rcSrc.top = 0; - Bmp[GUYAUSSCHAU].rcSrc.bottom = 0 + 18; - Bmp[GUYAUSSCHAU].Breite = 10; - Bmp[GUYAUSSCHAU].Hoehe = 18; - - Bmp[GUYSCHAUFELN].Anzahl = 10; - Bmp[GUYSCHAUFELN].Geschwindigkeit = 3; - Bmp[GUYSCHAUFELN].rcSrc.left = 688; - Bmp[GUYSCHAUFELN].rcSrc.right = 688 + 17; - Bmp[GUYSCHAUFELN].rcSrc.top = 0; - Bmp[GUYSCHAUFELN].rcSrc.bottom = 0 + 19; - Bmp[GUYSCHAUFELN].Breite = 17; - Bmp[GUYSCHAUFELN].Hoehe = 19; - Bmp[GUYSCHAUFELN].Sound = Sound::DIG; - - Bmp[GUYSCHIFF].Anzahl = 4; - Bmp[GUYSCHIFF].Geschwindigkeit = 10; - Bmp[GUYSCHIFF].rcSrc.left = 297; - Bmp[GUYSCHIFF].rcSrc.right = 297 + 48; - Bmp[GUYSCHIFF].rcSrc.top = 0; - Bmp[GUYSCHIFF].rcSrc.bottom = 0 + 38; - Bmp[GUYSCHIFF].Breite = 48; - Bmp[GUYSCHIFF].Hoehe = 38; - Bmp[GUYSCHIFF].Surface = lpDDSBau; - Bmp[GUYSCHIFF].Sound = Sound::STORM; - - Bmp[GUYSCHIFFDOWN].Anzahl = 6; - Bmp[GUYSCHIFFDOWN].Geschwindigkeit = 3; - Bmp[GUYSCHIFFDOWN].rcSrc.left = 345; - Bmp[GUYSCHIFFDOWN].rcSrc.right = 345 + 46; - Bmp[GUYSCHIFFDOWN].rcSrc.top = 0; - Bmp[GUYSCHIFFDOWN].rcSrc.bottom = 0 + 40; - Bmp[GUYSCHIFFDOWN].Breite = 46; - Bmp[GUYSCHIFFDOWN].Hoehe = 40; - Bmp[GUYSCHIFFDOWN].Surface = lpDDSBau; - Bmp[GUYSCHIFFDOWN].Sound = Sound::SPLAT; - - Bmp[GUYSCHWIMMEN].Anzahl = 4; - Bmp[GUYSCHWIMMEN].Geschwindigkeit = 10; - Bmp[GUYSCHWIMMEN].rcSrc.left = 705; - Bmp[GUYSCHWIMMEN].rcSrc.right = 705 + 15; - Bmp[GUYSCHWIMMEN].rcSrc.top = 0; - Bmp[GUYSCHWIMMEN].rcSrc.bottom = 0 + 9; - Bmp[GUYSCHWIMMEN].Breite = 15; - Bmp[GUYSCHWIMMEN].Hoehe = 9; - Bmp[GUYSCHWIMMEN].Sound = Sound::SWIM; - - Bmp[GUYTOD].Anzahl = 6; - Bmp[GUYTOD].Geschwindigkeit = 1; - Bmp[GUYTOD].rcSrc.left = 743; - Bmp[GUYTOD].rcSrc.right = 743 + 16; - Bmp[GUYTOD].rcSrc.top = 0; - Bmp[GUYTOD].rcSrc.bottom = 0 + 10; - Bmp[GUYTOD].Breite = 16; - Bmp[GUYTOD].Hoehe = 10; - - Bmp[GUYBOOTTOD].Anzahl = 6; - Bmp[GUYBOOTTOD].Geschwindigkeit = 1; - Bmp[GUYBOOTTOD].rcSrc.left = 759; - Bmp[GUYBOOTTOD].rcSrc.right = 759 + 26; - Bmp[GUYBOOTTOD].rcSrc.top = 0; - Bmp[GUYBOOTTOD].rcSrc.bottom = 0 + 18; - Bmp[GUYBOOTTOD].Breite = 26; - Bmp[GUYBOOTTOD].Hoehe = 18; - - Bmp[GUYBOOTWARTEN].Anzahl = 4; - Bmp[GUYBOOTWARTEN].Geschwindigkeit = 2; - Bmp[GUYBOOTWARTEN].rcSrc.left = 0; - Bmp[GUYBOOTWARTEN].rcSrc.right = 0 + 26; - Bmp[GUYBOOTWARTEN].rcSrc.top = 72; - Bmp[GUYBOOTWARTEN].rcSrc.bottom = 72 + 18; - Bmp[GUYBOOTWARTEN].Breite = 26; - Bmp[GUYBOOTWARTEN].Hoehe = 20; - - Bmp[GUYSCHLEUDER].Anzahl = 5; - Bmp[GUYSCHLEUDER].Geschwindigkeit = 4; - Bmp[GUYSCHLEUDER].rcSrc.left = 720; - Bmp[GUYSCHLEUDER].rcSrc.right = 720 + 23; - Bmp[GUYSCHLEUDER].rcSrc.top = 0; - Bmp[GUYSCHLEUDER].rcSrc.bottom = 0 + 20; - Bmp[GUYSCHLEUDER].Breite = 23; - Bmp[GUYSCHLEUDER].Hoehe = 20; - - // Cursor - for (i = CUPFEIL; i <= CUUHR; i++) - { - Bmp[i].Animation = false; - Bmp[i].Anzahl = 1; - Bmp[i].Geschwindigkeit = 0; - Bmp[i].Phase = 0; - Bmp[i].Surface = lpDDSCursor; - Bmp[i].rcSrc.left = (i - CUPFEIL) * 18; - Bmp[i].rcSrc.top = 0; - Bmp[i].rcSrc.right = Bmp[i].rcSrc.left + 18; - Bmp[i].rcSrc.bottom = 18; - Bmp[i].Breite = 18; - Bmp[i].Hoehe = 18; - } + ifs.read(reinterpret_cast(Landscape), sizeof(Landscape)); + ifs.read(reinterpret_cast(&Guy), sizeof(Guy)); + ifs.read(reinterpret_cast(&IsInBoat), sizeof(IsInBoat)); + ifs.read(reinterpret_cast(&Camera), sizeof(Camera)); + ifs.read(reinterpret_cast(&Chance), sizeof(Chance)); + ifs.read(reinterpret_cast(&Gitter), sizeof(Gitter)); + ifs.read(reinterpret_cast(&HauptMenue), sizeof(HauptMenue)); + ifs.read(reinterpret_cast(&LAnimation), sizeof(LAnimation)); + ifs.read(reinterpret_cast(&Minutes), sizeof(Minutes)); + ifs.read(reinterpret_cast(&ScapeGrenze), sizeof(ScapeGrenze)); + ifs.read(reinterpret_cast(&SchatzPos), sizeof(SchatzPos)); + ifs.read(reinterpret_cast(&s_GameState), sizeof(s_GameState)); + ifs.read(reinterpret_cast(&Hours), sizeof(Hours)); + ifs.read(reinterpret_cast(&Tag), sizeof(Tag)); + ifs.read(reinterpret_cast(TextBereich), sizeof(TextBereich)); + ifs.read(reinterpret_cast(&SchatzGef), sizeof(SchatzGef)); + + for (short i = 0; i < SPRITE_COUNT; i++) { + ifs.read(reinterpret_cast(&Bmp[i].IsAnimationRunning), sizeof(Bmp[i].IsAnimationRunning)); + ifs.read(reinterpret_cast(&Bmp[i].AnimationPhase), sizeof(Bmp[i].AnimationPhase)); + ifs.read(reinterpret_cast(&Bmp[i].First), sizeof(Bmp[i].First)); + } - // Landschaftsanimationen - for (i = MEERWELLEN; i <= SCHLEUSE6; i++) - { - Bmp[i].Animation = true; - Bmp[i].Anzahl = 7; - Bmp[i].Geschwindigkeit = 7; - Bmp[i].Phase = 0; - Bmp[i].Surface = lpDDSAnimation; - Bmp[i].Sound = Sound::RIVER; - } + return (true); +} - Bmp[MEERWELLEN].Geschwindigkeit = 3; - Bmp[MEERWELLEN].Breite = 28; - Bmp[MEERWELLEN].Hoehe = 13; - Bmp[MEERWELLEN].rcSrc.left = 0; - Bmp[MEERWELLEN].rcSrc.right = Bmp[MEERWELLEN].rcSrc.left + Bmp[MEERWELLEN].Breite; - Bmp[MEERWELLEN].rcSrc.top = 0; - Bmp[MEERWELLEN].rcSrc.bottom = Bmp[MEERWELLEN].rcSrc.top + Bmp[MEERWELLEN].Hoehe; - Bmp[MEERWELLEN].rcDes.left = 9; - Bmp[MEERWELLEN].rcDes.right = Bmp[MEERWELLEN].rcDes.left + Bmp[MEERWELLEN].Breite; - Bmp[MEERWELLEN].rcDes.top = 23; - Bmp[MEERWELLEN].rcDes.bottom = Bmp[MEERWELLEN].rcDes.top + Bmp[MEERWELLEN].Hoehe; - Bmp[MEERWELLEN].Sound = Sound::SURF; - - Bmp[FLUSS1].Breite = 34; - Bmp[FLUSS1].Hoehe = 8; - Bmp[FLUSS1].rcSrc.left = 28; - Bmp[FLUSS1].rcSrc.right = Bmp[FLUSS1].rcSrc.left + Bmp[FLUSS1].Breite; - Bmp[FLUSS1].rcSrc.top = 0; - Bmp[FLUSS1].rcSrc.bottom = Bmp[FLUSS1].rcSrc.top + Bmp[FLUSS1].Hoehe; - Bmp[FLUSS1].rcDes.left = 10; - Bmp[FLUSS1].rcDes.right = Bmp[FLUSS1].rcDes.left + Bmp[FLUSS1].Breite; - Bmp[FLUSS1].rcDes.top = 18; - Bmp[FLUSS1].rcDes.bottom = Bmp[FLUSS1].rcDes.top + Bmp[FLUSS1].Hoehe; - - Bmp[FLUSS2].Breite = 34; - Bmp[FLUSS2].Hoehe = 8; - Bmp[FLUSS2].rcSrc.left = 62; - Bmp[FLUSS2].rcSrc.right = Bmp[FLUSS2].rcSrc.left + Bmp[FLUSS2].Breite; - Bmp[FLUSS2].rcSrc.top = 0; - Bmp[FLUSS2].rcSrc.bottom = Bmp[FLUSS2].rcSrc.top + Bmp[FLUSS2].Hoehe; - Bmp[FLUSS2].rcDes.left = 10; - Bmp[FLUSS2].rcDes.right = Bmp[FLUSS2].rcDes.left + Bmp[FLUSS2].Breite; - Bmp[FLUSS2].rcDes.top = 19; - Bmp[FLUSS2].rcDes.bottom = Bmp[FLUSS2].rcDes.top + Bmp[FLUSS2].Hoehe; - - Bmp[FLUSS3].Breite = 34; - Bmp[FLUSS3].Hoehe = 34; - Bmp[FLUSS3].rcSrc.left = 96; - Bmp[FLUSS3].rcSrc.right = Bmp[FLUSS3].rcSrc.left + Bmp[FLUSS3].Breite; - Bmp[FLUSS3].rcSrc.top = 0; - Bmp[FLUSS3].rcSrc.bottom = Bmp[FLUSS3].rcSrc.top + Bmp[FLUSS3].Hoehe; - Bmp[FLUSS3].rcDes.left = 10; - Bmp[FLUSS3].rcDes.right = Bmp[FLUSS3].rcDes.left + Bmp[FLUSS3].Breite; - Bmp[FLUSS3].rcDes.top = 5; - Bmp[FLUSS3].rcDes.bottom = Bmp[FLUSS3].rcDes.top + Bmp[FLUSS3].Hoehe; - - Bmp[FLUSS4].Breite = 34; - Bmp[FLUSS4].Hoehe = 34; - Bmp[FLUSS4].rcSrc.left = 130; - Bmp[FLUSS4].rcSrc.right = Bmp[FLUSS4].rcSrc.left + Bmp[FLUSS4].Breite; - Bmp[FLUSS4].rcSrc.top = 0; - Bmp[FLUSS4].rcSrc.bottom = Bmp[FLUSS4].rcSrc.top + Bmp[FLUSS4].Hoehe; - Bmp[FLUSS4].rcDes.left = 10; - Bmp[FLUSS4].rcDes.right = Bmp[FLUSS4].rcDes.left + Bmp[FLUSS4].Breite; - Bmp[FLUSS4].rcDes.top = 5; - Bmp[FLUSS4].rcDes.bottom = Bmp[FLUSS4].rcDes.top + Bmp[FLUSS4].Hoehe; - - Bmp[FLUSS5].Breite = 34; - Bmp[FLUSS5].Hoehe = 18; - Bmp[FLUSS5].rcSrc.left = 164; - Bmp[FLUSS5].rcSrc.right = Bmp[FLUSS5].rcSrc.left + Bmp[FLUSS5].Breite; - Bmp[FLUSS5].rcSrc.top = 0; - Bmp[FLUSS5].rcSrc.bottom = Bmp[FLUSS5].rcSrc.top + Bmp[FLUSS5].Hoehe; - Bmp[FLUSS5].rcDes.left = 10; - Bmp[FLUSS5].rcDes.right = Bmp[FLUSS5].rcDes.left + Bmp[FLUSS5].Breite; - Bmp[FLUSS5].rcDes.top = 21; - Bmp[FLUSS5].rcDes.bottom = Bmp[FLUSS5].rcDes.top + Bmp[FLUSS5].Hoehe; - - Bmp[FLUSS6].Breite = 34; - Bmp[FLUSS6].Hoehe = 18; - Bmp[FLUSS6].rcSrc.left = 198; - Bmp[FLUSS6].rcSrc.right = Bmp[FLUSS6].rcSrc.left + Bmp[FLUSS6].Breite; - Bmp[FLUSS6].rcSrc.top = 0; - Bmp[FLUSS6].rcSrc.bottom = Bmp[FLUSS6].rcSrc.top + Bmp[FLUSS6].Hoehe; - Bmp[FLUSS6].rcDes.left = 10; - Bmp[FLUSS6].rcDes.right = Bmp[FLUSS6].rcDes.left + Bmp[FLUSS6].Breite; - Bmp[FLUSS6].rcDes.top = 21; - Bmp[FLUSS6].rcDes.bottom = Bmp[FLUSS6].rcDes.top + Bmp[FLUSS6].Hoehe; - - Bmp[FLUSS7].Breite = 18; - Bmp[FLUSS7].Hoehe = 18; - Bmp[FLUSS7].rcSrc.left = 232; - Bmp[FLUSS7].rcSrc.right = Bmp[FLUSS7].rcSrc.left + Bmp[FLUSS7].Breite; - Bmp[FLUSS7].rcSrc.top = 0; - Bmp[FLUSS7].rcSrc.bottom = Bmp[FLUSS7].rcSrc.top + Bmp[FLUSS7].Hoehe; - Bmp[FLUSS7].rcDes.left = 10; - Bmp[FLUSS7].rcDes.right = Bmp[FLUSS7].rcDes.left + Bmp[FLUSS7].Breite; - Bmp[FLUSS7].rcDes.top = 21; - Bmp[FLUSS7].rcDes.bottom = Bmp[FLUSS7].rcDes.top + Bmp[FLUSS7].Hoehe; - - Bmp[FLUSS8].Breite = 18; - Bmp[FLUSS8].Hoehe = 18; - Bmp[FLUSS8].rcSrc.left = 250; - Bmp[FLUSS8].rcSrc.right = Bmp[FLUSS8].rcSrc.left + Bmp[FLUSS8].Breite; - Bmp[FLUSS8].rcSrc.top = 0; - Bmp[FLUSS8].rcSrc.bottom = Bmp[FLUSS8].rcSrc.top + Bmp[FLUSS8].Hoehe; - Bmp[FLUSS8].rcDes.left = 26; - Bmp[FLUSS8].rcDes.right = Bmp[FLUSS8].rcDes.left + Bmp[FLUSS8].Breite; - Bmp[FLUSS8].rcDes.top = 21; - Bmp[FLUSS8].rcDes.bottom = Bmp[FLUSS8].rcDes.top + Bmp[FLUSS8].Hoehe; - - Bmp[FLUSS9].Breite = 34; - Bmp[FLUSS9].Hoehe = 15; - Bmp[FLUSS9].rcSrc.left = 268; - Bmp[FLUSS9].rcSrc.right = Bmp[FLUSS9].rcSrc.left + Bmp[FLUSS9].Breite; - Bmp[FLUSS9].rcSrc.top = 0; - Bmp[FLUSS9].rcSrc.bottom = Bmp[FLUSS9].rcSrc.top + Bmp[FLUSS9].Hoehe; - Bmp[FLUSS9].rcDes.left = 10; - Bmp[FLUSS9].rcDes.right = Bmp[FLUSS9].rcDes.left + Bmp[FLUSS9].Breite; - Bmp[FLUSS9].rcDes.top = 20; - Bmp[FLUSS9].rcDes.bottom = Bmp[FLUSS9].rcDes.top + Bmp[FLUSS9].Hoehe; - - Bmp[FLUSS10].Breite = 34; - Bmp[FLUSS10].Hoehe = 13; - Bmp[FLUSS10].rcSrc.left = 302; - Bmp[FLUSS10].rcSrc.right = Bmp[FLUSS10].rcSrc.left + Bmp[FLUSS10].Breite; - Bmp[FLUSS10].rcSrc.top = 0; - Bmp[FLUSS10].rcSrc.bottom = Bmp[FLUSS10].rcSrc.top + Bmp[FLUSS10].Hoehe; - Bmp[FLUSS10].rcDes.left = 10; - Bmp[FLUSS10].rcDes.right = Bmp[FLUSS10].rcDes.left + Bmp[FLUSS10].Breite; - Bmp[FLUSS10].rcDes.top = 26; - Bmp[FLUSS10].rcDes.bottom = Bmp[FLUSS10].rcDes.top + Bmp[FLUSS10].Hoehe; - - Bmp[MUENDUNG1].Breite = 42; - Bmp[MUENDUNG1].Hoehe = 22; - Bmp[MUENDUNG1].rcSrc.left = 336; - Bmp[MUENDUNG1].rcSrc.right = Bmp[MUENDUNG1].rcSrc.left + Bmp[MUENDUNG1].Breite; - Bmp[MUENDUNG1].rcSrc.top = 0; - Bmp[MUENDUNG1].rcSrc.bottom = Bmp[MUENDUNG1].rcSrc.top + Bmp[MUENDUNG1].Hoehe; - Bmp[MUENDUNG1].rcDes.left = 2; - Bmp[MUENDUNG1].rcDes.right = Bmp[MUENDUNG1].rcDes.left + Bmp[MUENDUNG1].Breite; - Bmp[MUENDUNG1].rcDes.top = 17; - Bmp[MUENDUNG1].rcDes.bottom = Bmp[MUENDUNG1].rcDes.top + Bmp[MUENDUNG1].Hoehe; - - Bmp[MUENDUNG2].Breite = 40; - Bmp[MUENDUNG2].Hoehe = 22; - Bmp[MUENDUNG2].rcSrc.left = 378; - Bmp[MUENDUNG2].rcSrc.right = Bmp[MUENDUNG2].rcSrc.left + Bmp[MUENDUNG2].Breite; - Bmp[MUENDUNG2].rcSrc.top = 0; - Bmp[MUENDUNG2].rcSrc.bottom = Bmp[MUENDUNG2].rcSrc.top + Bmp[MUENDUNG2].Hoehe; - Bmp[MUENDUNG2].rcDes.left = 10; - Bmp[MUENDUNG2].rcDes.right = Bmp[MUENDUNG2].rcDes.left + Bmp[MUENDUNG2].Breite; - Bmp[MUENDUNG2].rcDes.top = 17; - Bmp[MUENDUNG2].rcDes.bottom = Bmp[MUENDUNG2].rcDes.top + Bmp[MUENDUNG2].Hoehe; - - Bmp[MUENDUNG3].Breite = 40; - Bmp[MUENDUNG3].Hoehe = 22; - Bmp[MUENDUNG3].rcSrc.left = 418; - Bmp[MUENDUNG3].rcSrc.right = Bmp[MUENDUNG3].rcSrc.left + Bmp[MUENDUNG3].Breite; - Bmp[MUENDUNG3].rcSrc.top = 0; - Bmp[MUENDUNG3].rcSrc.bottom = Bmp[MUENDUNG3].rcSrc.top + Bmp[MUENDUNG3].Hoehe; - Bmp[MUENDUNG3].rcDes.left = 10; - Bmp[MUENDUNG3].rcDes.right = Bmp[MUENDUNG3].rcDes.left + Bmp[MUENDUNG3].Breite; - Bmp[MUENDUNG3].rcDes.top = 21; - Bmp[MUENDUNG3].rcDes.bottom = Bmp[MUENDUNG3].rcDes.top + Bmp[MUENDUNG3].Hoehe; - - Bmp[MUENDUNG4].Breite = 42; - Bmp[MUENDUNG4].Hoehe = 22; - Bmp[MUENDUNG4].rcSrc.left = 458; - Bmp[MUENDUNG4].rcSrc.right = Bmp[MUENDUNG4].rcSrc.left + Bmp[MUENDUNG4].Breite; - Bmp[MUENDUNG4].rcSrc.top = 0; - Bmp[MUENDUNG4].rcSrc.bottom = Bmp[MUENDUNG4].rcSrc.top + Bmp[MUENDUNG4].Hoehe; - Bmp[MUENDUNG4].rcDes.left = 2; - Bmp[MUENDUNG4].rcDes.right = Bmp[MUENDUNG4].rcDes.left + Bmp[MUENDUNG4].Breite; - Bmp[MUENDUNG4].rcDes.top = 21; - Bmp[MUENDUNG4].rcDes.bottom = Bmp[MUENDUNG4].rcDes.top + Bmp[MUENDUNG4].Hoehe; - - Bmp[QUELLE1].Breite = 30; - Bmp[QUELLE1].Hoehe = 19; - Bmp[QUELLE1].rcSrc.left = 500; - Bmp[QUELLE1].rcSrc.right = Bmp[QUELLE1].rcSrc.left + Bmp[QUELLE1].Breite; - Bmp[QUELLE1].rcSrc.top = 0; - Bmp[QUELLE1].rcSrc.bottom = Bmp[QUELLE1].rcSrc.top + Bmp[QUELLE1].Hoehe; - Bmp[QUELLE1].rcDes.left = 16; - Bmp[QUELLE1].rcDes.right = Bmp[QUELLE1].rcDes.left + Bmp[QUELLE1].Breite; - Bmp[QUELLE1].rcDes.top = 19; - Bmp[QUELLE1].rcDes.bottom = Bmp[QUELLE1].rcDes.top + Bmp[QUELLE1].Hoehe; - - Bmp[QUELLE2].Breite = 26; - Bmp[QUELLE2].Hoehe = 19; - Bmp[QUELLE2].rcSrc.left = 530; - Bmp[QUELLE2].rcSrc.right = Bmp[QUELLE2].rcSrc.left + Bmp[QUELLE2].Breite; - Bmp[QUELLE2].rcSrc.top = 0; - Bmp[QUELLE2].rcSrc.bottom = Bmp[QUELLE2].rcSrc.top + Bmp[QUELLE2].Hoehe; - Bmp[QUELLE2].rcDes.left = 9; - Bmp[QUELLE2].rcDes.right = Bmp[QUELLE2].rcDes.left + Bmp[QUELLE2].Breite; - Bmp[QUELLE2].rcDes.top = 20; - Bmp[QUELLE2].rcDes.bottom = Bmp[QUELLE2].rcDes.top + Bmp[QUELLE2].Hoehe; - - Bmp[QUELLE3].Breite = 25; - Bmp[QUELLE3].Hoehe = 16; - Bmp[QUELLE3].rcSrc.left = 556; - Bmp[QUELLE3].rcSrc.right = Bmp[QUELLE3].rcSrc.left + Bmp[QUELLE3].Breite; - Bmp[QUELLE3].rcSrc.top = 0; - Bmp[QUELLE3].rcSrc.bottom = Bmp[QUELLE3].rcSrc.top + Bmp[QUELLE3].Hoehe; - Bmp[QUELLE3].rcDes.left = 19; - Bmp[QUELLE3].rcDes.right = Bmp[QUELLE3].rcDes.left + Bmp[QUELLE3].Breite; - Bmp[QUELLE3].rcDes.top = 19; - Bmp[QUELLE3].rcDes.bottom = Bmp[QUELLE3].rcDes.top + Bmp[QUELLE3].Hoehe; - - Bmp[QUELLE4].Breite = 25; - Bmp[QUELLE4].Hoehe = 15; - Bmp[QUELLE4].rcSrc.left = 581; - Bmp[QUELLE4].rcSrc.right = Bmp[QUELLE4].rcSrc.left + Bmp[QUELLE4].Breite; - Bmp[QUELLE4].rcSrc.top = 0; - Bmp[QUELLE4].rcSrc.bottom = Bmp[QUELLE4].rcSrc.top + Bmp[QUELLE4].Hoehe; - Bmp[QUELLE4].rcDes.left = 8; - Bmp[QUELLE4].rcDes.right = Bmp[QUELLE4].rcDes.left + Bmp[QUELLE4].Breite; - Bmp[QUELLE4].rcDes.top = 21; - Bmp[QUELLE4].rcDes.bottom = Bmp[QUELLE4].rcDes.top + Bmp[QUELLE4].Hoehe; - - Bmp[SCHLEUSE1].Breite = 35; - Bmp[SCHLEUSE1].Hoehe = 22; - Bmp[SCHLEUSE1].rcSrc.left = 164; - Bmp[SCHLEUSE1].rcSrc.right = Bmp[SCHLEUSE1].rcSrc.left + Bmp[SCHLEUSE1].Breite; - Bmp[SCHLEUSE1].rcSrc.top = 126; - Bmp[SCHLEUSE1].rcSrc.bottom = Bmp[SCHLEUSE1].rcSrc.top + Bmp[SCHLEUSE1].Hoehe; - Bmp[SCHLEUSE1].rcDes.left = 10; - Bmp[SCHLEUSE1].rcDes.right = Bmp[SCHLEUSE1].rcDes.left + Bmp[SCHLEUSE1].Breite; - Bmp[SCHLEUSE1].rcDes.top = 17; - Bmp[SCHLEUSE1].rcDes.bottom = Bmp[SCHLEUSE1].rcDes.top + Bmp[SCHLEUSE1].Hoehe; - - Bmp[SCHLEUSE2].Breite = 34; - Bmp[SCHLEUSE2].Hoehe = 23; - Bmp[SCHLEUSE2].rcSrc.left = 199; - Bmp[SCHLEUSE2].rcSrc.right = Bmp[SCHLEUSE2].rcSrc.left + Bmp[SCHLEUSE2].Breite; - Bmp[SCHLEUSE2].rcSrc.top = 126; - Bmp[SCHLEUSE2].rcSrc.bottom = Bmp[SCHLEUSE2].rcSrc.top + Bmp[SCHLEUSE2].Hoehe; - Bmp[SCHLEUSE2].rcDes.left = 10; - Bmp[SCHLEUSE2].rcDes.right = Bmp[SCHLEUSE2].rcDes.left + Bmp[SCHLEUSE2].Breite; - Bmp[SCHLEUSE2].rcDes.top = 16; - Bmp[SCHLEUSE2].rcDes.bottom = Bmp[SCHLEUSE2].rcDes.top + Bmp[SCHLEUSE2].Hoehe; - - Bmp[SCHLEUSE3].Breite = 34; - Bmp[SCHLEUSE3].Hoehe = 22; - Bmp[SCHLEUSE3].rcSrc.left = 233; - Bmp[SCHLEUSE3].rcSrc.right = Bmp[SCHLEUSE3].rcSrc.left + Bmp[SCHLEUSE3].Breite; - Bmp[SCHLEUSE3].rcSrc.top = 126; - Bmp[SCHLEUSE3].rcSrc.bottom = Bmp[SCHLEUSE3].rcSrc.top + Bmp[SCHLEUSE3].Hoehe; - Bmp[SCHLEUSE3].rcDes.left = 10; - Bmp[SCHLEUSE3].rcDes.right = Bmp[SCHLEUSE3].rcDes.left + Bmp[SCHLEUSE3].Breite; - Bmp[SCHLEUSE3].rcDes.top = 17; - Bmp[SCHLEUSE3].rcDes.bottom = Bmp[SCHLEUSE3].rcDes.top + Bmp[SCHLEUSE3].Hoehe; - - Bmp[SCHLEUSE4].Breite = 33; - Bmp[SCHLEUSE4].Hoehe = 23; - Bmp[SCHLEUSE4].rcSrc.left = 268; - Bmp[SCHLEUSE4].rcSrc.right = Bmp[SCHLEUSE4].rcSrc.left + Bmp[SCHLEUSE4].Breite; - Bmp[SCHLEUSE4].rcSrc.top = 105; - Bmp[SCHLEUSE4].rcSrc.bottom = Bmp[SCHLEUSE4].rcSrc.top + Bmp[SCHLEUSE4].Hoehe; - Bmp[SCHLEUSE4].rcDes.left = 11; - Bmp[SCHLEUSE4].rcDes.right = Bmp[SCHLEUSE4].rcDes.left + Bmp[SCHLEUSE4].Breite; - Bmp[SCHLEUSE4].rcDes.top = 16; - Bmp[SCHLEUSE4].rcDes.bottom = Bmp[SCHLEUSE4].rcDes.top + Bmp[SCHLEUSE4].Hoehe; - - Bmp[SCHLEUSE5].Breite = 34; - Bmp[SCHLEUSE5].Hoehe = 17; - Bmp[SCHLEUSE5].rcSrc.left = 302; - Bmp[SCHLEUSE5].rcSrc.right = Bmp[SCHLEUSE5].rcSrc.left + Bmp[SCHLEUSE5].Breite; - Bmp[SCHLEUSE5].rcSrc.top = 91; - Bmp[SCHLEUSE5].rcSrc.bottom = Bmp[SCHLEUSE5].rcSrc.top + Bmp[SCHLEUSE5].Hoehe; - Bmp[SCHLEUSE5].rcDes.left = 10; - Bmp[SCHLEUSE5].rcDes.right = Bmp[SCHLEUSE5].rcDes.left + Bmp[SCHLEUSE5].Breite; - Bmp[SCHLEUSE5].rcDes.top = 20; - Bmp[SCHLEUSE5].rcDes.bottom = Bmp[SCHLEUSE5].rcDes.top + Bmp[SCHLEUSE5].Hoehe; - - Bmp[SCHLEUSE6].Breite = 35; - Bmp[SCHLEUSE6].Hoehe = 23; - Bmp[SCHLEUSE6].rcSrc.left = 336; - Bmp[SCHLEUSE6].rcSrc.right = Bmp[SCHLEUSE6].rcSrc.left + Bmp[SCHLEUSE6].Breite; - Bmp[SCHLEUSE6].rcSrc.top = 154; - Bmp[SCHLEUSE6].rcSrc.bottom = Bmp[SCHLEUSE6].rcSrc.top + Bmp[SCHLEUSE6].Hoehe; - Bmp[SCHLEUSE6].rcDes.left = 10; - Bmp[SCHLEUSE6].rcDes.right = Bmp[SCHLEUSE6].rcDes.left + Bmp[SCHLEUSE6].Breite; - Bmp[SCHLEUSE6].rcDes.top = 16; - Bmp[SCHLEUSE6].rcDes.bottom = Bmp[SCHLEUSE6].rcDes.top + Bmp[SCHLEUSE6].Hoehe; - - // Bauwerke - for (i = FELD; i <= FEUERSTELLE; i++) - { - Bmp[i].Animation = false; - Bmp[i].Geschwindigkeit = 0; - Bmp[i].Phase = 0; +void InitStructs() +{ + short i, k; + + // BILD + // Standardbildinitialisierung + for (i = 0; i < SPRITE_COUNT; i++) { + Bmp[i].IsAnimationRunning = false; + Bmp[i].AnimationPhaseCount = 0; + Bmp[i].Speed = 0; + Bmp[i].AnimationPhase = 0; + Bmp[i].Surface = nullptr; + Bmp[i].sourceRect.left = 0; + Bmp[i].sourceRect.right = 0; + Bmp[i].sourceRect.top = 0; + Bmp[i].sourceRect.bottom = 0; + Bmp[i].targetRect.left = 0; + Bmp[i].targetRect.right = 0; + Bmp[i].targetRect.top = 0; + Bmp[i].targetRect.bottom = 0; + Bmp[i].Width = 0; + Bmp[i].Height = 0; + Bmp[i].Sound = 0; + + for (k = 0; k < SPRITE_COUNT; k++) { + Bmp[i].RequiredRawMaterials[k] = 0; } - Bmp[FELD].Anzahl = 3; - Bmp[FELD].Surface = lpDDSBau; - Bmp[FELD].Breite = 42; - Bmp[FELD].Hoehe = 27; - Bmp[FELD].rcSrc.left = 0; - Bmp[FELD].rcSrc.right = 0 + Bmp[FELD].Breite; - Bmp[FELD].rcSrc.top = 0; - Bmp[FELD].rcSrc.bottom = 0 + Bmp[FELD].Hoehe; - Bmp[FELD].rcDes.left = 5; - Bmp[FELD].rcDes.right = Bmp[FELD].rcDes.left + Bmp[FELD].Breite; - Bmp[FELD].rcDes.top = 15; - Bmp[FELD].rcDes.bottom = Bmp[FELD].rcDes.top + Bmp[FELD].Hoehe; - Bmp[FELD].AkAnzahl = 20; - - Bmp[ZELT].Anzahl = 1; - Bmp[ZELT].Surface = lpDDSBau; - Bmp[ZELT].Breite = 23; - Bmp[ZELT].Hoehe = 20; - Bmp[ZELT].rcSrc.left = 42; - Bmp[ZELT].rcSrc.right = 42 + Bmp[ZELT].Breite; - Bmp[ZELT].rcSrc.top = 0; - Bmp[ZELT].rcSrc.bottom = 0 + Bmp[ZELT].Hoehe; - Bmp[ZELT].rcDes.left = 14; - Bmp[ZELT].rcDes.right = Bmp[ZELT].rcDes.left + Bmp[ZELT].Breite; - Bmp[ZELT].rcDes.top = 9; - Bmp[ZELT].rcDes.bottom = Bmp[ZELT].rcDes.top + Bmp[ZELT].Hoehe; - Bmp[ZELT].Rohstoff[ROHAST] = 5; - Bmp[ZELT].Rohstoff[ROHBLATT] = 5; - Bmp[ZELT].AkAnzahl = 16; - - Bmp[BOOT].Anzahl = 2; - Bmp[BOOT].Surface = lpDDSBau; - Bmp[BOOT].Breite = 26; - Bmp[BOOT].Hoehe = 18; - Bmp[BOOT].rcSrc.left = 65; - Bmp[BOOT].rcSrc.right = 65 + Bmp[BOOT].Breite; - Bmp[BOOT].rcSrc.top = 0; - Bmp[BOOT].rcSrc.bottom = 0 + Bmp[BOOT].Hoehe; - Bmp[BOOT].rcDes.left = 14; - Bmp[BOOT].rcDes.right = Bmp[BOOT].rcDes.left + Bmp[BOOT].Breite; - Bmp[BOOT].rcDes.top = 20; - Bmp[BOOT].rcDes.bottom = Bmp[BOOT].rcDes.top + Bmp[BOOT].Hoehe; - Bmp[BOOT].Rohstoff[ROHAST] = 2; - Bmp[BOOT].Rohstoff[ROHSTAMM] = 1; - Bmp[BOOT].AkAnzahl = 16; - - Bmp[ROHR].Anzahl = 2; - Bmp[ROHR].Surface = lpDDSBau; - Bmp[ROHR].Breite = 34; - Bmp[ROHR].Hoehe = 21; - Bmp[ROHR].rcSrc.left = 91; - Bmp[ROHR].rcSrc.right = 91 + Bmp[ROHR].Breite; - Bmp[ROHR].rcSrc.top = 0; - Bmp[ROHR].rcSrc.bottom = 0 + Bmp[ROHR].Hoehe; - Bmp[ROHR].rcDes.left = 11; - Bmp[ROHR].rcDes.right = Bmp[ROHR].rcDes.left + Bmp[ROHR].Breite; - Bmp[ROHR].rcDes.top = 16; - Bmp[ROHR].rcDes.bottom = Bmp[ROHR].rcDes.top + Bmp[ROHR].Hoehe; - Bmp[ROHR].Rohstoff[ROHSTAMM] = 1; - Bmp[ROHR].AkAnzahl = 18; - - Bmp[SOS].Anzahl = 1; - Bmp[SOS].Surface = lpDDSBau; - Bmp[SOS].Breite = 36; - Bmp[SOS].Hoehe = 19; - Bmp[SOS].rcSrc.left = 125; - Bmp[SOS].rcSrc.right = 125 + Bmp[SOS].Breite; - Bmp[SOS].rcSrc.top = 0; - Bmp[SOS].rcSrc.bottom = 0 + Bmp[SOS].Hoehe; - Bmp[SOS].rcDes.left = 11; - Bmp[SOS].rcDes.right = Bmp[SOS].rcDes.left + Bmp[SOS].Breite; - Bmp[SOS].rcDes.top = 20; - Bmp[SOS].rcDes.bottom = Bmp[SOS].rcDes.top + Bmp[SOS].Hoehe; - Bmp[SOS].Rohstoff[ROHSTEIN] = 10; - Bmp[SOS].AkAnzahl = 20; - - Bmp[HAUS1].Anzahl = 1; - Bmp[HAUS1].Surface = lpDDSBau; - Bmp[HAUS1].Breite = 26; - Bmp[HAUS1].Hoehe = 41; - Bmp[HAUS1].rcSrc.left = 161; - Bmp[HAUS1].rcSrc.right = 161 + Bmp[HAUS1].Breite; - Bmp[HAUS1].rcSrc.top = 0; - Bmp[HAUS1].rcSrc.bottom = 0 + Bmp[HAUS1].Hoehe; - Bmp[HAUS1].rcDes.left = 0; - Bmp[HAUS1].rcDes.right = Bmp[HAUS1].rcDes.left + Bmp[HAUS1].Breite; - Bmp[HAUS1].rcDes.top = 0; - Bmp[HAUS1].rcDes.bottom = Bmp[HAUS1].rcDes.top + Bmp[HAUS1].Hoehe; - Bmp[HAUS1].Rohstoff[ROHAST] = 4; - Bmp[HAUS1].AkAnzahl = 19; - Bmp[HAUS1].Sound = Sound::FOREST; - - Bmp[HAUS2].Anzahl = 1; - Bmp[HAUS2].Surface = lpDDSBau; - Bmp[HAUS2].Breite = 34; - Bmp[HAUS2].Hoehe = 41; - Bmp[HAUS2].rcSrc.left = 187; - Bmp[HAUS2].rcSrc.right = 187 + Bmp[HAUS2].Breite; - Bmp[HAUS2].rcSrc.top = 0; - Bmp[HAUS2].rcSrc.bottom = 0 + Bmp[HAUS2].Hoehe; - Bmp[HAUS2].rcDes.left = 0; - Bmp[HAUS2].rcDes.right = Bmp[HAUS2].rcDes.left + Bmp[HAUS2].Breite; - Bmp[HAUS2].rcDes.top = 0; - Bmp[HAUS2].rcDes.bottom = Bmp[HAUS2].rcDes.top + Bmp[HAUS2].Hoehe; - Bmp[HAUS2].Rohstoff[ROHAST] = 3; - Bmp[HAUS2].Rohstoff[ROHSTAMM] = 3; - Bmp[HAUS2].AkAnzahl = 21; - Bmp[HAUS2].Sound = Sound::FOREST; - - Bmp[HAUS3].Anzahl = 1; - Bmp[HAUS3].Surface = lpDDSBau; - Bmp[HAUS3].Breite = 34; - Bmp[HAUS3].Hoehe = 41; - Bmp[HAUS3].rcSrc.left = 221; - Bmp[HAUS3].rcSrc.right = 221 + Bmp[HAUS3].Breite; - Bmp[HAUS3].rcSrc.top = 0; - Bmp[HAUS3].rcSrc.bottom = 0 + Bmp[HAUS3].Hoehe; - Bmp[HAUS3].rcDes.left = 0; - Bmp[HAUS3].rcDes.right = Bmp[HAUS3].rcDes.left + Bmp[HAUS3].Breite; - Bmp[HAUS3].rcDes.top = 0; - Bmp[HAUS3].rcDes.bottom = Bmp[HAUS3].rcDes.top + Bmp[HAUS3].Hoehe; - Bmp[HAUS3].Rohstoff[ROHAST] = 4; - Bmp[HAUS3].Rohstoff[ROHSTAMM] = 4; - Bmp[HAUS3].Rohstoff[ROHBLATT] = 5; - Bmp[HAUS3].AkAnzahl = 21; - Bmp[HAUS3].Sound = Sound::FOREST; - - Bmp[FEUERSTELLE].Anzahl = 1; - Bmp[FEUERSTELLE].Surface = lpDDSBau; - Bmp[FEUERSTELLE].Breite = 21; - Bmp[FEUERSTELLE].Hoehe = 19; - Bmp[FEUERSTELLE].rcSrc.left = 255; - Bmp[FEUERSTELLE].rcSrc.right = 255 + Bmp[FEUERSTELLE].Breite; - Bmp[FEUERSTELLE].rcSrc.top = 0; - Bmp[FEUERSTELLE].rcSrc.bottom = 0 + Bmp[FEUERSTELLE].Hoehe; - Bmp[FEUERSTELLE].rcDes.left = 15; - Bmp[FEUERSTELLE].rcDes.right = Bmp[FEUERSTELLE].rcDes.left + Bmp[FEUERSTELLE].Breite; - Bmp[FEUERSTELLE].rcDes.top = 10; - Bmp[FEUERSTELLE].rcDes.bottom = Bmp[FEUERSTELLE].rcDes.top + Bmp[FEUERSTELLE].Hoehe; - Bmp[FEUERSTELLE].Rohstoff[ROHAST] = 5; - Bmp[FEUERSTELLE].Rohstoff[ROHSTAMM] = 4; - Bmp[FEUERSTELLE].AkAnzahl = 9; - - // Allgemein Bäume - for (i = BAUM1; i <= BAUM4; i++) - { - Bmp[i].Animation = true; - Bmp[i].Anzahl = 4; - Bmp[i].Geschwindigkeit = 4; - Bmp[i].Phase = 0; - Bmp[i].Surface = lpDDSBaum; - Bmp[i].Sound = Sound::FOREST; - } - // Baum1 - Bmp[BAUM1].rcSrc.left = 0; - Bmp[BAUM1].rcSrc.top = 0; - Bmp[BAUM1].rcSrc.right = 21; - Bmp[BAUM1].rcSrc.bottom = 26; - Bmp[BAUM1].Breite = static_cast(Bmp[BAUM1].rcSrc.right - Bmp[BAUM1].rcSrc.left); - Bmp[BAUM1].Hoehe = static_cast(Bmp[BAUM1].rcSrc.bottom - Bmp[BAUM1].rcSrc.top); - - // Baum2 - Bmp[BAUM2].rcSrc.left = 21; - Bmp[BAUM2].rcSrc.top = 0; - Bmp[BAUM2].rcSrc.right = 42; - Bmp[BAUM2].rcSrc.bottom = 26; - Bmp[BAUM2].Breite = static_cast(Bmp[BAUM2].rcSrc.right - Bmp[BAUM2].rcSrc.left); - Bmp[BAUM2].Hoehe = static_cast(Bmp[BAUM2].rcSrc.bottom - Bmp[BAUM2].rcSrc.top); - - // Baum3 - Bmp[BAUM3].rcSrc.left = 42; - Bmp[BAUM3].rcSrc.top = 0; - Bmp[BAUM3].rcSrc.right = 64; - Bmp[BAUM3].rcSrc.bottom = 27; - Bmp[BAUM3].Breite = static_cast(Bmp[BAUM3].rcSrc.right - Bmp[BAUM3].rcSrc.left); - Bmp[BAUM3].Hoehe = static_cast(Bmp[BAUM3].rcSrc.bottom - Bmp[BAUM3].rcSrc.top); - - // Baum4 - Bmp[BAUM4].rcSrc.left = 64; - Bmp[BAUM4].rcSrc.top = 0; - Bmp[BAUM4].rcSrc.right = 81; - Bmp[BAUM4].rcSrc.bottom = 16; - Bmp[BAUM4].Breite = static_cast(Bmp[BAUM4].rcSrc.right - Bmp[BAUM4].rcSrc.left); - Bmp[BAUM4].Hoehe = static_cast(Bmp[BAUM4].rcSrc.bottom - Bmp[BAUM4].rcSrc.top); - - // Baumgroß - Bmp[BAUMGROSS].rcSrc.left = 238; - Bmp[BAUMGROSS].rcSrc.top = 0; - Bmp[BAUMGROSS].rcSrc.right = 238 + 26; - Bmp[BAUMGROSS].rcSrc.bottom = 41; - Bmp[BAUMGROSS].Breite = static_cast(Bmp[BAUMGROSS].rcSrc.right - Bmp[BAUMGROSS].rcSrc.left); - Bmp[BAUMGROSS].Hoehe = static_cast(Bmp[BAUMGROSS].rcSrc.bottom - Bmp[BAUMGROSS].rcSrc.top); - Bmp[BAUMGROSS].Animation = false; - Bmp[BAUMGROSS].Anzahl = 1; - Bmp[BAUMGROSS].Geschwindigkeit = 0; - Bmp[BAUMGROSS].Phase = 0; - Bmp[BAUMGROSS].Surface = lpDDSBaum; - Bmp[BAUMGROSS].Sound = Sound::FOREST; - - // Feuer - Bmp[FEUER].Anzahl = 3; - Bmp[FEUER].Surface = lpDDSBau; - Bmp[FEUER].Breite = 21; - Bmp[FEUER].Hoehe = 28; - Bmp[FEUER].rcSrc.left = 276; - Bmp[FEUER].rcSrc.right = 276 + Bmp[FEUER].Breite; - Bmp[FEUER].rcSrc.top = 0; - Bmp[FEUER].rcSrc.bottom = 0 + Bmp[FEUER].Hoehe; - Bmp[FEUER].rcDes.left = 15; - Bmp[FEUER].rcDes.right = Bmp[FEUER].rcDes.left + Bmp[FEUER].Breite; - Bmp[FEUER].rcDes.top = 1; - Bmp[FEUER].rcDes.bottom = Bmp[FEUER].rcDes.top + Bmp[FEUER].Hoehe; - Bmp[FEUER].Animation = true; - Bmp[FEUER].Geschwindigkeit = 6; - Bmp[FEUER].Phase = 0; - Bmp[FEUER].Sound = Sound::FIRE; - - // WRACK - Bmp[WRACK].Anzahl = 3; - Bmp[WRACK].Surface = lpDDSBau; - Bmp[WRACK].Breite = 24; - Bmp[WRACK].Hoehe = 18; - Bmp[WRACK].rcSrc.left = 391; - Bmp[WRACK].rcSrc.right = 391 + Bmp[WRACK].Breite; - Bmp[WRACK].rcSrc.top = 0; - Bmp[WRACK].rcSrc.bottom = 0 + Bmp[WRACK].Hoehe; - Bmp[WRACK].rcDes.left = 15; - Bmp[WRACK].rcDes.right = Bmp[WRACK].rcDes.left + Bmp[WRACK].Breite; - Bmp[WRACK].rcDes.top = 20; - Bmp[WRACK].rcDes.bottom = Bmp[WRACK].rcDes.top + Bmp[WRACK].Hoehe; - Bmp[WRACK].Animation = true; - Bmp[WRACK].Geschwindigkeit = 5; - Bmp[WRACK].Phase = 0; - - // WRACK2 - Bmp[WRACK2].Anzahl = 3; - Bmp[WRACK2].Surface = lpDDSBau; - Bmp[WRACK2].Breite = 27; - Bmp[WRACK2].Hoehe = 26; - Bmp[WRACK2].rcSrc.left = 415; - Bmp[WRACK2].rcSrc.right = 415 + Bmp[WRACK2].Breite; - Bmp[WRACK2].rcSrc.top = 0; - Bmp[WRACK2].rcSrc.bottom = 0 + Bmp[WRACK2].Hoehe; - Bmp[WRACK2].rcDes.left = 15; - Bmp[WRACK2].rcDes.right = Bmp[WRACK2].rcDes.left + Bmp[WRACK2].Breite; - Bmp[WRACK2].rcDes.top = 16; - Bmp[WRACK2].rcDes.bottom = Bmp[WRACK2].rcDes.top + Bmp[WRACK2].Hoehe; - Bmp[WRACK2].Animation = true; - Bmp[WRACK2].Geschwindigkeit = 5; - Bmp[WRACK2].Phase = 0; - - // Früchte - // Busch - Bmp[BUSCH].rcSrc.left = 81; - Bmp[BUSCH].rcSrc.top = 0; - Bmp[BUSCH].rcSrc.right = 81 + 20; - Bmp[BUSCH].rcSrc.bottom = 13; - Bmp[BUSCH].Breite = static_cast(Bmp[BUSCH].rcSrc.right - Bmp[BUSCH].rcSrc.left); - Bmp[BUSCH].Hoehe = static_cast(Bmp[BUSCH].rcSrc.bottom - Bmp[BUSCH].rcSrc.top); - Bmp[BUSCH].Animation = false; - Bmp[BUSCH].Anzahl = 3; - Bmp[BUSCH].Geschwindigkeit = 0; - Bmp[BUSCH].Phase = 0; - Bmp[BUSCH].Surface = lpDDSBaum; - - // Buttons - - // StandardBmponsinitialisierung - for (i = BUTTGITTER; i <= BUTTDESTROY; i++) - { - Bmp[i].Animation = false; - Bmp[i].Surface = lpDDSButtons; - Bmp[i].Anzahl = 1; - Bmp[i].Phase = 0; - } + Bmp[i].RequiredActionCases = 0; + Bmp[i].First = true; + } - // ButtGitter - Bmp[BUTTGITTER].rcSrc.left = 0; - Bmp[BUTTGITTER].rcSrc.top = 0; - Bmp[BUTTGITTER].rcSrc.right = 28; - Bmp[BUTTGITTER].rcSrc.bottom = 28; - Bmp[BUTTGITTER].rcDes.left = rcPanel.left + 173; - Bmp[BUTTGITTER].rcDes.top = rcPanel.top + 26; - Bmp[BUTTGITTER].rcDes.right = Bmp[BUTTGITTER].rcDes.left + 28; - Bmp[BUTTGITTER].rcDes.bottom = Bmp[BUTTGITTER].rcDes.top + 28; - Bmp[BUTTGITTER].Breite = static_cast(Bmp[BUTTGITTER].rcSrc.right - Bmp[BUTTGITTER].rcSrc.left); - Bmp[BUTTGITTER].Hoehe = static_cast(Bmp[BUTTGITTER].rcSrc.bottom - Bmp[BUTTGITTER].rcSrc.top); - Bmp[BUTTGITTER].Anzahl = 2; - - // BUTTANIMATION - Bmp[BUTTANIMATION].rcSrc.left = 0; - Bmp[BUTTANIMATION].rcSrc.top = 56; - Bmp[BUTTANIMATION].rcSrc.right = 28; - Bmp[BUTTANIMATION].rcSrc.bottom = 56 + 28; - Bmp[BUTTANIMATION].rcDes.left = rcPanel.left + 173; - Bmp[BUTTANIMATION].rcDes.top = rcPanel.top + 60; - Bmp[BUTTANIMATION].rcDes.right = Bmp[BUTTANIMATION].rcDes.left + 28; - Bmp[BUTTANIMATION].rcDes.bottom = Bmp[BUTTANIMATION].rcDes.top + 28; - Bmp[BUTTANIMATION].Breite = static_cast(Bmp[BUTTANIMATION].rcSrc.right - Bmp[BUTTANIMATION].rcSrc.left); - Bmp[BUTTANIMATION].Hoehe = static_cast(Bmp[BUTTANIMATION].rcSrc.bottom - Bmp[BUTTANIMATION].rcSrc.top); - Bmp[BUTTANIMATION].Anzahl = 2; - - // BUTTBEENDEN - Bmp[BUTTBEENDEN].rcSrc.left = 0; - Bmp[BUTTBEENDEN].rcSrc.top = 112; - Bmp[BUTTBEENDEN].rcSrc.right = 20; - Bmp[BUTTBEENDEN].rcSrc.bottom = 112 + 20; - Bmp[BUTTBEENDEN].rcDes.left = rcPanel.left + 60; - Bmp[BUTTBEENDEN].rcDes.top = rcPanel.top + 2; - Bmp[BUTTBEENDEN].rcDes.right = Bmp[BUTTBEENDEN].rcDes.left + 20; - Bmp[BUTTBEENDEN].rcDes.bottom = Bmp[BUTTBEENDEN].rcDes.top + 20; - Bmp[BUTTBEENDEN].Breite = static_cast(Bmp[BUTTBEENDEN].rcSrc.right - Bmp[BUTTBEENDEN].rcSrc.left); - Bmp[BUTTBEENDEN].Hoehe = static_cast(Bmp[BUTTBEENDEN].rcSrc.bottom - Bmp[BUTTBEENDEN].rcSrc.top); - Bmp[BUTTBEENDEN].Anzahl = 4; - Bmp[BUTTBEENDEN].Geschwindigkeit = 4; - - // BUTTNEU - Bmp[BUTTNEU].rcSrc.left = 0; - Bmp[BUTTNEU].rcSrc.top = 192; - Bmp[BUTTNEU].rcSrc.right = 20; - Bmp[BUTTNEU].rcSrc.bottom = 192 + 20; - Bmp[BUTTNEU].rcDes.left = rcPanel.left + 100; - Bmp[BUTTNEU].rcDes.top = rcPanel.top + 2; - Bmp[BUTTNEU].rcDes.right = Bmp[BUTTNEU].rcDes.left + 20; - Bmp[BUTTNEU].rcDes.bottom = Bmp[BUTTNEU].rcDes.top + 20; - Bmp[BUTTNEU].Breite = static_cast(Bmp[BUTTNEU].rcSrc.right - Bmp[BUTTNEU].rcSrc.left); - Bmp[BUTTNEU].Hoehe = static_cast(Bmp[BUTTNEU].rcSrc.bottom - Bmp[BUTTNEU].rcSrc.top); - Bmp[BUTTNEU].Anzahl = 2; - Bmp[BUTTNEU].Geschwindigkeit = 3; - - - // BUTTTAGNEU - Bmp[BUTTTAGNEU].rcSrc.left = 0; - Bmp[BUTTTAGNEU].rcSrc.top = 232; - Bmp[BUTTTAGNEU].rcSrc.right = 20; - Bmp[BUTTTAGNEU].rcSrc.bottom = 232 + 20; - Bmp[BUTTTAGNEU].rcDes.left = rcPanel.left + 140; - Bmp[BUTTTAGNEU].rcDes.top = rcPanel.top + 2; - Bmp[BUTTTAGNEU].rcDes.right = Bmp[BUTTTAGNEU].rcDes.left + 20; - Bmp[BUTTTAGNEU].rcDes.bottom = Bmp[BUTTTAGNEU].rcDes.top + 20; - Bmp[BUTTTAGNEU].Breite = static_cast(Bmp[BUTTTAGNEU].rcSrc.right - Bmp[BUTTTAGNEU].rcSrc.left); - Bmp[BUTTTAGNEU].Hoehe = static_cast(Bmp[BUTTTAGNEU].rcSrc.bottom - Bmp[BUTTTAGNEU].rcSrc.top); - Bmp[BUTTTAGNEU].Anzahl = 2; - Bmp[BUTTTAGNEU].Geschwindigkeit = 2; - - // BUTTSOUND - Bmp[BUTTSOUND].rcSrc.left = 0; - Bmp[BUTTSOUND].rcSrc.top = 272; - Bmp[BUTTSOUND].rcSrc.right = 28; - Bmp[BUTTSOUND].rcSrc.bottom = 272 + 28; - Bmp[BUTTSOUND].rcDes.left = rcPanel.left + 173; - Bmp[BUTTSOUND].rcDes.top = rcPanel.top + 94; - Bmp[BUTTSOUND].rcDes.right = Bmp[BUTTSOUND].rcDes.left + 28; - Bmp[BUTTSOUND].rcDes.bottom = Bmp[BUTTSOUND].rcDes.top + 28; - Bmp[BUTTSOUND].Breite = static_cast(Bmp[BUTTSOUND].rcSrc.right - Bmp[BUTTSOUND].rcSrc.left); - Bmp[BUTTSOUND].Hoehe = static_cast(Bmp[BUTTSOUND].rcSrc.bottom - Bmp[BUTTSOUND].rcSrc.top); - Bmp[BUTTSOUND].Anzahl = 2; - - // ButtAktion - Bmp[BUTTAKTION].rcSrc.left = 28; - Bmp[BUTTAKTION].rcSrc.top = 0; - Bmp[BUTTAKTION].rcSrc.right = 28 + 35; - Bmp[BUTTAKTION].rcSrc.bottom = 35; - Bmp[BUTTAKTION].rcDes.left = rcPanel.left + 29; - Bmp[BUTTAKTION].rcDes.top = rcPanel.top + 191; - Bmp[BUTTAKTION].rcDes.right = Bmp[BUTTAKTION].rcDes.left + 35; - Bmp[BUTTAKTION].rcDes.bottom = Bmp[BUTTAKTION].rcDes.top + 35; - Bmp[BUTTAKTION].Breite = static_cast(Bmp[BUTTAKTION].rcSrc.right - Bmp[BUTTAKTION].rcSrc.left); - Bmp[BUTTAKTION].Hoehe = static_cast(Bmp[BUTTAKTION].rcSrc.bottom - Bmp[BUTTAKTION].rcSrc.top); - Bmp[BUTTAKTION].Anzahl = 3; - Bmp[BUTTAKTION].Geschwindigkeit = 6; - - // BUTTBAUEN - Bmp[BUTTBAUEN].rcSrc.left = 203; - Bmp[BUTTBAUEN].rcSrc.top = 0; - Bmp[BUTTBAUEN].rcSrc.right = 203 + 35; - Bmp[BUTTBAUEN].rcSrc.bottom = 35; - Bmp[BUTTBAUEN].rcDes.left = rcPanel.left + 70; - Bmp[BUTTBAUEN].rcDes.top = rcPanel.top + 191; - Bmp[BUTTBAUEN].rcDes.right = Bmp[BUTTBAUEN].rcDes.left + 35; - Bmp[BUTTBAUEN].rcDes.bottom = Bmp[BUTTBAUEN].rcDes.top + 35; - Bmp[BUTTBAUEN].Breite = static_cast(Bmp[BUTTBAUEN].rcSrc.right - Bmp[BUTTBAUEN].rcSrc.left); - Bmp[BUTTBAUEN].Hoehe = static_cast(Bmp[BUTTBAUEN].rcSrc.bottom - Bmp[BUTTBAUEN].rcSrc.top); - Bmp[BUTTBAUEN].Anzahl = 4; - Bmp[BUTTBAUEN].Geschwindigkeit = 5; - - - // BUTTINVENTAR - Bmp[BUTTINVENTAR].rcSrc.left = 168; - Bmp[BUTTINVENTAR].rcSrc.top = 0; - Bmp[BUTTINVENTAR].rcSrc.right = 168 + 35; - Bmp[BUTTINVENTAR].rcSrc.bottom = 35; - Bmp[BUTTINVENTAR].rcDes.left = rcPanel.left + 152; - Bmp[BUTTINVENTAR].rcDes.top = rcPanel.top + 191; - Bmp[BUTTINVENTAR].rcDes.right = Bmp[BUTTINVENTAR].rcDes.left + 35; - Bmp[BUTTINVENTAR].rcDes.bottom = Bmp[BUTTINVENTAR].rcDes.top + 35; - Bmp[BUTTINVENTAR].Breite = static_cast(Bmp[BUTTINVENTAR].rcSrc.right - Bmp[BUTTINVENTAR].rcSrc.left); - Bmp[BUTTINVENTAR].Hoehe = static_cast(Bmp[BUTTINVENTAR].rcSrc.bottom - Bmp[BUTTINVENTAR].rcSrc.top); - Bmp[BUTTINVENTAR].Anzahl = 4; - Bmp[BUTTINVENTAR].Geschwindigkeit = 4; - - // BUTTWEITER - Bmp[BUTTWEITER].rcSrc.left = 343; - Bmp[BUTTWEITER].rcSrc.top = 0; - Bmp[BUTTWEITER].rcSrc.right = 343 + 35; - Bmp[BUTTWEITER].rcSrc.bottom = 35; - Bmp[BUTTWEITER].rcDes.left = rcPanel.left + 111; - Bmp[BUTTWEITER].rcDes.top = rcPanel.top + 191; - Bmp[BUTTWEITER].rcDes.right = Bmp[BUTTWEITER].rcDes.left + 35; - Bmp[BUTTWEITER].rcDes.bottom = Bmp[BUTTWEITER].rcDes.top + 35; - Bmp[BUTTWEITER].Breite = static_cast(Bmp[BUTTWEITER].rcSrc.right - Bmp[BUTTWEITER].rcSrc.left); - Bmp[BUTTWEITER].Hoehe = static_cast(Bmp[BUTTWEITER].rcSrc.bottom - Bmp[BUTTWEITER].rcSrc.top); - Bmp[BUTTWEITER].Anzahl = 4; - Bmp[BUTTWEITER].Geschwindigkeit = 4; - Bmp[BUTTWEITER].Phase = -1; - - // BUTTSTOP - Bmp[BUTTSTOP].rcSrc.left = 378; - Bmp[BUTTSTOP].rcSrc.top = 0; - Bmp[BUTTSTOP].rcSrc.right = 378 + 35; - Bmp[BUTTSTOP].rcSrc.bottom = 35; - Bmp[BUTTSTOP].rcDes.left = rcPanel.left + 111; - Bmp[BUTTSTOP].rcDes.top = rcPanel.top + 191; - Bmp[BUTTSTOP].rcDes.right = Bmp[BUTTSTOP].rcDes.left + 35; - Bmp[BUTTSTOP].rcDes.bottom = Bmp[BUTTSTOP].rcDes.top + 35; - Bmp[BUTTSTOP].Breite = static_cast(Bmp[BUTTSTOP].rcSrc.right - Bmp[BUTTSTOP].rcSrc.left); - Bmp[BUTTSTOP].Hoehe = static_cast(Bmp[BUTTSTOP].rcSrc.bottom - Bmp[BUTTSTOP].rcSrc.top); - Bmp[BUTTSTOP].Anzahl = 4; - Bmp[BUTTSTOP].Geschwindigkeit = 4; - Bmp[BUTTSTOP].Phase = -1; - - // BUTTABLEGEN - Bmp[BUTTABLEGEN].rcSrc.left = 483; - Bmp[BUTTABLEGEN].rcSrc.top = 0; - Bmp[BUTTABLEGEN].rcSrc.right = 483 + 35; - Bmp[BUTTABLEGEN].rcSrc.bottom = 35; - Bmp[BUTTABLEGEN].rcDes.left = rcPanel.left + 111; - Bmp[BUTTABLEGEN].rcDes.top = rcPanel.top + 191; - Bmp[BUTTABLEGEN].rcDes.right = Bmp[BUTTABLEGEN].rcDes.left + 35; - Bmp[BUTTABLEGEN].rcDes.bottom = Bmp[BUTTABLEGEN].rcDes.top + 35; - Bmp[BUTTABLEGEN].Breite = static_cast(Bmp[BUTTABLEGEN].rcSrc.right - Bmp[BUTTABLEGEN].rcSrc.left); - Bmp[BUTTABLEGEN].Hoehe = static_cast(Bmp[BUTTABLEGEN].rcSrc.bottom - Bmp[BUTTABLEGEN].rcSrc.top); - Bmp[BUTTABLEGEN].Anzahl = 4; - Bmp[BUTTABLEGEN].Geschwindigkeit = 3; - Bmp[BUTTSTOP].Phase = -1; - - // BUTTSUCHEN - Bmp[BUTTSUCHEN].rcSrc.left = 63; - Bmp[BUTTSUCHEN].rcSrc.top = 0; - Bmp[BUTTSUCHEN].rcSrc.right = 63 + 35; - Bmp[BUTTSUCHEN].rcSrc.bottom = 35; - Bmp[BUTTSUCHEN].rcDes.left = rcPanel.left + 29; - Bmp[BUTTSUCHEN].rcDes.top = rcPanel.top + 270; - Bmp[BUTTSUCHEN].rcDes.right = Bmp[BUTTSUCHEN].rcDes.left + 35; - Bmp[BUTTSUCHEN].rcDes.bottom = Bmp[BUTTSUCHEN].rcDes.top + 35; - Bmp[BUTTSUCHEN].Breite = static_cast(Bmp[BUTTSUCHEN].rcSrc.right - Bmp[BUTTSUCHEN].rcSrc.left); - Bmp[BUTTSUCHEN].Hoehe = static_cast(Bmp[BUTTSUCHEN].rcSrc.bottom - Bmp[BUTTSUCHEN].rcSrc.top); - Bmp[BUTTSUCHEN].Anzahl = 4; - Bmp[BUTTSUCHEN].Geschwindigkeit = 4; - - // BUTTESSEN - Bmp[BUTTESSEN].rcSrc.left = 133; - Bmp[BUTTESSEN].rcSrc.top = 0; - Bmp[BUTTESSEN].rcSrc.right = 133 + 35; - Bmp[BUTTESSEN].rcSrc.bottom = 35; - Bmp[BUTTESSEN].rcDes.left = rcPanel.left + 70; - Bmp[BUTTESSEN].rcDes.top = rcPanel.top + 270; - Bmp[BUTTESSEN].rcDes.right = Bmp[BUTTESSEN].rcDes.left + 35; - Bmp[BUTTESSEN].rcDes.bottom = Bmp[BUTTESSEN].rcDes.top + 35; - Bmp[BUTTESSEN].Breite = static_cast(Bmp[BUTTESSEN].rcSrc.right - Bmp[BUTTESSEN].rcSrc.left); - Bmp[BUTTESSEN].Hoehe = static_cast(Bmp[BUTTESSEN].rcSrc.bottom - Bmp[BUTTESSEN].rcSrc.top); - Bmp[BUTTESSEN].Anzahl = 4; - Bmp[BUTTESSEN].Geschwindigkeit = 4; - - // BUTTSCHLAFEN - Bmp[BUTTSCHLAFEN].rcSrc.left = 308; - Bmp[BUTTSCHLAFEN].rcSrc.top = 0; - Bmp[BUTTSCHLAFEN].rcSrc.right = 308 + 35; - Bmp[BUTTSCHLAFEN].rcSrc.bottom = 35; - Bmp[BUTTSCHLAFEN].rcDes.left = rcPanel.left + 111; - Bmp[BUTTSCHLAFEN].rcDes.top = rcPanel.top + 270; - Bmp[BUTTSCHLAFEN].rcDes.right = Bmp[BUTTSCHLAFEN].rcDes.left + 35; - Bmp[BUTTSCHLAFEN].rcDes.bottom = Bmp[BUTTSCHLAFEN].rcDes.top + 35; - Bmp[BUTTSCHLAFEN].Breite = static_cast(Bmp[BUTTSCHLAFEN].rcSrc.right - Bmp[BUTTSCHLAFEN].rcSrc.left); - Bmp[BUTTSCHLAFEN].Hoehe = static_cast(Bmp[BUTTSCHLAFEN].rcSrc.bottom - Bmp[BUTTSCHLAFEN].rcSrc.top); - Bmp[BUTTSCHLAFEN].Anzahl = 4; - Bmp[BUTTSCHLAFEN].Geschwindigkeit = 3; - - // BUTTFAELLEN - Bmp[BUTTFAELLEN].rcSrc.left = 98; - Bmp[BUTTFAELLEN].rcSrc.top = 0; - Bmp[BUTTFAELLEN].rcSrc.right = 98 + 35; - Bmp[BUTTFAELLEN].rcSrc.bottom = 35; - Bmp[BUTTFAELLEN].rcDes.left = rcPanel.left + 152; - Bmp[BUTTFAELLEN].rcDes.top = rcPanel.top + 270; - Bmp[BUTTFAELLEN].rcDes.right = Bmp[BUTTFAELLEN].rcDes.left + 35; - Bmp[BUTTFAELLEN].rcDes.bottom = Bmp[BUTTFAELLEN].rcDes.top + 35; - Bmp[BUTTFAELLEN].Breite = static_cast(Bmp[BUTTFAELLEN].rcSrc.right - Bmp[BUTTFAELLEN].rcSrc.left); - Bmp[BUTTFAELLEN].Hoehe = static_cast(Bmp[BUTTFAELLEN].rcSrc.bottom - Bmp[BUTTFAELLEN].rcSrc.top); - Bmp[BUTTFAELLEN].Anzahl = 4; - Bmp[BUTTFAELLEN].Geschwindigkeit = 4; - Bmp[BUTTFAELLEN].Phase = -1; - - // BUTTANGELN - Bmp[BUTTANGELN].rcSrc.left = 413; - Bmp[BUTTANGELN].rcSrc.top = 0; - Bmp[BUTTANGELN].rcSrc.right = 413 + 35; - Bmp[BUTTANGELN].rcSrc.bottom = 35; - Bmp[BUTTANGELN].rcDes.left = rcPanel.left + 29; - Bmp[BUTTANGELN].rcDes.top = rcPanel.top + 325; - Bmp[BUTTANGELN].rcDes.right = Bmp[BUTTANGELN].rcDes.left + 35; - Bmp[BUTTANGELN].rcDes.bottom = Bmp[BUTTANGELN].rcDes.top + 35; - Bmp[BUTTANGELN].Breite = static_cast(Bmp[BUTTANGELN].rcSrc.right - Bmp[BUTTANGELN].rcSrc.left); - Bmp[BUTTANGELN].Hoehe = static_cast(Bmp[BUTTANGELN].rcSrc.bottom - Bmp[BUTTANGELN].rcSrc.top); - Bmp[BUTTANGELN].Anzahl = 4; - Bmp[BUTTANGELN].Geschwindigkeit = 3; - Bmp[BUTTANGELN].Phase = -1; - - // BUTTANZUENDEN - Bmp[BUTTANZUENDEN].rcSrc.left = 28; - Bmp[BUTTANZUENDEN].rcSrc.top = 175; - Bmp[BUTTANZUENDEN].rcSrc.right = 28 + 35; - Bmp[BUTTANZUENDEN].rcSrc.bottom = 175 + 35; - Bmp[BUTTANZUENDEN].rcDes.left = rcPanel.left + 70; - Bmp[BUTTANZUENDEN].rcDes.top = rcPanel.top + 325; - Bmp[BUTTANZUENDEN].rcDes.right = Bmp[BUTTANZUENDEN].rcDes.left + 35; - Bmp[BUTTANZUENDEN].rcDes.bottom = Bmp[BUTTANZUENDEN].rcDes.top + 35; - Bmp[BUTTANZUENDEN].Breite = static_cast(Bmp[BUTTANZUENDEN].rcSrc.right - Bmp[BUTTANZUENDEN].rcSrc.left); - Bmp[BUTTANZUENDEN].Hoehe = static_cast(Bmp[BUTTANZUENDEN].rcSrc.bottom - Bmp[BUTTANZUENDEN].rcSrc.top); - Bmp[BUTTANZUENDEN].Anzahl = 3; - Bmp[BUTTANZUENDEN].Geschwindigkeit = 4; - Bmp[BUTTANZUENDEN].Phase = -1; - - // BUTTAUSSCHAU - Bmp[BUTTAUSSCHAU].rcSrc.left = 63; - Bmp[BUTTAUSSCHAU].rcSrc.top = 175; - Bmp[BUTTAUSSCHAU].rcSrc.right = 63 + 35; - Bmp[BUTTAUSSCHAU].rcSrc.bottom = 175 + 35; - Bmp[BUTTAUSSCHAU].rcDes.left = rcPanel.left + 111; - Bmp[BUTTAUSSCHAU].rcDes.top = rcPanel.top + 325; - Bmp[BUTTAUSSCHAU].rcDes.right = Bmp[BUTTAUSSCHAU].rcDes.left + 35; - Bmp[BUTTAUSSCHAU].rcDes.bottom = Bmp[BUTTAUSSCHAU].rcDes.top + 35; - Bmp[BUTTAUSSCHAU].Breite = static_cast(Bmp[BUTTAUSSCHAU].rcSrc.right - Bmp[BUTTAUSSCHAU].rcSrc.left); - Bmp[BUTTAUSSCHAU].Hoehe = static_cast(Bmp[BUTTAUSSCHAU].rcSrc.bottom - Bmp[BUTTAUSSCHAU].rcSrc.top); - Bmp[BUTTAUSSCHAU].Anzahl = 4; - Bmp[BUTTAUSSCHAU].Geschwindigkeit = 3; - Bmp[BUTTAUSSCHAU].Phase = -1; - - // BUTTSCHATZKARTE - Bmp[BUTTSCHATZKARTE].rcSrc.left = 98; - Bmp[BUTTSCHATZKARTE].rcSrc.top = 175; - Bmp[BUTTSCHATZKARTE].rcSrc.right = 98 + 35; - Bmp[BUTTSCHATZKARTE].rcSrc.bottom = 175 + 35; - Bmp[BUTTSCHATZKARTE].rcDes.left = rcPanel.left + 152; - Bmp[BUTTSCHATZKARTE].rcDes.top = rcPanel.top + 325; - Bmp[BUTTSCHATZKARTE].rcDes.right = Bmp[BUTTSCHATZKARTE].rcDes.left + 35; - Bmp[BUTTSCHATZKARTE].rcDes.bottom = Bmp[BUTTSCHATZKARTE].rcDes.top + 35; - Bmp[BUTTSCHATZKARTE].Breite = static_cast(Bmp[BUTTSCHATZKARTE].rcSrc.right - Bmp[BUTTSCHATZKARTE].rcSrc.left); - Bmp[BUTTSCHATZKARTE].Hoehe = static_cast(Bmp[BUTTSCHATZKARTE].rcSrc.bottom - Bmp[BUTTSCHATZKARTE].rcSrc.top); - Bmp[BUTTSCHATZKARTE].Anzahl = 4; - Bmp[BUTTSCHATZKARTE].Geschwindigkeit = 3; - Bmp[BUTTSCHATZKARTE].Phase = -1; - - // BUTTSCHATZ - Bmp[BUTTSCHATZ].rcSrc.left = 133; - Bmp[BUTTSCHATZ].rcSrc.top = 175; - Bmp[BUTTSCHATZ].rcSrc.right = 133 + 35; - Bmp[BUTTSCHATZ].rcSrc.bottom = 175 + 35; - Bmp[BUTTSCHATZ].rcDes.left = rcPanel.left + 29; - Bmp[BUTTSCHATZ].rcDes.top = rcPanel.top + 380; - Bmp[BUTTSCHATZ].rcDes.right = Bmp[BUTTSCHATZ].rcDes.left + 35; - Bmp[BUTTSCHATZ].rcDes.bottom = Bmp[BUTTSCHATZ].rcDes.top + 35; - Bmp[BUTTSCHATZ].Breite = static_cast(Bmp[BUTTSCHATZ].rcSrc.right - Bmp[BUTTSCHATZ].rcSrc.left); - Bmp[BUTTSCHATZ].Hoehe = static_cast(Bmp[BUTTSCHATZ].rcSrc.bottom - Bmp[BUTTSCHATZ].rcSrc.top); - Bmp[BUTTSCHATZ].Anzahl = 4; - Bmp[BUTTSCHATZ].Geschwindigkeit = 3; - Bmp[BUTTSCHATZ].Phase = -1; - - // BUTTSCHLEUDER - Bmp[BUTTSCHLEUDER].rcSrc.left = 168; - Bmp[BUTTSCHLEUDER].rcSrc.top = 175; - Bmp[BUTTSCHLEUDER].rcSrc.right = 168 + 35; - Bmp[BUTTSCHLEUDER].rcSrc.bottom = 175 + 35; - Bmp[BUTTSCHLEUDER].rcDes.left = rcPanel.left + 70; - Bmp[BUTTSCHLEUDER].rcDes.top = rcPanel.top + 380; - Bmp[BUTTSCHLEUDER].rcDes.right = Bmp[BUTTSCHLEUDER].rcDes.left + 35; - Bmp[BUTTSCHLEUDER].rcDes.bottom = Bmp[BUTTSCHLEUDER].rcDes.top + 35; - Bmp[BUTTSCHLEUDER].Breite = static_cast(Bmp[BUTTSCHLEUDER].rcSrc.right - Bmp[BUTTSCHLEUDER].rcSrc.left); - Bmp[BUTTSCHLEUDER].Hoehe = static_cast(Bmp[BUTTSCHLEUDER].rcSrc.bottom - Bmp[BUTTSCHLEUDER].rcSrc.top); - Bmp[BUTTSCHLEUDER].Anzahl = 4; - Bmp[BUTTSCHLEUDER].Geschwindigkeit = 3; - Bmp[BUTTSCHLEUDER].Phase = -1; - - // BUTTFELD - Bmp[BUTTFELD].rcSrc.left = 238; - Bmp[BUTTFELD].rcSrc.top = 0; - Bmp[BUTTFELD].rcSrc.right = 238 + 35; - Bmp[BUTTFELD].rcSrc.bottom = 35; - Bmp[BUTTFELD].rcDes.left = rcPanel.left + 70; - Bmp[BUTTFELD].rcDes.top = rcPanel.top + 270; - Bmp[BUTTFELD].rcDes.right = Bmp[BUTTFELD].rcDes.left + 35; - Bmp[BUTTFELD].rcDes.bottom = Bmp[BUTTFELD].rcDes.top + 35; - Bmp[BUTTFELD].Breite = static_cast(Bmp[BUTTFELD].rcSrc.right - Bmp[BUTTFELD].rcSrc.left); - Bmp[BUTTFELD].Hoehe = static_cast(Bmp[BUTTFELD].rcSrc.bottom - Bmp[BUTTFELD].rcSrc.top); - Bmp[BUTTFELD].Anzahl = 4; - Bmp[BUTTFELD].Geschwindigkeit = 3; - Bmp[BUTTFELD].Phase = -1; - - // BUTTZELT - Bmp[BUTTZELT].rcSrc.left = 273; - Bmp[BUTTZELT].rcSrc.top = 0; - Bmp[BUTTZELT].rcSrc.right = 273 + 35; - Bmp[BUTTZELT].rcSrc.bottom = 35; - Bmp[BUTTZELT].rcDes.left = rcPanel.left + 29; - Bmp[BUTTZELT].rcDes.top = rcPanel.top + 270; - Bmp[BUTTZELT].rcDes.right = Bmp[BUTTZELT].rcDes.left + 35; - Bmp[BUTTZELT].rcDes.bottom = Bmp[BUTTZELT].rcDes.top + 35; - Bmp[BUTTZELT].Breite = static_cast(Bmp[BUTTZELT].rcSrc.right - Bmp[BUTTZELT].rcSrc.left); - Bmp[BUTTZELT].Hoehe = static_cast(Bmp[BUTTZELT].rcSrc.bottom - Bmp[BUTTZELT].rcSrc.top); - Bmp[BUTTZELT].Anzahl = 3; - Bmp[BUTTZELT].Geschwindigkeit = 3; - Bmp[BUTTZELT].Phase = 0; - - // BUTTBOOT - Bmp[BUTTBOOT].rcSrc.left = 448; - Bmp[BUTTBOOT].rcSrc.top = 0; - Bmp[BUTTBOOT].rcSrc.right = 448 + 35; - Bmp[BUTTBOOT].rcSrc.bottom = 35; - Bmp[BUTTBOOT].rcDes.left = rcPanel.left + 111; - Bmp[BUTTBOOT].rcDes.top = rcPanel.top + 270; - Bmp[BUTTBOOT].rcDes.right = Bmp[BUTTBOOT].rcDes.left + 35; - Bmp[BUTTBOOT].rcDes.bottom = Bmp[BUTTBOOT].rcDes.top + 35; - Bmp[BUTTBOOT].Breite = static_cast(Bmp[BUTTBOOT].rcSrc.right - Bmp[BUTTBOOT].rcSrc.left); - Bmp[BUTTBOOT].Hoehe = static_cast(Bmp[BUTTBOOT].rcSrc.bottom - Bmp[BUTTBOOT].rcSrc.top); - Bmp[BUTTBOOT].Anzahl = 3; - Bmp[BUTTBOOT].Geschwindigkeit = 3; - Bmp[BUTTBOOT].Phase = -1; - - // BUTTROHR - Bmp[BUTTROHR].rcSrc.left = 518; - Bmp[BUTTROHR].rcSrc.top = 0; - Bmp[BUTTROHR].rcSrc.right = 518 + 35; - Bmp[BUTTROHR].rcSrc.bottom = 35; - Bmp[BUTTROHR].rcDes.left = rcPanel.left + 152; - Bmp[BUTTROHR].rcDes.top = rcPanel.top + 270; - Bmp[BUTTROHR].rcDes.right = Bmp[BUTTROHR].rcDes.left + 35; - Bmp[BUTTROHR].rcDes.bottom = Bmp[BUTTROHR].rcDes.top + 35; - Bmp[BUTTROHR].Breite = static_cast(Bmp[BUTTROHR].rcSrc.right - Bmp[BUTTROHR].rcSrc.left); - Bmp[BUTTROHR].Hoehe = static_cast(Bmp[BUTTROHR].rcSrc.bottom - Bmp[BUTTROHR].rcSrc.top); - Bmp[BUTTROHR].Anzahl = 4; - Bmp[BUTTROHR].Geschwindigkeit = 2; - Bmp[BUTTROHR].Phase = -1; - - // BUTTSOS - Bmp[BUTTSOS].rcSrc.left = 588; - Bmp[BUTTSOS].rcSrc.top = 0; - Bmp[BUTTSOS].rcSrc.right = 588 + 35; - Bmp[BUTTSOS].rcSrc.bottom = 35; - Bmp[BUTTSOS].rcDes.left = rcPanel.left + 29; - Bmp[BUTTSOS].rcDes.top = rcPanel.top + 325; - Bmp[BUTTSOS].rcDes.right = Bmp[BUTTSOS].rcDes.left + 35; - Bmp[BUTTSOS].rcDes.bottom = Bmp[BUTTSOS].rcDes.top + 35; - Bmp[BUTTSOS].Breite = static_cast(Bmp[BUTTSOS].rcSrc.right - Bmp[BUTTSOS].rcSrc.left); - Bmp[BUTTSOS].Hoehe = static_cast(Bmp[BUTTSOS].rcSrc.bottom - Bmp[BUTTSOS].rcSrc.top); - Bmp[BUTTSOS].Anzahl = 3; - Bmp[BUTTSOS].Geschwindigkeit = 2; - - // BUTTHAUS1 - Bmp[BUTTHAUS1].rcSrc.left = 623; - Bmp[BUTTHAUS1].rcSrc.top = 0; - Bmp[BUTTHAUS1].rcSrc.right = 623 + 35; - Bmp[BUTTHAUS1].rcSrc.bottom = 35; - Bmp[BUTTHAUS1].rcDes.left = rcPanel.left + 70; - Bmp[BUTTHAUS1].rcDes.top = rcPanel.top + 325; - Bmp[BUTTHAUS1].rcDes.right = Bmp[BUTTHAUS1].rcDes.left + 35; - Bmp[BUTTHAUS1].rcDes.bottom = Bmp[BUTTHAUS1].rcDes.top + 35; - Bmp[BUTTHAUS1].Breite = static_cast(Bmp[BUTTHAUS1].rcSrc.right - Bmp[BUTTHAUS1].rcSrc.left); - Bmp[BUTTHAUS1].Hoehe = static_cast(Bmp[BUTTHAUS1].rcSrc.bottom - Bmp[BUTTHAUS1].rcSrc.top); - Bmp[BUTTHAUS1].Anzahl = 5; - Bmp[BUTTHAUS1].Geschwindigkeit = 3; - Bmp[BUTTHAUS1].Phase = -1; - - // BUTTHAUS2 - Bmp[BUTTHAUS2].rcSrc.left = 658; - Bmp[BUTTHAUS2].rcSrc.top = 0; - Bmp[BUTTHAUS2].rcSrc.right = 658 + 35; - Bmp[BUTTHAUS2].rcSrc.bottom = 35; - Bmp[BUTTHAUS2].rcDes.left = rcPanel.left + 111; - Bmp[BUTTHAUS2].rcDes.top = rcPanel.top + 325; - Bmp[BUTTHAUS2].rcDes.right = Bmp[BUTTHAUS2].rcDes.left + 35; - Bmp[BUTTHAUS2].rcDes.bottom = Bmp[BUTTHAUS2].rcDes.top + 35; - Bmp[BUTTHAUS2].Breite = static_cast(Bmp[BUTTHAUS2].rcSrc.right - Bmp[BUTTHAUS2].rcSrc.left); - Bmp[BUTTHAUS2].Hoehe = static_cast(Bmp[BUTTHAUS2].rcSrc.bottom - Bmp[BUTTHAUS2].rcSrc.top); - Bmp[BUTTHAUS2].Anzahl = 4; - Bmp[BUTTHAUS2].Geschwindigkeit = 3; - Bmp[BUTTHAUS2].Phase = -1; - - // BUTTHAUS3 - Bmp[BUTTHAUS3].rcSrc.left = 693; - Bmp[BUTTHAUS3].rcSrc.top = 0; - Bmp[BUTTHAUS3].rcSrc.right = 693 + 35; - Bmp[BUTTHAUS3].rcSrc.bottom = 35; - Bmp[BUTTHAUS3].rcDes.left = rcPanel.left + 152; - Bmp[BUTTHAUS3].rcDes.top = rcPanel.top + 325; - Bmp[BUTTHAUS3].rcDes.right = Bmp[BUTTHAUS3].rcDes.left + 35; - Bmp[BUTTHAUS3].rcDes.bottom = Bmp[BUTTHAUS3].rcDes.top + 35; - Bmp[BUTTHAUS3].Breite = static_cast(Bmp[BUTTHAUS3].rcSrc.right - Bmp[BUTTHAUS3].rcSrc.left); - Bmp[BUTTHAUS3].Hoehe = static_cast(Bmp[BUTTHAUS3].rcSrc.bottom - Bmp[BUTTHAUS3].rcSrc.top); - Bmp[BUTTHAUS3].Anzahl = 4; - Bmp[BUTTHAUS3].Geschwindigkeit = 3; - Bmp[BUTTHAUS3].Phase = -1; - - // BUTTFEUERST - Bmp[BUTTFEUERST].rcSrc.left = 728; - Bmp[BUTTFEUERST].rcSrc.top = 0; - Bmp[BUTTFEUERST].rcSrc.right = 728 + 35; - Bmp[BUTTFEUERST].rcSrc.bottom = 35; - Bmp[BUTTFEUERST].rcDes.left = rcPanel.left + 29; - Bmp[BUTTFEUERST].rcDes.top = rcPanel.top + 380; - Bmp[BUTTFEUERST].rcDes.right = Bmp[BUTTFEUERST].rcDes.left + 35; - Bmp[BUTTFEUERST].rcDes.bottom = Bmp[BUTTFEUERST].rcDes.top + 35; - Bmp[BUTTFEUERST].Breite = static_cast(Bmp[BUTTFEUERST].rcSrc.right - Bmp[BUTTFEUERST].rcSrc.left); - Bmp[BUTTFEUERST].Hoehe = static_cast(Bmp[BUTTFEUERST].rcSrc.bottom - Bmp[BUTTFEUERST].rcSrc.top); - Bmp[BUTTFEUERST].Anzahl = 4; - Bmp[BUTTFEUERST].Geschwindigkeit = 3; - - // BUTTFRAGEZ - Bmp[BUTTFRAGEZ].rcSrc.left = 203; - Bmp[BUTTFRAGEZ].rcSrc.top = 175; - Bmp[BUTTFRAGEZ].rcSrc.right = 203 + 35; - Bmp[BUTTFRAGEZ].rcSrc.bottom = 175 + 35; - Bmp[BUTTFRAGEZ].rcDes.left = 0; - Bmp[BUTTFRAGEZ].rcDes.top = 0; - Bmp[BUTTFRAGEZ].rcDes.right = 0 + 35; - Bmp[BUTTFRAGEZ].rcDes.bottom = 0 + 35; - Bmp[BUTTFRAGEZ].Breite = static_cast(Bmp[BUTTFRAGEZ].rcSrc.right - Bmp[BUTTFRAGEZ].rcSrc.left); - Bmp[BUTTFRAGEZ].Hoehe = static_cast(Bmp[BUTTFRAGEZ].rcSrc.bottom - Bmp[BUTTFRAGEZ].rcSrc.top); - Bmp[BUTTFRAGEZ].Anzahl = 1; - Bmp[BUTTFRAGEZ].Geschwindigkeit = 0; - - // BUTTDESTROY - Bmp[BUTTDESTROY].rcSrc.left = 553; - Bmp[BUTTDESTROY].rcSrc.top = 0; - Bmp[BUTTDESTROY].rcSrc.right = 553 + 35; - Bmp[BUTTDESTROY].rcSrc.bottom = 35; - Bmp[BUTTDESTROY].rcDes.left = rcPanel.left + 152; - Bmp[BUTTDESTROY].rcDes.top = rcPanel.top + 380; - Bmp[BUTTDESTROY].rcDes.right = Bmp[BUTTDESTROY].rcDes.left + 35; - Bmp[BUTTDESTROY].rcDes.bottom = Bmp[BUTTDESTROY].rcDes.top + 35; - Bmp[BUTTDESTROY].Breite = static_cast(Bmp[BUTTDESTROY].rcSrc.right - Bmp[BUTTDESTROY].rcSrc.left); - Bmp[BUTTDESTROY].Hoehe = static_cast(Bmp[BUTTDESTROY].rcSrc.bottom - Bmp[BUTTDESTROY].rcSrc.top); - Bmp[BUTTDESTROY].Anzahl = 4; - Bmp[BUTTDESTROY].Geschwindigkeit = 5; - - // SpzAni - for (i = BAUM1DOWN; i <= BAUM4DOWN; i++) - { - Bmp[i].Animation = true; - Bmp[i].Surface = lpDDSBaum; - Bmp[i].Phase = 0; - Bmp[i].rcDes.left = 0; - Bmp[i].rcDes.top = 0; - Bmp[i].rcDes.right = 0; - Bmp[i].rcDes.bottom = 0; - Bmp[i].Anzahl = 3; - Bmp[i].Geschwindigkeit = 4; - } - // BAUM1DOWN - Bmp[BAUM1DOWN].rcSrc.left = 101; - Bmp[BAUM1DOWN].rcSrc.top = 0; - Bmp[BAUM1DOWN].rcSrc.right = 101 + 35; - Bmp[BAUM1DOWN].rcSrc.bottom = 27; - Bmp[BAUM1DOWN].Breite = static_cast(Bmp[BAUM1DOWN].rcSrc.right - Bmp[BAUM1DOWN].rcSrc.left); - Bmp[BAUM1DOWN].Hoehe = static_cast(Bmp[BAUM1DOWN].rcSrc.bottom - Bmp[BAUM1DOWN].rcSrc.top); - - // BAUM2DOWN - Bmp[BAUM2DOWN].rcSrc.left = 136; - Bmp[BAUM2DOWN].rcSrc.top = 0; - Bmp[BAUM2DOWN].rcSrc.right = 136 + 36; - Bmp[BAUM2DOWN].rcSrc.bottom = 27; - Bmp[BAUM2DOWN].Breite = static_cast(Bmp[BAUM2DOWN].rcSrc.right - Bmp[BAUM2DOWN].rcSrc.left); - Bmp[BAUM2DOWN].Hoehe = static_cast(Bmp[BAUM2DOWN].rcSrc.bottom - Bmp[BAUM2DOWN].rcSrc.top); - - // BAUM3DOWN - Bmp[BAUM3DOWN].rcSrc.left = 172; - Bmp[BAUM3DOWN].rcSrc.top = 0; - Bmp[BAUM3DOWN].rcSrc.right = 172 + 34; - Bmp[BAUM3DOWN].rcSrc.bottom = 28; - Bmp[BAUM3DOWN].Breite = static_cast(Bmp[BAUM3DOWN].rcSrc.right - Bmp[BAUM3DOWN].rcSrc.left); - Bmp[BAUM3DOWN].Hoehe = static_cast(Bmp[BAUM3DOWN].rcSrc.bottom - Bmp[BAUM3DOWN].rcSrc.top); - - // BAUM4DOWN - Bmp[BAUM4DOWN].rcSrc.left = 206; - Bmp[BAUM4DOWN].rcSrc.top = 0; - Bmp[BAUM4DOWN].rcSrc.right = 206 + 32; - Bmp[BAUM4DOWN].rcSrc.bottom = 17; - Bmp[BAUM4DOWN].Breite = static_cast(Bmp[BAUM4DOWN].rcSrc.right - Bmp[BAUM4DOWN].rcSrc.left); - Bmp[BAUM4DOWN].Hoehe = static_cast(Bmp[BAUM4DOWN].rcSrc.bottom - Bmp[BAUM4DOWN].rcSrc.top); - - // Sonstiges - - // Säule1 - Bmp[SAEULE1].Anzahl = 1; - Bmp[SAEULE1].rcSrc.left = 205; - Bmp[SAEULE1].rcSrc.top = 115; - Bmp[SAEULE1].rcSrc.right = Bmp[SAEULE1].rcSrc.left + 11; - Bmp[SAEULE1].rcSrc.bottom = Bmp[SAEULE1].rcSrc.top + 115; - Bmp[SAEULE1].rcDes.left = rcPanel.left + 52; - Bmp[SAEULE1].rcDes.top = rcPanel.top + 471; - Bmp[SAEULE1].rcDes.right = Bmp[SAEULE1].rcDes.left + 11; - Bmp[SAEULE1].rcDes.bottom = Bmp[SAEULE1].rcDes.top + 115; - Bmp[SAEULE1].Breite = static_cast(Bmp[SAEULE1].rcSrc.right - Bmp[SAEULE1].rcSrc.left); - Bmp[SAEULE1].Hoehe = static_cast(Bmp[SAEULE1].rcSrc.bottom - Bmp[SAEULE1].rcSrc.top); - Bmp[SAEULE1].Surface = lpDDSPanel; - - // Säule2 - Bmp[SAEULE2].Anzahl = 1; - Bmp[SAEULE2].rcSrc.left = 216; - Bmp[SAEULE2].rcSrc.top = 115; - Bmp[SAEULE2].rcSrc.right = Bmp[SAEULE2].rcSrc.left + 11; - Bmp[SAEULE2].rcSrc.bottom = Bmp[SAEULE2].rcSrc.top + 115; - Bmp[SAEULE2].rcDes.left = rcPanel.left + 114; - Bmp[SAEULE2].rcDes.top = rcPanel.top + 471; - Bmp[SAEULE2].rcDes.right = Bmp[SAEULE2].rcDes.left + 11; - Bmp[SAEULE2].rcDes.bottom = Bmp[SAEULE2].rcDes.top + 115; - Bmp[SAEULE2].Breite = static_cast(Bmp[SAEULE2].rcSrc.right - Bmp[SAEULE2].rcSrc.left); - Bmp[SAEULE2].Hoehe = static_cast(Bmp[SAEULE2].rcSrc.bottom - Bmp[SAEULE2].rcSrc.top); - Bmp[SAEULE2].Surface = lpDDSPanel; - - // Säule3 - Bmp[SAEULE3].Anzahl = 1; - Bmp[SAEULE3].rcSrc.left = 227; - Bmp[SAEULE3].rcSrc.top = 115; - Bmp[SAEULE3].rcSrc.right = Bmp[SAEULE3].rcSrc.left + 11; - Bmp[SAEULE3].rcSrc.bottom = Bmp[SAEULE3].rcSrc.top + 115; - Bmp[SAEULE3].rcDes.left = rcPanel.left + 175; - Bmp[SAEULE3].rcDes.top = rcPanel.top + 471; - Bmp[SAEULE3].rcDes.right = Bmp[SAEULE3].rcDes.left + 11; - Bmp[SAEULE3].rcDes.bottom = Bmp[SAEULE3].rcDes.top + 115; - Bmp[SAEULE3].Breite = static_cast(Bmp[SAEULE3].rcSrc.right - Bmp[SAEULE3].rcSrc.left); - Bmp[SAEULE3].Hoehe = static_cast(Bmp[SAEULE3].rcSrc.bottom - Bmp[SAEULE3].rcSrc.top); - Bmp[SAEULE3].Surface = lpDDSPanel; - - // Rohstoffe - for (i = ROHAST; i <= ROHSCHLEUDER; i++) - { - Bmp[i].Anzahl = 1; - Bmp[i].rcSrc.left = 18 + (i - ROHAST) * 16; - Bmp[i].rcSrc.top = 0; - Bmp[i].rcSrc.right = Bmp[i].rcSrc.left + 16; - Bmp[i].rcSrc.bottom = Bmp[i].rcSrc.top + 15; - Bmp[i].Breite = static_cast(Bmp[i].rcSrc.right - Bmp[i].rcSrc.left); - Bmp[i].Hoehe = static_cast(Bmp[i].rcSrc.bottom - Bmp[i].rcSrc.top); - Bmp[i].Surface = lpDDSInventar; - } - // RohAst - Bmp[ROHAST].rcDes.left = rcPanel.left + 34; - Bmp[ROHAST].rcDes.top = rcPanel.top + 280; - Bmp[ROHAST].rcDes.right = Bmp[ROHAST].rcDes.left + 16; - Bmp[ROHAST].rcDes.bottom = Bmp[ROHAST].rcDes.top + 15; - // ROHSTEIN - Bmp[ROHSTEIN].rcDes.left = rcPanel.left + 34; - Bmp[ROHSTEIN].rcDes.top = rcPanel.top + 300; - Bmp[ROHSTEIN].rcDes.right = Bmp[ROHSTEIN].rcDes.left + 16; - Bmp[ROHSTEIN].rcDes.bottom = Bmp[ROHSTEIN].rcDes.top + 15; - // ROHSTAMM - Bmp[ROHSTAMM].rcDes.left = rcPanel.left + 34; - Bmp[ROHSTAMM].rcDes.top = rcPanel.top + 360; - Bmp[ROHSTAMM].rcDes.right = Bmp[ROHSTAMM].rcDes.left + 16; - Bmp[ROHSTAMM].rcDes.bottom = Bmp[ROHSTAMM].rcDes.top + 15; - // ROHAXT - Bmp[ROHAXT].rcDes.left = rcPanel.left + 150; - Bmp[ROHAXT].rcDes.top = rcPanel.top + 280; - Bmp[ROHAXT].rcDes.right = Bmp[ROHAXT].rcDes.left + 16; - Bmp[ROHAXT].rcDes.bottom = Bmp[ROHAXT].rcDes.top + 15; - // ROHBLATT - Bmp[ROHBLATT].rcDes.left = rcPanel.left + 34; - Bmp[ROHBLATT].rcDes.top = rcPanel.top + 320; - Bmp[ROHBLATT].rcDes.right = Bmp[ROHBLATT].rcDes.left + 16; - Bmp[ROHBLATT].rcDes.bottom = Bmp[ROHBLATT].rcDes.top + 15; - // ROHEGGE - Bmp[ROHEGGE].rcDes.left = rcPanel.left + 150; - Bmp[ROHEGGE].rcDes.top = rcPanel.top + 300; - Bmp[ROHEGGE].rcDes.right = Bmp[ROHEGGE].rcDes.left + 16; - Bmp[ROHEGGE].rcDes.bottom = Bmp[ROHEGGE].rcDes.top + 15; - // ROHLIANE - Bmp[ROHLIANE].rcDes.left = rcPanel.left + 34; - Bmp[ROHLIANE].rcDes.top = rcPanel.top + 340; - Bmp[ROHLIANE].rcDes.right = Bmp[ROHLIANE].rcDes.left + 16; - Bmp[ROHLIANE].rcDes.bottom = Bmp[ROHLIANE].rcDes.top + 15; - // ROHANGEL - Bmp[ROHANGEL].rcDes.left = rcPanel.left + 150; - Bmp[ROHANGEL].rcDes.top = rcPanel.top + 320; - Bmp[ROHANGEL].rcDes.right = Bmp[ROHANGEL].rcDes.left + 16; - Bmp[ROHANGEL].rcDes.bottom = Bmp[ROHANGEL].rcDes.top + 15; - // ROHHAMMER - Bmp[ROHHAMMER].rcDes.left = rcPanel.left + 150; - Bmp[ROHHAMMER].rcDes.top = rcPanel.top + 340; - Bmp[ROHHAMMER].rcDes.right = Bmp[ROHHAMMER].rcDes.left + 16; - Bmp[ROHHAMMER].rcDes.bottom = Bmp[ROHHAMMER].rcDes.top + 15; - // ROHFERNROHR - Bmp[ROHFERNROHR].rcDes.left = rcPanel.left + 150; - Bmp[ROHFERNROHR].rcDes.top = rcPanel.top + 360; - Bmp[ROHFERNROHR].rcDes.right = Bmp[ROHFERNROHR].rcDes.left + 16; - Bmp[ROHFERNROHR].rcDes.bottom = Bmp[ROHFERNROHR].rcDes.top + 15; - // ROHSTREICHHOLZ - Bmp[ROHSTREICHHOLZ].rcDes.left = rcPanel.left + 105; - Bmp[ROHSTREICHHOLZ].rcDes.top = rcPanel.top + 280; - Bmp[ROHSTREICHHOLZ].rcDes.right = Bmp[ROHSTREICHHOLZ].rcDes.left + 16; - Bmp[ROHSTREICHHOLZ].rcDes.bottom = Bmp[ROHSTREICHHOLZ].rcDes.top + 15; - // ROHSCHAUFEL - Bmp[ROHSCHAUFEL].rcDes.left = rcPanel.left + 105; - Bmp[ROHSCHAUFEL].rcDes.top = rcPanel.top + 320; - Bmp[ROHSCHAUFEL].rcDes.right = Bmp[ROHSCHAUFEL].rcDes.left + 16; - Bmp[ROHSCHAUFEL].rcDes.bottom = Bmp[ROHSCHAUFEL].rcDes.top + 15; - // ROHKARTE - Bmp[ROHKARTE].rcDes.left = rcPanel.left + 105; - Bmp[ROHKARTE].rcDes.top = rcPanel.top + 320; - Bmp[ROHKARTE].rcDes.right = Bmp[ROHKARTE].rcDes.left + 16; - Bmp[ROHKARTE].rcDes.bottom = Bmp[ROHKARTE].rcDes.top + 15; - // ROHSCHLEUDER - Bmp[ROHSCHLEUDER].rcDes.left = rcPanel.left + 105; - Bmp[ROHSCHLEUDER].rcDes.top = rcPanel.top + 340; - Bmp[ROHSCHLEUDER].rcDes.right = Bmp[ROHSCHLEUDER].rcDes.left + 16; - Bmp[ROHSCHLEUDER].rcDes.bottom = Bmp[ROHSCHLEUDER].rcDes.top + 15; - - // ROEMISCH1 - Bmp[ROEMISCH1].Anzahl = 1; - Bmp[ROEMISCH1].rcSrc.left = 0; - Bmp[ROEMISCH1].rcSrc.top = 0; - Bmp[ROEMISCH1].rcSrc.right = Bmp[ROEMISCH1].rcSrc.left + 3; - Bmp[ROEMISCH1].rcSrc.bottom = Bmp[ROEMISCH1].rcSrc.top + 13; - Bmp[ROEMISCH1].rcDes.left = rcPanel.left + 50; - Bmp[ROEMISCH1].rcDes.top = rcPanel.top; - Bmp[ROEMISCH1].rcDes.right = Bmp[ROEMISCH1].rcDes.left + 3; - Bmp[ROEMISCH1].rcDes.bottom = Bmp[ROEMISCH1].rcDes.top + 13; - Bmp[ROEMISCH1].Breite = static_cast(Bmp[ROEMISCH1].rcSrc.right - Bmp[ROEMISCH1].rcSrc.left); - Bmp[ROEMISCH1].Hoehe = static_cast(Bmp[ROEMISCH1].rcSrc.bottom - Bmp[ROEMISCH1].rcSrc.top); - Bmp[ROEMISCH1].Surface = lpDDSInventar; - - // ROEMISCH2 - Bmp[ROEMISCH2].Anzahl = 1; - Bmp[ROEMISCH2].rcSrc.left = 3; - Bmp[ROEMISCH2].rcSrc.top = 0; - Bmp[ROEMISCH2].rcSrc.right = Bmp[ROEMISCH2].rcSrc.left + 15; - Bmp[ROEMISCH2].rcSrc.bottom = Bmp[ROEMISCH2].rcSrc.top + 10; - Bmp[ROEMISCH2].rcDes.left = rcPanel.left + 50; - Bmp[ROEMISCH2].rcDes.top = rcPanel.top; - Bmp[ROEMISCH2].rcDes.right = Bmp[ROEMISCH2].rcDes.left + 15; - Bmp[ROEMISCH2].rcDes.bottom = Bmp[ROEMISCH2].rcDes.top + 10; - Bmp[ROEMISCH2].Breite = static_cast(Bmp[ROEMISCH2].rcSrc.right - Bmp[ROEMISCH2].rcSrc.left); - Bmp[ROEMISCH2].Hoehe = static_cast(Bmp[ROEMISCH2].rcSrc.bottom - Bmp[ROEMISCH2].rcSrc.top); - Bmp[ROEMISCH2].Surface = lpDDSInventar; - - // INVPAPIER - Bmp[INVPAPIER].Anzahl = 1; - Bmp[INVPAPIER].rcSrc.left = 0; - Bmp[INVPAPIER].rcSrc.top = 15; - Bmp[INVPAPIER].rcSrc.right = Bmp[INVPAPIER].rcSrc.left + 178; - Bmp[INVPAPIER].rcSrc.bottom = Bmp[INVPAPIER].rcSrc.top + 114; - Bmp[INVPAPIER].rcDes.left = rcPanel.left + 15; - Bmp[INVPAPIER].rcDes.top = rcPanel.top + 270; - Bmp[INVPAPIER].rcDes.right = Bmp[INVPAPIER].rcDes.left + 178; - Bmp[INVPAPIER].rcDes.bottom = Bmp[INVPAPIER].rcDes.top + 114; - Bmp[INVPAPIER].Breite = static_cast(Bmp[INVPAPIER].rcSrc.right - Bmp[INVPAPIER].rcSrc.left); - Bmp[INVPAPIER].Hoehe = static_cast(Bmp[INVPAPIER].rcSrc.bottom - Bmp[INVPAPIER].rcSrc.top); - Bmp[INVPAPIER].Surface = lpDDSInventar; - - // RING - Bmp[RING].Anzahl = 1; - Bmp[RING].rcSrc.left = 205; - Bmp[RING].rcSrc.top = 230; - Bmp[RING].rcSrc.right = Bmp[RING].rcSrc.left + 37; - Bmp[RING].rcSrc.bottom = Bmp[RING].rcSrc.top + 150; - Bmp[RING].rcDes.left = rcPanel.left + 5; - Bmp[RING].rcDes.top = rcPanel.top - 113; - Bmp[RING].rcDes.right = Bmp[RING].rcDes.left + 30; - Bmp[RING].rcDes.bottom = Bmp[RING].rcDes.top; - Bmp[RING].Breite = static_cast(Bmp[RING].rcSrc.right - Bmp[RING].rcSrc.left); - Bmp[RING].Hoehe = static_cast(Bmp[RING].rcSrc.bottom - Bmp[RING].rcSrc.top); - Bmp[RING].Surface = lpDDSPanel; - - // KREUZ - Bmp[KREUZ].Anzahl = 1; - Bmp[KREUZ].rcSrc.left = 205; - Bmp[KREUZ].rcSrc.top = 380; - Bmp[KREUZ].rcSrc.right = Bmp[KREUZ].rcSrc.left + 40; - Bmp[KREUZ].rcSrc.bottom = Bmp[KREUZ].rcSrc.top + 22; - Bmp[KREUZ].Breite = static_cast(Bmp[KREUZ].rcSrc.right - Bmp[KREUZ].rcSrc.left); - Bmp[KREUZ].Hoehe = static_cast(Bmp[KREUZ].rcSrc.bottom - Bmp[KREUZ].rcSrc.top); - Bmp[KREUZ].Surface = lpDDSPanel; - - // JA - Bmp[JA].Anzahl = 1; - Bmp[JA].rcSrc.left = 0; - Bmp[JA].rcSrc.top = 154; - Bmp[JA].rcSrc.right = Bmp[JA].rcSrc.left + 41; - Bmp[JA].rcSrc.bottom = Bmp[JA].rcSrc.top + 42; - Bmp[JA].Breite = static_cast(Bmp[JA].rcSrc.right - Bmp[JA].rcSrc.left); - Bmp[JA].Hoehe = static_cast(Bmp[JA].rcSrc.bottom - Bmp[JA].rcSrc.top); - Bmp[JA].Surface = lpDDSPapier; - - // NEIN - Bmp[NEIN].Anzahl = 1; - Bmp[NEIN].rcSrc.left = 41; - Bmp[NEIN].rcSrc.top = 154; - Bmp[NEIN].rcSrc.right = Bmp[NEIN].rcSrc.left + 100; - Bmp[NEIN].rcSrc.bottom = Bmp[NEIN].rcSrc.top + 39; - Bmp[NEIN].Breite = static_cast(Bmp[NEIN].rcSrc.right - Bmp[NEIN].rcSrc.left); - Bmp[NEIN].Hoehe = static_cast(Bmp[NEIN].rcSrc.bottom - Bmp[NEIN].rcSrc.top); - Bmp[NEIN].Surface = lpDDSPapier; - - // Sonne - Bmp[SONNE].Anzahl = 1; - Bmp[SONNE].rcSrc.left = 205; - Bmp[SONNE].rcSrc.top = 65; - Bmp[SONNE].rcSrc.right = Bmp[SONNE].rcSrc.left + 51; - Bmp[SONNE].rcSrc.bottom = Bmp[SONNE].rcSrc.top + 50; - Bmp[SONNE].rcDes.left = rcPanel.left + 30; - Bmp[SONNE].rcDes.top = rcPanel.top + 630; - Bmp[SONNE].rcDes.right = Bmp[SONNE].rcDes.left + 152; - Bmp[SONNE].rcDes.bottom = Bmp[SONNE].rcDes.top + 55; - Bmp[SONNE].Breite = static_cast(Bmp[SONNE].rcSrc.right - Bmp[SONNE].rcSrc.left); - Bmp[SONNE].Hoehe = static_cast(Bmp[SONNE].rcSrc.bottom - Bmp[SONNE].rcSrc.top); - Bmp[SONNE].Surface = lpDDSPanel; - - // PROGRAMMIERUNG - Bmp[PROGRAMMIERUNG].Anzahl = 1; - Bmp[PROGRAMMIERUNG].rcSrc.left = 0; - Bmp[PROGRAMMIERUNG].rcSrc.top = 0; - Bmp[PROGRAMMIERUNG].rcSrc.right = Bmp[PROGRAMMIERUNG].rcSrc.left + 348; - Bmp[PROGRAMMIERUNG].rcSrc.bottom = Bmp[PROGRAMMIERUNG].rcSrc.top + 49; - Bmp[PROGRAMMIERUNG].Breite = static_cast(Bmp[PROGRAMMIERUNG].rcSrc.right - Bmp[PROGRAMMIERUNG].rcSrc.left); - Bmp[PROGRAMMIERUNG].Hoehe = static_cast(Bmp[PROGRAMMIERUNG].rcSrc.bottom - Bmp[PROGRAMMIERUNG].rcSrc.top); - Bmp[PROGRAMMIERUNG].rcDes.left = MAXX / 2 - Bmp[PROGRAMMIERUNG].Breite / 2; - Bmp[PROGRAMMIERUNG].rcDes.top = MAXY - Bmp[PROGRAMMIERUNG].Hoehe / 2; - Bmp[PROGRAMMIERUNG].rcDes.right = Bmp[PROGRAMMIERUNG].rcDes.left + Bmp[PROGRAMMIERUNG].Breite; - Bmp[PROGRAMMIERUNG].rcDes.bottom = Bmp[PROGRAMMIERUNG].rcDes.top + Bmp[PROGRAMMIERUNG].Hoehe; - Bmp[PROGRAMMIERUNG].Surface = lpDDSCredits; - - // DIRKPLATE - Bmp[DIRKPLATE].Anzahl = 1; - Bmp[DIRKPLATE].rcSrc.left = 0; - Bmp[DIRKPLATE].rcSrc.top = 49; - Bmp[DIRKPLATE].rcSrc.right = Bmp[DIRKPLATE].rcSrc.left + 196; - Bmp[DIRKPLATE].rcSrc.bottom = Bmp[DIRKPLATE].rcSrc.top + 47; - Bmp[DIRKPLATE].Breite = static_cast(Bmp[DIRKPLATE].rcSrc.right - Bmp[DIRKPLATE].rcSrc.left); - Bmp[DIRKPLATE].Hoehe = static_cast(Bmp[DIRKPLATE].rcSrc.bottom - Bmp[DIRKPLATE].rcSrc.top); - Bmp[DIRKPLATE].rcDes.left = MAXX / 2 - Bmp[DIRKPLATE].Breite / 2; - Bmp[DIRKPLATE].rcDes.top = MAXY - Bmp[DIRKPLATE].Hoehe / 2; - Bmp[DIRKPLATE].rcDes.right = Bmp[DIRKPLATE].rcDes.left + Bmp[DIRKPLATE].Breite; - Bmp[DIRKPLATE].rcDes.bottom = Bmp[DIRKPLATE].rcDes.top + Bmp[DIRKPLATE].Hoehe; - Bmp[DIRKPLATE].Surface = lpDDSCredits; - - // MATTHIAS - Bmp[MATTHIAS].Anzahl = 1; - Bmp[MATTHIAS].rcSrc.left = 0; - Bmp[MATTHIAS].rcSrc.top = 96; - Bmp[MATTHIAS].rcSrc.right = Bmp[MATTHIAS].rcSrc.left + 379; - Bmp[MATTHIAS].rcSrc.bottom = Bmp[MATTHIAS].rcSrc.top + 47; - Bmp[MATTHIAS].Breite = static_cast(Bmp[MATTHIAS].rcSrc.right - Bmp[MATTHIAS].rcSrc.left); - Bmp[MATTHIAS].Hoehe = static_cast(Bmp[MATTHIAS].rcSrc.bottom - Bmp[MATTHIAS].rcSrc.top); - Bmp[MATTHIAS].rcDes.left = MAXX / 2 - Bmp[MATTHIAS].Breite / 2; - Bmp[MATTHIAS].rcDes.top = MAXY - Bmp[MATTHIAS].Hoehe / 2; - Bmp[MATTHIAS].rcDes.right = Bmp[MATTHIAS].rcDes.left + Bmp[MATTHIAS].Breite; - Bmp[MATTHIAS].rcDes.bottom = Bmp[MATTHIAS].rcDes.top + Bmp[MATTHIAS].Hoehe; - Bmp[MATTHIAS].Surface = lpDDSCredits; - - // TESTSPIELER - Bmp[TESTSPIELER].Anzahl = 1; - Bmp[TESTSPIELER].rcSrc.left = 0; - Bmp[TESTSPIELER].rcSrc.top = 143; - Bmp[TESTSPIELER].rcSrc.right = Bmp[TESTSPIELER].rcSrc.left + 210; - Bmp[TESTSPIELER].rcSrc.bottom = Bmp[TESTSPIELER].rcSrc.top + 55; - Bmp[TESTSPIELER].Breite = static_cast(Bmp[TESTSPIELER].rcSrc.right - Bmp[TESTSPIELER].rcSrc.left); - Bmp[TESTSPIELER].Hoehe = static_cast(Bmp[TESTSPIELER].rcSrc.bottom - Bmp[TESTSPIELER].rcSrc.top); - Bmp[TESTSPIELER].rcDes.left = MAXX / 2 - Bmp[TESTSPIELER].Breite / 2; - Bmp[TESTSPIELER].rcDes.top = MAXY - Bmp[TESTSPIELER].Hoehe / 2; - Bmp[TESTSPIELER].rcDes.right = Bmp[TESTSPIELER].rcDes.left + Bmp[TESTSPIELER].Breite; - Bmp[TESTSPIELER].rcDes.bottom = Bmp[TESTSPIELER].rcDes.top + Bmp[TESTSPIELER].Hoehe; - Bmp[TESTSPIELER].Surface = lpDDSCredits; - - // TOBIAS - Bmp[TOBIAS].Anzahl = 1; - Bmp[TOBIAS].rcSrc.left = 0; - Bmp[TOBIAS].rcSrc.top = 198; - Bmp[TOBIAS].rcSrc.right = Bmp[TOBIAS].rcSrc.left + 273; - Bmp[TOBIAS].rcSrc.bottom = Bmp[TOBIAS].rcSrc.top + 56; - Bmp[TOBIAS].Breite = static_cast(Bmp[TOBIAS].rcSrc.right - Bmp[TOBIAS].rcSrc.left); - Bmp[TOBIAS].Hoehe = static_cast(Bmp[TOBIAS].rcSrc.bottom - Bmp[TOBIAS].rcSrc.top); - Bmp[TOBIAS].rcDes.left = MAXX / 2 - Bmp[TOBIAS].Breite / 2; - Bmp[TOBIAS].rcDes.top = MAXY - Bmp[TOBIAS].Hoehe / 2; - Bmp[TOBIAS].rcDes.right = Bmp[TOBIAS].rcDes.left + Bmp[TOBIAS].Breite; - Bmp[TOBIAS].rcDes.bottom = Bmp[TOBIAS].rcDes.top + Bmp[TOBIAS].Hoehe; - Bmp[TOBIAS].Surface = lpDDSCredits; - - // SIGRID - Bmp[SIGRID].Anzahl = 1; - Bmp[SIGRID].rcSrc.left = 0; - Bmp[SIGRID].rcSrc.top = 254; - Bmp[SIGRID].rcSrc.right = Bmp[SIGRID].rcSrc.left + 226; - Bmp[SIGRID].rcSrc.bottom = Bmp[SIGRID].rcSrc.top + 56; - Bmp[SIGRID].Breite = static_cast(Bmp[SIGRID].rcSrc.right - Bmp[SIGRID].rcSrc.left); - Bmp[SIGRID].Hoehe = static_cast(Bmp[SIGRID].rcSrc.bottom - Bmp[SIGRID].rcSrc.top); - Bmp[SIGRID].rcDes.left = MAXX / 2 - Bmp[SIGRID].Breite / 2; - Bmp[SIGRID].rcDes.top = MAXY - Bmp[SIGRID].Hoehe / 2; - Bmp[SIGRID].rcDes.right = Bmp[SIGRID].rcDes.left + Bmp[SIGRID].Breite; - Bmp[SIGRID].rcDes.bottom = Bmp[SIGRID].rcDes.top + Bmp[SIGRID].Hoehe; - Bmp[SIGRID].Surface = lpDDSCredits; - - // PATHFINDING - Bmp[PATHFINDING].Anzahl = 1; - Bmp[PATHFINDING].rcSrc.left = 0; - Bmp[PATHFINDING].rcSrc.top = 353; - Bmp[PATHFINDING].rcSrc.right = Bmp[PATHFINDING].rcSrc.left + 233; - Bmp[PATHFINDING].rcSrc.bottom = Bmp[PATHFINDING].rcSrc.top + 59; - Bmp[PATHFINDING].Breite = static_cast(Bmp[PATHFINDING].rcSrc.right - Bmp[PATHFINDING].rcSrc.left); - Bmp[PATHFINDING].Hoehe = static_cast(Bmp[PATHFINDING].rcSrc.bottom - Bmp[PATHFINDING].rcSrc.top); - Bmp[PATHFINDING].rcDes.left = MAXX / 2 - Bmp[PATHFINDING].Breite / 2; - Bmp[PATHFINDING].rcDes.top = MAXY - Bmp[PATHFINDING].Hoehe / 2; - Bmp[PATHFINDING].rcDes.right = Bmp[PATHFINDING].rcDes.left + Bmp[PATHFINDING].Breite; - Bmp[PATHFINDING].rcDes.bottom = Bmp[PATHFINDING].rcDes.top + Bmp[PATHFINDING].Hoehe; - Bmp[PATHFINDING].Surface = lpDDSCredits; - - // JOHN - Bmp[JOHN].Anzahl = 1; - Bmp[JOHN].rcSrc.left = 0; - Bmp[JOHN].rcSrc.top = 412; - Bmp[JOHN].rcSrc.right = Bmp[JOHN].rcSrc.left + 347; - Bmp[JOHN].rcSrc.bottom = Bmp[JOHN].rcSrc.top + 56; - Bmp[JOHN].Breite = static_cast(Bmp[JOHN].rcSrc.right - Bmp[JOHN].rcSrc.left); - Bmp[JOHN].Hoehe = static_cast(Bmp[JOHN].rcSrc.bottom - Bmp[JOHN].rcSrc.top); - Bmp[JOHN].rcDes.left = MAXX / 2 - Bmp[JOHN].Breite / 2; - Bmp[JOHN].rcDes.top = MAXY - Bmp[JOHN].Hoehe / 2; - Bmp[JOHN].rcDes.right = Bmp[JOHN].rcDes.left + Bmp[JOHN].Breite; - Bmp[JOHN].rcDes.bottom = Bmp[JOHN].rcDes.top + Bmp[JOHN].Hoehe; - Bmp[JOHN].Surface = lpDDSCredits; - - // HEIKO - Bmp[HEIKO].Anzahl = 1; - Bmp[HEIKO].rcSrc.left = 0; - Bmp[HEIKO].rcSrc.top = 468; - Bmp[HEIKO].rcSrc.right = Bmp[HEIKO].rcSrc.left + 236; - Bmp[HEIKO].rcSrc.bottom = Bmp[HEIKO].rcSrc.top + 47; - Bmp[HEIKO].Breite = static_cast(Bmp[HEIKO].rcSrc.right - Bmp[HEIKO].rcSrc.left); - Bmp[HEIKO].Hoehe = static_cast(Bmp[HEIKO].rcSrc.bottom - Bmp[HEIKO].rcSrc.top); - Bmp[HEIKO].rcDes.left = MAXX / 2 - Bmp[HEIKO].Breite / 2; - Bmp[HEIKO].rcDes.top = MAXY - Bmp[HEIKO].Hoehe / 2; - Bmp[HEIKO].rcDes.right = Bmp[HEIKO].rcDes.left + Bmp[HEIKO].Breite; - Bmp[HEIKO].rcDes.bottom = Bmp[HEIKO].rcDes.top + Bmp[HEIKO].Hoehe; - Bmp[HEIKO].Surface = lpDDSCredits; - - // GISELA - Bmp[GISELA].Anzahl = 1; - Bmp[GISELA].rcSrc.left = 0; - Bmp[GISELA].rcSrc.top = 515; - Bmp[GISELA].rcSrc.right = Bmp[GISELA].rcSrc.left + 232; - Bmp[GISELA].rcSrc.bottom = Bmp[GISELA].rcSrc.top + 47; - Bmp[GISELA].Breite = static_cast(Bmp[GISELA].rcSrc.right - Bmp[GISELA].rcSrc.left); - Bmp[GISELA].Hoehe = static_cast(Bmp[GISELA].rcSrc.bottom - Bmp[GISELA].rcSrc.top); - Bmp[GISELA].rcDes.left = MAXX / 2 - Bmp[GISELA].Breite / 2; - Bmp[GISELA].rcDes.top = MAXY - Bmp[GISELA].Hoehe / 2; - Bmp[GISELA].rcDes.right = Bmp[GISELA].rcDes.left + Bmp[GISELA].Breite; - Bmp[GISELA].rcDes.bottom = Bmp[GISELA].rcDes.top + Bmp[GISELA].Hoehe; - Bmp[GISELA].Surface = lpDDSCredits; - - // WEITEREHILFE - Bmp[WEITEREHILFE].Anzahl = 1; - Bmp[WEITEREHILFE].rcSrc.left = 0; - Bmp[WEITEREHILFE].rcSrc.top = 562; - Bmp[WEITEREHILFE].rcSrc.right = Bmp[WEITEREHILFE].rcSrc.left + 258; - Bmp[WEITEREHILFE].rcSrc.bottom = Bmp[WEITEREHILFE].rcSrc.top + 46; - Bmp[WEITEREHILFE].Breite = static_cast(Bmp[WEITEREHILFE].rcSrc.right - Bmp[WEITEREHILFE].rcSrc.left); - Bmp[WEITEREHILFE].Hoehe = static_cast(Bmp[WEITEREHILFE].rcSrc.bottom - Bmp[WEITEREHILFE].rcSrc.top); - Bmp[WEITEREHILFE].rcDes.left = MAXX / 2 - Bmp[WEITEREHILFE].Breite / 2; - Bmp[WEITEREHILFE].rcDes.top = MAXY - Bmp[WEITEREHILFE].Hoehe / 2; - Bmp[WEITEREHILFE].rcDes.right = Bmp[WEITEREHILFE].rcDes.left + Bmp[WEITEREHILFE].Breite; - Bmp[WEITEREHILFE].rcDes.bottom = Bmp[WEITEREHILFE].rcDes.top + Bmp[WEITEREHILFE].Hoehe; - Bmp[WEITEREHILFE].Surface = lpDDSCredits; - - // DPSOFTWARE - Bmp[DPSOFTWARE].Anzahl = 1; - Bmp[DPSOFTWARE].rcSrc.left = 0; - Bmp[DPSOFTWARE].rcSrc.top = 608; - Bmp[DPSOFTWARE].rcSrc.right = Bmp[DPSOFTWARE].rcSrc.left + 291; - Bmp[DPSOFTWARE].rcSrc.bottom = Bmp[DPSOFTWARE].rcSrc.top + 99; - Bmp[DPSOFTWARE].Breite = static_cast(Bmp[DPSOFTWARE].rcSrc.right - Bmp[DPSOFTWARE].rcSrc.left); - Bmp[DPSOFTWARE].Hoehe = static_cast(Bmp[DPSOFTWARE].rcSrc.bottom - Bmp[DPSOFTWARE].rcSrc.top); - Bmp[DPSOFTWARE].rcDes.left = MAXX / 2 - Bmp[DPSOFTWARE].Breite / 2; - Bmp[DPSOFTWARE].rcDes.top = MAXY - Bmp[DPSOFTWARE].Hoehe / 2; - Bmp[DPSOFTWARE].rcDes.right = Bmp[DPSOFTWARE].rcDes.left + Bmp[DPSOFTWARE].Breite; - Bmp[DPSOFTWARE].rcDes.bottom = Bmp[DPSOFTWARE].rcDes.top + Bmp[DPSOFTWARE].Hoehe; - Bmp[DPSOFTWARE].Surface = lpDDSCredits; - - // SCHWARZ - Bmp[SCHWARZ].Anzahl = 1; - Bmp[SCHWARZ].rcSrc.left = 0; - Bmp[SCHWARZ].rcSrc.top = 608; - Bmp[SCHWARZ].rcSrc.right = Bmp[SCHWARZ].rcSrc.left + 1; - Bmp[SCHWARZ].rcSrc.bottom = Bmp[SCHWARZ].rcSrc.top + 1; - Bmp[SCHWARZ].Breite = static_cast(Bmp[SCHWARZ].rcSrc.right - Bmp[SCHWARZ].rcSrc.left); - Bmp[SCHWARZ].Hoehe = static_cast(Bmp[SCHWARZ].rcSrc.bottom - Bmp[SCHWARZ].rcSrc.top); - Bmp[SCHWARZ].rcDes.left = MAXX / 2 - Bmp[SCHWARZ].Breite / 2; - Bmp[SCHWARZ].rcDes.top = MAXY - Bmp[SCHWARZ].Hoehe / 2; - Bmp[SCHWARZ].rcDes.right = Bmp[SCHWARZ].rcDes.left + Bmp[SCHWARZ].Breite; - Bmp[SCHWARZ].rcDes.bottom = Bmp[SCHWARZ].rcDes.top + Bmp[SCHWARZ].Hoehe; - Bmp[SCHWARZ].Surface = lpDDSCredits; - - // SOUNDS - Bmp[SOUNDS].Anzahl = 1; - Bmp[SOUNDS].rcSrc.left = 0; - Bmp[SOUNDS].rcSrc.top = 310; - Bmp[SOUNDS].rcSrc.right = Bmp[SOUNDS].rcSrc.left + 144; - Bmp[SOUNDS].rcSrc.bottom = Bmp[SOUNDS].rcSrc.top + 43; - Bmp[SOUNDS].Breite = static_cast(Bmp[SOUNDS].rcSrc.right - Bmp[SOUNDS].rcSrc.left); - Bmp[SOUNDS].Hoehe = static_cast(Bmp[SOUNDS].rcSrc.bottom - Bmp[SOUNDS].rcSrc.top); - Bmp[SOUNDS].rcDes.left = MAXX / 2 - Bmp[SOUNDS].Breite / 2; - Bmp[SOUNDS].rcDes.top = MAXY - Bmp[SOUNDS].Hoehe / 2; - Bmp[SOUNDS].rcDes.right = Bmp[SOUNDS].rcDes.left + Bmp[SOUNDS].Breite; - Bmp[SOUNDS].rcDes.bottom = Bmp[SOUNDS].rcDes.top + Bmp[SOUNDS].Hoehe; - Bmp[SOUNDS].Surface = lpDDSCredits; - - // MUSIK - Bmp[MUSIK].Anzahl = 1; - Bmp[MUSIK].rcSrc.left = 160; - Bmp[MUSIK].rcSrc.top = 310; - Bmp[MUSIK].rcSrc.right = Bmp[MUSIK].rcSrc.left + 124; - Bmp[MUSIK].rcSrc.bottom = Bmp[MUSIK].rcSrc.top + 39; - Bmp[MUSIK].Breite = static_cast(Bmp[MUSIK].rcSrc.right - Bmp[MUSIK].rcSrc.left); - Bmp[MUSIK].Hoehe = static_cast(Bmp[MUSIK].rcSrc.bottom - Bmp[MUSIK].rcSrc.top); - Bmp[MUSIK].rcDes.left = MAXX / 2 - Bmp[MUSIK].Breite / 2; - Bmp[MUSIK].rcDes.top = MAXY - Bmp[MUSIK].Hoehe / 2; - Bmp[MUSIK].rcDes.right = Bmp[MUSIK].rcDes.left + Bmp[MUSIK].Breite; - Bmp[MUSIK].rcDes.bottom = Bmp[MUSIK].rcDes.top + Bmp[MUSIK].Hoehe; - Bmp[MUSIK].Surface = lpDDSCredits; - - for (i = 0; i < 10; i++) - for (k = 0; k < 10; k++) - { - AbspannListe[i][k].Aktiv = false; - AbspannListe[i][k].Bild = -1; - } - AbspannListe[0][0].Bild = PROGRAMMIERUNG; - AbspannListe[0][1].Aktiv = true; // nur den hier true setzen, löst dann alles andere aus - AbspannListe[0][1].Bild = DIRKPLATE; - AbspannListe[1][0].Bild = MUSIK; - AbspannListe[1][1].Bild = HEIKO; - AbspannListe[2][0].Bild = SOUNDS; - AbspannListe[2][1].Bild = DIRKPLATE; - AbspannListe[3][0].Bild = TESTSPIELER; - AbspannListe[3][1].Bild = MATTHIAS; - AbspannListe[3][2].Bild = TOBIAS; - AbspannListe[3][3].Bild = SIGRID; - AbspannListe[4][0].Bild = PATHFINDING; - AbspannListe[4][1].Bild = JOHN; - AbspannListe[5][0].Bild = WEITEREHILFE; - AbspannListe[5][1].Bild = HEIKO; - AbspannListe[5][2].Bild = GISELA; - AbspannListe[6][0].Bild = SCHWARZ; - AbspannListe[6][1].Bild = DPSOFTWARE; - - // Textausgabe - TextBereich[TXTTEXTFELD].Aktiv = false; - TextBereich[TXTTEXTFELD].rcText.left = 9; - TextBereich[TXTTEXTFELD].rcText.top = MAXY - 17; - TextBereich[TXTTEXTFELD].rcText.right = MAXX - 200; - TextBereich[TXTTEXTFELD].rcText.bottom = MAXY - 2; - - TextBereich[TXTFPS].Aktiv = false; - TextBereich[TXTFPS].rcText.left = MAXX - 40; - TextBereich[TXTFPS].rcText.top = 3; - TextBereich[TXTFPS].rcText.right = TextBereich[TXTFPS].rcText.left + 2 * S1XPIXEL; - TextBereich[TXTFPS].rcText.bottom = TextBereich[TXTFPS].rcText.top + S1YPIXEL; - - TextBereich[TXTTAGESZEIT].Aktiv = true; - TextBereich[TXTTAGESZEIT].rcText.left = MAXX - 110; - TextBereich[TXTTAGESZEIT].rcText.top = MAXY - 20; - TextBereich[TXTTAGESZEIT].rcText.right = TextBereich[TXTTAGESZEIT].rcText.left + 5 * S2XPIXEL; - TextBereich[TXTTAGESZEIT].rcText.bottom = TextBereich[TXTTAGESZEIT].rcText.top + S2YPIXEL; - - TextBereich[TXTPAPIER].Aktiv = false; - TextBereich[TXTPAPIER].rcText.left = 450; - TextBereich[TXTPAPIER].rcText.top = 160; - TextBereich[TXTPAPIER].rcText.right = 830; - TextBereich[TXTPAPIER].rcText.bottom = 560; - - TextBereich[TXTCHANCE].Aktiv = false; - TextBereich[TXTCHANCE].rcText.left = Bmp[RING].rcDes.left + 5; - TextBereich[TXTCHANCE].rcText.top = Bmp[RING].rcDes.top + Bmp[RING].Hoehe + 10; - TextBereich[TXTCHANCE].rcText.right = TextBereich[TXTCHANCE].rcText.left + 3 * S2XPIXEL; - TextBereich[TXTCHANCE].rcText.bottom = TextBereich[TXTCHANCE].rcText.top + S2YPIXEL; - - Guy.Resource[WASSER] = 100; - Guy.Resource[NAHRUNG] = 100; - Guy.Resource[GESUNDHEIT] = 100; - - for (i = ROHAST; i <= ROHSCHLEUDER; i++) - { - Guy.Inventar[i] = 0; - } - CursorTyp = CUPFEIL; - Gitter = false; - PapierText = -1; - HauptMenue = 0; - TwoClicks = -1; - Nacht = false; - Frage = -1; - LastBild = 100; - Bild = 0; - MousePosition.x = MAXX / 2; - MousePosition.y = MAXY / 2; - Direct::Reset(); - SchatzPos.x = -1; - SchatzPos.y = -1; - SchatzGef = false; + // Guy + for (i = Tiles::GUY_LEFT; i <= Tiles::GUY_BELOW; i++) { + Bmp[i].IsAnimationRunning = false; + Bmp[i].AnimationPhaseCount = 4; + Bmp[i].Speed = 30; + Bmp[i].AnimationPhase = 0; + Bmp[i].Surface = lpDDSGuyAni; + Bmp[i].sourceRect.left = 7 * (i - Tiles::GUY_LEFT); + Bmp[i].sourceRect.right = 7 + 7 * (i - Tiles::GUY_LEFT); + Bmp[i].sourceRect.top = 0; + Bmp[i].sourceRect.bottom = 18; + Bmp[i].Width = 7; + Bmp[i].Height = 18; + } + + for (i = Tiles::GUY_SEARCH; i <= Tiles::GUY_SLINGSHOT; i++) { + Bmp[i].IsAnimationRunning = false; + Bmp[i].AnimationPhase = 0; + Bmp[i].Surface = lpDDSGuyAni; + } + + Bmp[Tiles::GUY_SEARCH].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_SEARCH].Speed = 4; + Bmp[Tiles::GUY_SEARCH].sourceRect.left = 28; + Bmp[Tiles::GUY_SEARCH].sourceRect.right = 39; + Bmp[Tiles::GUY_SEARCH].sourceRect.top = 0; + Bmp[Tiles::GUY_SEARCH].sourceRect.bottom = 14; + Bmp[Tiles::GUY_SEARCH].Width = 11; + Bmp[Tiles::GUY_SEARCH].Height = 14; + Bmp[Tiles::GUY_SEARCH].Sound = Sound::CRACKLE; + + Bmp[Tiles::GUY_EAT].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_EAT].Speed = 4; + Bmp[Tiles::GUY_EAT].sourceRect.left = 39; + Bmp[Tiles::GUY_EAT].sourceRect.right = 39 + 7; + Bmp[Tiles::GUY_EAT].sourceRect.top = 0; + Bmp[Tiles::GUY_EAT].sourceRect.bottom = 17; + Bmp[Tiles::GUY_EAT].Width = 7; + Bmp[Tiles::GUY_EAT].Height = 17; + Bmp[Tiles::GUY_EAT].Sound = Sound::CRACKLE; + + Bmp[Tiles::GUY_DRINK].AnimationPhaseCount = 5; + Bmp[Tiles::GUY_DRINK].Speed = 4; + Bmp[Tiles::GUY_DRINK].sourceRect.left = 46; + Bmp[Tiles::GUY_DRINK].sourceRect.right = 46 + 9; + Bmp[Tiles::GUY_DRINK].sourceRect.top = 0; + Bmp[Tiles::GUY_DRINK].sourceRect.bottom = 13; + Bmp[Tiles::GUY_DRINK].Width = 9; + Bmp[Tiles::GUY_DRINK].Height = 13; + Bmp[Tiles::GUY_DRINK].Sound = Sound::DRINK; + + Bmp[Tiles::GUY_CHOP].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_CHOP].Speed = 6; + Bmp[Tiles::GUY_CHOP].sourceRect.left = 55; + Bmp[Tiles::GUY_CHOP].sourceRect.right = 55 + 15; + Bmp[Tiles::GUY_CHOP].sourceRect.top = 0; + Bmp[Tiles::GUY_CHOP].sourceRect.bottom = 19; + Bmp[Tiles::GUY_CHOP].Width = 15; + Bmp[Tiles::GUY_CHOP].Height = 19; + Bmp[Tiles::GUY_CHOP].Sound = Sound::LOG; + + Bmp[Tiles::GUY_WAITING].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_WAITING].Speed = 2; + Bmp[Tiles::GUY_WAITING].sourceRect.left = 70; + Bmp[Tiles::GUY_WAITING].sourceRect.right = 70 + 7; + Bmp[Tiles::GUY_WAITING].sourceRect.top = 0; + Bmp[Tiles::GUY_WAITING].sourceRect.bottom = 18; + Bmp[Tiles::GUY_WAITING].Width = 7; + Bmp[Tiles::GUY_WAITING].Height = 18; + + Bmp[Tiles::GUY_FARMING].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_FARMING].Speed = 4; + Bmp[Tiles::GUY_FARMING].sourceRect.left = 78; + Bmp[Tiles::GUY_FARMING].sourceRect.right = 78 + 19; + Bmp[Tiles::GUY_FARMING].sourceRect.top = 0; + Bmp[Tiles::GUY_FARMING].sourceRect.bottom = 18; + Bmp[Tiles::GUY_FARMING].Width = 19; + Bmp[Tiles::GUY_FARMING].Height = 18; + + Bmp[Tiles::GUY_TIE_UP].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_TIE_UP].Speed = 1; + Bmp[Tiles::GUY_TIE_UP].sourceRect.left = 97; + Bmp[Tiles::GUY_TIE_UP].sourceRect.right = 97 + 8; + Bmp[Tiles::GUY_TIE_UP].sourceRect.top = 0; + Bmp[Tiles::GUY_TIE_UP].sourceRect.bottom = 18; + Bmp[Tiles::GUY_TIE_UP].Width = 8; + Bmp[Tiles::GUY_TIE_UP].Height = 18; + + Bmp[Tiles::GUY_TIE_DOWN].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_TIE_DOWN].Speed = 1; + Bmp[Tiles::GUY_TIE_DOWN].sourceRect.left = 98; + Bmp[Tiles::GUY_TIE_DOWN].sourceRect.right = 98 + 7; + Bmp[Tiles::GUY_TIE_DOWN].sourceRect.top = 36; + Bmp[Tiles::GUY_TIE_DOWN].sourceRect.bottom = 36 + 18; + Bmp[Tiles::GUY_TIE_DOWN].Width = 7; + Bmp[Tiles::GUY_TIE_DOWN].Height = 18; + + Bmp[Tiles::GUY_SLEEPING_TENT].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_SLEEPING_TENT].Speed = 1; + Bmp[Tiles::GUY_SLEEPING_TENT].sourceRect.left = 105; + Bmp[Tiles::GUY_SLEEPING_TENT].sourceRect.right = 105 + 20; + Bmp[Tiles::GUY_SLEEPING_TENT].sourceRect.top = 54; + Bmp[Tiles::GUY_SLEEPING_TENT].sourceRect.bottom = 54 + 10; + Bmp[Tiles::GUY_SLEEPING_TENT].Width = 20; + Bmp[Tiles::GUY_SLEEPING_TENT].Height = 10; + Bmp[Tiles::GUY_SLEEPING_TENT].Sound = Sound::SNORE; + + Bmp[Tiles::GUY_SLEEPING].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_SLEEPING].Speed = 1; + Bmp[Tiles::GUY_SLEEPING].sourceRect.left = 125; + Bmp[Tiles::GUY_SLEEPING].sourceRect.right = 125 + 17; + Bmp[Tiles::GUY_SLEEPING].sourceRect.top = 36; + Bmp[Tiles::GUY_SLEEPING].sourceRect.bottom = 36 + 18; + Bmp[Tiles::GUY_SLEEPING].Width = 17; + Bmp[Tiles::GUY_SLEEPING].Height = 18; + Bmp[Tiles::GUY_SLEEPING].Sound = Sound::SNORE; + + Bmp[Tiles::GUY_ENTER_TENT].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_ENTER_TENT].Speed = 4; + Bmp[Tiles::GUY_ENTER_TENT].sourceRect.left = 105; + Bmp[Tiles::GUY_ENTER_TENT].sourceRect.right = 105 + 7; + Bmp[Tiles::GUY_ENTER_TENT].sourceRect.top = 0; + Bmp[Tiles::GUY_ENTER_TENT].sourceRect.bottom = 0 + 18; + Bmp[Tiles::GUY_ENTER_TENT].Width = 7; + Bmp[Tiles::GUY_ENTER_TENT].Height = 18; + + Bmp[Tiles::GUY_LAYING_TENT].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_LAYING_TENT].Speed = 2; + Bmp[Tiles::GUY_LAYING_TENT].sourceRect.left = 125; + Bmp[Tiles::GUY_LAYING_TENT].sourceRect.right = 125 + 17; + Bmp[Tiles::GUY_LAYING_TENT].sourceRect.top = 0; + Bmp[Tiles::GUY_LAYING_TENT].sourceRect.bottom = 0 + 18; + Bmp[Tiles::GUY_LAYING_TENT].Width = 17; + Bmp[Tiles::GUY_LAYING_TENT].Height = 18; + + Bmp[Tiles::GUY_STAND_UP].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_STAND_UP].Speed = 2; + Bmp[Tiles::GUY_STAND_UP].sourceRect.left = 142; + Bmp[Tiles::GUY_STAND_UP].sourceRect.right = 142 + 9; + Bmp[Tiles::GUY_STAND_UP].sourceRect.top = 0; + Bmp[Tiles::GUY_STAND_UP].sourceRect.bottom = 0 + 18; + Bmp[Tiles::GUY_STAND_UP].Width = 9; + Bmp[Tiles::GUY_STAND_UP].Height = 18; + + Bmp[Tiles::GUY_FISHING_LEFT_1].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_FISHING_LEFT_1].Speed = 6; + Bmp[Tiles::GUY_FISHING_LEFT_1].sourceRect.left = 151; + Bmp[Tiles::GUY_FISHING_LEFT_1].sourceRect.right = 151 + 16; + Bmp[Tiles::GUY_FISHING_LEFT_1].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_LEFT_1].sourceRect.bottom = 0 + 17; + Bmp[Tiles::GUY_FISHING_LEFT_1].Width = 16; + Bmp[Tiles::GUY_FISHING_LEFT_1].Height = 17; + + Bmp[Tiles::GUY_FISHING_ABOVE_1].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_FISHING_ABOVE_1].Speed = 6; + Bmp[Tiles::GUY_FISHING_ABOVE_1].sourceRect.left = 167; + Bmp[Tiles::GUY_FISHING_ABOVE_1].sourceRect.right = 167 + 16; + Bmp[Tiles::GUY_FISHING_ABOVE_1].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_ABOVE_1].sourceRect.bottom = 0 + 17; + Bmp[Tiles::GUY_FISHING_ABOVE_1].Width = 16; + Bmp[Tiles::GUY_FISHING_ABOVE_1].Height = 17; + + Bmp[Tiles::GUY_FISHING_RIGHT_1].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_FISHING_RIGHT_1].Speed = 6; + Bmp[Tiles::GUY_FISHING_RIGHT_1].sourceRect.left = 183; + Bmp[Tiles::GUY_FISHING_RIGHT_1].sourceRect.right = 183 + 14; + Bmp[Tiles::GUY_FISHING_RIGHT_1].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_RIGHT_1].sourceRect.bottom = 0 + 17; + Bmp[Tiles::GUY_FISHING_RIGHT_1].Width = 14; + Bmp[Tiles::GUY_FISHING_RIGHT_1].Height = 17; + + Bmp[Tiles::GUY_FISHING_BELOW_1].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_FISHING_BELOW_1].Speed = 6; + Bmp[Tiles::GUY_FISHING_BELOW_1].sourceRect.left = 197; + Bmp[Tiles::GUY_FISHING_BELOW_1].sourceRect.right = 197 + 14; + Bmp[Tiles::GUY_FISHING_BELOW_1].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_BELOW_1].sourceRect.bottom = 0 + 17; + Bmp[Tiles::GUY_FISHING_BELOW_1].Width = 14; + Bmp[Tiles::GUY_FISHING_BELOW_1].Height = 17; + + Bmp[Tiles::GUY_FISHING_LEFT_2].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_FISHING_LEFT_2].Speed = 3; + Bmp[Tiles::GUY_FISHING_LEFT_2].sourceRect.left = 211; + Bmp[Tiles::GUY_FISHING_LEFT_2].sourceRect.right = 211 + 16; + Bmp[Tiles::GUY_FISHING_LEFT_2].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_LEFT_2].sourceRect.bottom = 0 + 16; + Bmp[Tiles::GUY_FISHING_LEFT_2].Width = 16; + Bmp[Tiles::GUY_FISHING_LEFT_2].Height = 16; + + Bmp[Tiles::GUY_FISHING_ABOVE_2].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_FISHING_ABOVE_2].Speed = 3; + Bmp[Tiles::GUY_FISHING_ABOVE_2].sourceRect.left = 227; + Bmp[Tiles::GUY_FISHING_ABOVE_2].sourceRect.right = 227 + 16; + Bmp[Tiles::GUY_FISHING_ABOVE_2].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_ABOVE_2].sourceRect.bottom = 0 + 16; + Bmp[Tiles::GUY_FISHING_ABOVE_2].Width = 16; + Bmp[Tiles::GUY_FISHING_ABOVE_2].Height = 16; + + Bmp[Tiles::GUY_FISHING_RIGHT_2].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_FISHING_RIGHT_2].Speed = 3; + Bmp[Tiles::GUY_FISHING_RIGHT_2].sourceRect.left = 243; + Bmp[Tiles::GUY_FISHING_RIGHT_2].sourceRect.right = 243 + 14; + Bmp[Tiles::GUY_FISHING_RIGHT_2].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_RIGHT_2].sourceRect.bottom = 0 + 15; + Bmp[Tiles::GUY_FISHING_RIGHT_2].Width = 14; + Bmp[Tiles::GUY_FISHING_RIGHT_2].Height = 15; + + Bmp[Tiles::GUY_FISHING_BELOW_2].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_FISHING_BELOW_2].Speed = 3; + Bmp[Tiles::GUY_FISHING_BELOW_2].sourceRect.left = 257; + Bmp[Tiles::GUY_FISHING_BELOW_2].sourceRect.right = 257 + 14; + Bmp[Tiles::GUY_FISHING_BELOW_2].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_BELOW_2].sourceRect.bottom = 0 + 15; + Bmp[Tiles::GUY_FISHING_BELOW_2].Width = 14; + Bmp[Tiles::GUY_FISHING_BELOW_2].Height = 15; + + Bmp[Tiles::GUY_FISHING_LEFT_3].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_FISHING_LEFT_3].Speed = 2; + Bmp[Tiles::GUY_FISHING_LEFT_3].sourceRect.left = 271; + Bmp[Tiles::GUY_FISHING_LEFT_3].sourceRect.right = 271 + 16; + Bmp[Tiles::GUY_FISHING_LEFT_3].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_LEFT_3].sourceRect.bottom = 0 + 16; + Bmp[Tiles::GUY_FISHING_LEFT_3].Width = 16; + Bmp[Tiles::GUY_FISHING_LEFT_3].Height = 16; + + Bmp[Tiles::GUY_FISHING_ABOVE_3].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_FISHING_ABOVE_3].Speed = 2; + Bmp[Tiles::GUY_FISHING_ABOVE_3].sourceRect.left = 285; + Bmp[Tiles::GUY_FISHING_ABOVE_3].sourceRect.right = 285 + 16; + Bmp[Tiles::GUY_FISHING_ABOVE_3].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_ABOVE_3].sourceRect.bottom = 0 + 16; + Bmp[Tiles::GUY_FISHING_ABOVE_3].Width = 16; + Bmp[Tiles::GUY_FISHING_ABOVE_3].Height = 16; + + Bmp[Tiles::GUY_FISHING_RIGHT_3].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_FISHING_RIGHT_3].Speed = 2; + Bmp[Tiles::GUY_FISHING_RIGHT_3].sourceRect.left = 299; + Bmp[Tiles::GUY_FISHING_RIGHT_3].sourceRect.right = 299 + 14; + Bmp[Tiles::GUY_FISHING_RIGHT_3].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_RIGHT_3].sourceRect.bottom = 0 + 15; + Bmp[Tiles::GUY_FISHING_RIGHT_3].Width = 14; + Bmp[Tiles::GUY_FISHING_RIGHT_3].Height = 15; + + Bmp[Tiles::GUY_FISHING_BELOW_3].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_FISHING_BELOW_3].Speed = 2; + Bmp[Tiles::GUY_FISHING_BELOW_3].sourceRect.left = 313; + Bmp[Tiles::GUY_FISHING_BELOW_3].sourceRect.right = 313 + 14; + Bmp[Tiles::GUY_FISHING_BELOW_3].sourceRect.top = 0; + Bmp[Tiles::GUY_FISHING_BELOW_3].sourceRect.bottom = 0 + 15; + Bmp[Tiles::GUY_FISHING_BELOW_3].Width = 14; + Bmp[Tiles::GUY_FISHING_BELOW_3].Height = 15; + + Bmp[Tiles::GUY_BEAT].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_BEAT].Speed = 7; + Bmp[Tiles::GUY_BEAT].sourceRect.left = 327; + Bmp[Tiles::GUY_BEAT].sourceRect.right = 327 + 12; + Bmp[Tiles::GUY_BEAT].sourceRect.top = 0; + Bmp[Tiles::GUY_BEAT].sourceRect.bottom = 0 + 24; + Bmp[Tiles::GUY_BEAT].Width = 12; + Bmp[Tiles::GUY_BEAT].Height = 24; + Bmp[Tiles::GUY_BEAT].Sound = Sound::HIT; + + Bmp[Tiles::GUY_BOAT_LEFT].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_BOAT_LEFT].Speed = 10; + Bmp[Tiles::GUY_BOAT_LEFT].sourceRect.left = 339; + Bmp[Tiles::GUY_BOAT_LEFT].sourceRect.right = 339 + 26; + Bmp[Tiles::GUY_BOAT_LEFT].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_LEFT].sourceRect.bottom = 0 + 21; + Bmp[Tiles::GUY_BOAT_LEFT].Width = 26; + Bmp[Tiles::GUY_BOAT_LEFT].Height = 21; + + Bmp[Tiles::GUY_BOAT_ABOVE].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_BOAT_ABOVE].Speed = 10; + Bmp[Tiles::GUY_BOAT_ABOVE].sourceRect.left = 365; + Bmp[Tiles::GUY_BOAT_ABOVE].sourceRect.right = 365 + 26; + Bmp[Tiles::GUY_BOAT_ABOVE].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_ABOVE].sourceRect.bottom = 0 + 21; + Bmp[Tiles::GUY_BOAT_ABOVE].Width = 26; + Bmp[Tiles::GUY_BOAT_ABOVE].Height = 21; + + Bmp[Tiles::GUY_BOAT_RIGHT].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_BOAT_RIGHT].Speed = 10; + Bmp[Tiles::GUY_BOAT_RIGHT].sourceRect.left = 391; + Bmp[Tiles::GUY_BOAT_RIGHT].sourceRect.right = 391 + 26; + Bmp[Tiles::GUY_BOAT_RIGHT].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_RIGHT].sourceRect.bottom = 0 + 21; + Bmp[Tiles::GUY_BOAT_RIGHT].Width = 26; + Bmp[Tiles::GUY_BOAT_RIGHT].Height = 21; + + Bmp[Tiles::GUY_BOAT_BELOW].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_BOAT_BELOW].Speed = 10; + Bmp[Tiles::GUY_BOAT_BELOW].sourceRect.left = 417; + Bmp[Tiles::GUY_BOAT_BELOW].sourceRect.right = 417 + 26; + Bmp[Tiles::GUY_BOAT_BELOW].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_BELOW].sourceRect.bottom = 0 + 21; + Bmp[Tiles::GUY_BOAT_BELOW].Width = 26; + Bmp[Tiles::GUY_BOAT_BELOW].Height = 21; + + Bmp[Tiles::GUY_BOAT_FISHING_1].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_BOAT_FISHING_1].Speed = 6; + Bmp[Tiles::GUY_BOAT_FISHING_1].sourceRect.left = 443; + Bmp[Tiles::GUY_BOAT_FISHING_1].sourceRect.right = 443 + 26; + Bmp[Tiles::GUY_BOAT_FISHING_1].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_FISHING_1].sourceRect.bottom = 0 + 25; + Bmp[Tiles::GUY_BOAT_FISHING_1].Width = 26; + Bmp[Tiles::GUY_BOAT_FISHING_1].Height = 25; + + Bmp[Tiles::GUY_BOAT_FISHING_2].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_BOAT_FISHING_2].Speed = 3; + Bmp[Tiles::GUY_BOAT_FISHING_2].sourceRect.left = 469; + Bmp[Tiles::GUY_BOAT_FISHING_2].sourceRect.right = 469 + 26; + Bmp[Tiles::GUY_BOAT_FISHING_2].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_FISHING_2].sourceRect.bottom = 0 + 25; + Bmp[Tiles::GUY_BOAT_FISHING_2].Width = 26; + Bmp[Tiles::GUY_BOAT_FISHING_2].Height = 25; + + Bmp[Tiles::GUY_BOAT_FISHING_3].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_BOAT_FISHING_3].Speed = 2; + Bmp[Tiles::GUY_BOAT_FISHING_3].sourceRect.left = 495; + Bmp[Tiles::GUY_BOAT_FISHING_3].sourceRect.right = 495 + 26; + Bmp[Tiles::GUY_BOAT_FISHING_3].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_FISHING_3].sourceRect.bottom = 0 + 25; + Bmp[Tiles::GUY_BOAT_FISHING_3].Width = 26; + Bmp[Tiles::GUY_BOAT_FISHING_3].Height = 25; + + Bmp[Tiles::GUY_DIVING_1].AnimationPhaseCount = 5; + Bmp[Tiles::GUY_DIVING_1].Speed = 5; + Bmp[Tiles::GUY_DIVING_1].sourceRect.left = 521; + Bmp[Tiles::GUY_DIVING_1].sourceRect.right = 521 + 26; + Bmp[Tiles::GUY_DIVING_1].sourceRect.top = 0; + Bmp[Tiles::GUY_DIVING_1].sourceRect.bottom = 0 + 27; + Bmp[Tiles::GUY_DIVING_1].Width = 26; + Bmp[Tiles::GUY_DIVING_1].Height = 27; + + Bmp[Tiles::GUY_DIVING_2].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_DIVING_2].Speed = 3; + Bmp[Tiles::GUY_DIVING_2].sourceRect.left = 547; + Bmp[Tiles::GUY_DIVING_2].sourceRect.right = 547 + 26; + Bmp[Tiles::GUY_DIVING_2].sourceRect.top = 0; + Bmp[Tiles::GUY_DIVING_2].sourceRect.bottom = 0 + 17; + Bmp[Tiles::GUY_DIVING_2].Width = 26; + Bmp[Tiles::GUY_DIVING_2].Height = 17; + + Bmp[Tiles::GUY_DIVING_3].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_DIVING_3].Speed = 2; + Bmp[Tiles::GUY_DIVING_3].sourceRect.left = 573; + Bmp[Tiles::GUY_DIVING_3].sourceRect.right = 573 + 26; + Bmp[Tiles::GUY_DIVING_3].sourceRect.top = 0; + Bmp[Tiles::GUY_DIVING_3].sourceRect.bottom = 0 + 17; + Bmp[Tiles::GUY_DIVING_3].Width = 26; + Bmp[Tiles::GUY_DIVING_3].Height = 17; + + Bmp[Tiles::GUY_HAMMER_1].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_HAMMER_1].Speed = 4; + Bmp[Tiles::GUY_HAMMER_1].sourceRect.left = 599; + Bmp[Tiles::GUY_HAMMER_1].sourceRect.right = 599 + 9; + Bmp[Tiles::GUY_HAMMER_1].sourceRect.top = 0; + Bmp[Tiles::GUY_HAMMER_1].sourceRect.bottom = 0 + 18; + Bmp[Tiles::GUY_HAMMER_1].Width = 9; + Bmp[Tiles::GUY_HAMMER_1].Height = 18; + Bmp[Tiles::GUY_HAMMER_1].Sound = Sound::HAMMER; + + Bmp[Tiles::GUY_CLIMBING_1].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_CLIMBING_1].Speed = 2; + Bmp[Tiles::GUY_CLIMBING_1].sourceRect.left = 608; + Bmp[Tiles::GUY_CLIMBING_1].sourceRect.right = 608 + 7; + Bmp[Tiles::GUY_CLIMBING_1].sourceRect.top = 0; + Bmp[Tiles::GUY_CLIMBING_1].sourceRect.bottom = 0 + 34; + Bmp[Tiles::GUY_CLIMBING_1].Width = 7; + Bmp[Tiles::GUY_CLIMBING_1].Height = 34; + + Bmp[Tiles::GUY_CLIMBING_2].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_CLIMBING_2].Speed = 2; + Bmp[Tiles::GUY_CLIMBING_2].sourceRect.left = 615; + Bmp[Tiles::GUY_CLIMBING_2].sourceRect.right = 615 + 7; + Bmp[Tiles::GUY_CLIMBING_2].sourceRect.top = 0; + Bmp[Tiles::GUY_CLIMBING_2].sourceRect.bottom = 0 + 34; + Bmp[Tiles::GUY_CLIMBING_2].Width = 7; + Bmp[Tiles::GUY_CLIMBING_2].Height = 34; + + Bmp[Tiles::GUY_HAMMER_2].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_HAMMER_2].Speed = 4; + Bmp[Tiles::GUY_HAMMER_2].sourceRect.left = 622; + Bmp[Tiles::GUY_HAMMER_2].sourceRect.right = 622 + 7; + Bmp[Tiles::GUY_HAMMER_2].sourceRect.top = 0; + Bmp[Tiles::GUY_HAMMER_2].sourceRect.bottom = 0 + 34; + Bmp[Tiles::GUY_HAMMER_2].Width = 7; + Bmp[Tiles::GUY_HAMMER_2].Height = 34; + Bmp[Tiles::GUY_HAMMER_2].Sound = Sound::HAMMER; + + Bmp[Tiles::GUY_ENTER_HOUSE].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_ENTER_HOUSE].Speed = 2; + Bmp[Tiles::GUY_ENTER_HOUSE].sourceRect.left = 631; + Bmp[Tiles::GUY_ENTER_HOUSE].sourceRect.right = 631 + 9; + Bmp[Tiles::GUY_ENTER_HOUSE].sourceRect.top = 0; + Bmp[Tiles::GUY_ENTER_HOUSE].sourceRect.bottom = 0 + 34; + Bmp[Tiles::GUY_ENTER_HOUSE].Width = 9; + Bmp[Tiles::GUY_ENTER_HOUSE].Height = 34; + + Bmp[Tiles::GUY_SLEEP_HOUSE].AnimationPhaseCount = 2; + Bmp[Tiles::GUY_SLEEP_HOUSE].Speed = 1; + Bmp[Tiles::GUY_SLEEP_HOUSE].sourceRect.left = 640; + Bmp[Tiles::GUY_SLEEP_HOUSE].sourceRect.right = 640 + 10; + Bmp[Tiles::GUY_SLEEP_HOUSE].sourceRect.top = 0; + Bmp[Tiles::GUY_SLEEP_HOUSE].sourceRect.bottom = 0 + 34; + Bmp[Tiles::GUY_SLEEP_HOUSE].Width = 10; + Bmp[Tiles::GUY_SLEEP_HOUSE].Height = 34; + Bmp[Tiles::GUY_SLEEP_HOUSE].Sound = Sound::SNORE; + + Bmp[Tiles::GUY_EXIT_HOUSE].AnimationPhaseCount = 3; + Bmp[Tiles::GUY_EXIT_HOUSE].Speed = 2; + Bmp[Tiles::GUY_EXIT_HOUSE].sourceRect.left = 650; + Bmp[Tiles::GUY_EXIT_HOUSE].sourceRect.right = 650 + 9; + Bmp[Tiles::GUY_EXIT_HOUSE].sourceRect.top = 0; + Bmp[Tiles::GUY_EXIT_HOUSE].sourceRect.bottom = 0 + 34; + Bmp[Tiles::GUY_EXIT_HOUSE].Width = 9; + Bmp[Tiles::GUY_EXIT_HOUSE].Height = 34; + + Bmp[Tiles::GUY_SET_FIRE].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_SET_FIRE].Speed = 5; + Bmp[Tiles::GUY_SET_FIRE].sourceRect.left = 659; + Bmp[Tiles::GUY_SET_FIRE].sourceRect.right = 659 + 19; + Bmp[Tiles::GUY_SET_FIRE].sourceRect.top = 0; + Bmp[Tiles::GUY_SET_FIRE].sourceRect.bottom = 0 + 18; + Bmp[Tiles::GUY_SET_FIRE].Width = 19; + Bmp[Tiles::GUY_SET_FIRE].Height = 18; + + Bmp[Tiles::GUY_LOOK_OUT].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_LOOK_OUT].Speed = 1; + Bmp[Tiles::GUY_LOOK_OUT].sourceRect.left = 678; + Bmp[Tiles::GUY_LOOK_OUT].sourceRect.right = 678 + 10; + Bmp[Tiles::GUY_LOOK_OUT].sourceRect.top = 0; + Bmp[Tiles::GUY_LOOK_OUT].sourceRect.bottom = 0 + 18; + Bmp[Tiles::GUY_LOOK_OUT].Width = 10; + Bmp[Tiles::GUY_LOOK_OUT].Height = 18; + + Bmp[Tiles::GUY_SHOVEL].AnimationPhaseCount = 10; + Bmp[Tiles::GUY_SHOVEL].Speed = 3; + Bmp[Tiles::GUY_SHOVEL].sourceRect.left = 688; + Bmp[Tiles::GUY_SHOVEL].sourceRect.right = 688 + 17; + Bmp[Tiles::GUY_SHOVEL].sourceRect.top = 0; + Bmp[Tiles::GUY_SHOVEL].sourceRect.bottom = 0 + 19; + Bmp[Tiles::GUY_SHOVEL].Width = 17; + Bmp[Tiles::GUY_SHOVEL].Height = 19; + Bmp[Tiles::GUY_SHOVEL].Sound = Sound::DIG; + + Bmp[Tiles::GUY_SHIP].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_SHIP].Speed = 10; + Bmp[Tiles::GUY_SHIP].sourceRect.left = 297; + Bmp[Tiles::GUY_SHIP].sourceRect.right = 297 + 48; + Bmp[Tiles::GUY_SHIP].sourceRect.top = 0; + Bmp[Tiles::GUY_SHIP].sourceRect.bottom = 0 + 38; + Bmp[Tiles::GUY_SHIP].Width = 48; + Bmp[Tiles::GUY_SHIP].Height = 38; + Bmp[Tiles::GUY_SHIP].Surface = lpDDSBau; + Bmp[Tiles::GUY_SHIP].Sound = Sound::STORM; + + Bmp[Tiles::GUY_SHIP_DOWN].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_SHIP_DOWN].Speed = 3; + Bmp[Tiles::GUY_SHIP_DOWN].sourceRect.left = 345; + Bmp[Tiles::GUY_SHIP_DOWN].sourceRect.right = 345 + 46; + Bmp[Tiles::GUY_SHIP_DOWN].sourceRect.top = 0; + Bmp[Tiles::GUY_SHIP_DOWN].sourceRect.bottom = 0 + 40; + Bmp[Tiles::GUY_SHIP_DOWN].Width = 46; + Bmp[Tiles::GUY_SHIP_DOWN].Height = 40; + Bmp[Tiles::GUY_SHIP_DOWN].Surface = lpDDSBau; + Bmp[Tiles::GUY_SHIP_DOWN].Sound = Sound::SPLAT; + + Bmp[Tiles::GUY_SWIM].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_SWIM].Speed = 10; + Bmp[Tiles::GUY_SWIM].sourceRect.left = 705; + Bmp[Tiles::GUY_SWIM].sourceRect.right = 705 + 15; + Bmp[Tiles::GUY_SWIM].sourceRect.top = 0; + Bmp[Tiles::GUY_SWIM].sourceRect.bottom = 0 + 9; + Bmp[Tiles::GUY_SWIM].Width = 15; + Bmp[Tiles::GUY_SWIM].Height = 9; + Bmp[Tiles::GUY_SWIM].Sound = Sound::SWIM; + + Bmp[Tiles::GUY_DEAD].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_DEAD].Speed = 1; + Bmp[Tiles::GUY_DEAD].sourceRect.left = 743; + Bmp[Tiles::GUY_DEAD].sourceRect.right = 743 + 16; + Bmp[Tiles::GUY_DEAD].sourceRect.top = 0; + Bmp[Tiles::GUY_DEAD].sourceRect.bottom = 0 + 10; + Bmp[Tiles::GUY_DEAD].Width = 16; + Bmp[Tiles::GUY_DEAD].Height = 10; + + Bmp[Tiles::GUY_BOAT_DEAD].AnimationPhaseCount = 6; + Bmp[Tiles::GUY_BOAT_DEAD].Speed = 1; + Bmp[Tiles::GUY_BOAT_DEAD].sourceRect.left = 759; + Bmp[Tiles::GUY_BOAT_DEAD].sourceRect.right = 759 + 26; + Bmp[Tiles::GUY_BOAT_DEAD].sourceRect.top = 0; + Bmp[Tiles::GUY_BOAT_DEAD].sourceRect.bottom = 0 + 18; + Bmp[Tiles::GUY_BOAT_DEAD].Width = 26; + Bmp[Tiles::GUY_BOAT_DEAD].Height = 18; + + Bmp[Tiles::GUY_BOAT_WAITING].AnimationPhaseCount = 4; + Bmp[Tiles::GUY_BOAT_WAITING].Speed = 2; + Bmp[Tiles::GUY_BOAT_WAITING].sourceRect.left = 0; + Bmp[Tiles::GUY_BOAT_WAITING].sourceRect.right = 0 + 26; + Bmp[Tiles::GUY_BOAT_WAITING].sourceRect.top = 72; + Bmp[Tiles::GUY_BOAT_WAITING].sourceRect.bottom = 72 + 18; + Bmp[Tiles::GUY_BOAT_WAITING].Width = 26; + Bmp[Tiles::GUY_BOAT_WAITING].Height = 20; + + Bmp[Tiles::GUY_SLINGSHOT].AnimationPhaseCount = 5; + Bmp[Tiles::GUY_SLINGSHOT].Speed = 4; + Bmp[Tiles::GUY_SLINGSHOT].sourceRect.left = 720; + Bmp[Tiles::GUY_SLINGSHOT].sourceRect.right = 720 + 23; + Bmp[Tiles::GUY_SLINGSHOT].sourceRect.top = 0; + Bmp[Tiles::GUY_SLINGSHOT].sourceRect.bottom = 0 + 20; + Bmp[Tiles::GUY_SLINGSHOT].Width = 23; + Bmp[Tiles::GUY_SLINGSHOT].Height = 20; + + // Cursor + for (i = Tiles::CURSOR_ARROW; i <= Tiles::CURSOR_CLOCK; i++) { + Bmp[i].IsAnimationRunning = false; + Bmp[i].AnimationPhaseCount = 1; + Bmp[i].Speed = 0; + Bmp[i].AnimationPhase = 0; + Bmp[i].Surface = lpDDSCursor; + Bmp[i].sourceRect.left = (i - Tiles::CURSOR_ARROW) * 18; + Bmp[i].sourceRect.top = 0; + Bmp[i].sourceRect.right = Bmp[i].sourceRect.left + 18; + Bmp[i].sourceRect.bottom = 18; + Bmp[i].Width = 18; + Bmp[i].Height = 18; + } + + // Landschaftsanimationen + for (i = Tiles::SEA_WAVES; i <= Tiles::FLOODGATE_6; i++) { + Bmp[i].IsAnimationRunning = true; + Bmp[i].AnimationPhaseCount = 7; + Bmp[i].Speed = 7; + Bmp[i].AnimationPhase = 0; + Bmp[i].Surface = lpDDSAnimation; + Bmp[i].Sound = Sound::RIVER; } - void InitWaves() - { - // Sounds - for (short i = 0; i < Sound::COUNT; i++) - { - Wav[i].Dateiname = "sounds/klick.wav"; - Wav[i].Loop = false; - Wav[i].Volume = 100; + Bmp[Tiles::SEA_WAVES].Speed = 3; + Bmp[Tiles::SEA_WAVES].Width = 28; + Bmp[Tiles::SEA_WAVES].Height = 13; + Bmp[Tiles::SEA_WAVES].sourceRect.left = 0; + Bmp[Tiles::SEA_WAVES].sourceRect.right = Bmp[Tiles::SEA_WAVES].sourceRect.left + Bmp[Tiles::SEA_WAVES].Width; + Bmp[Tiles::SEA_WAVES].sourceRect.top = 0; + Bmp[Tiles::SEA_WAVES].sourceRect.bottom = Bmp[Tiles::SEA_WAVES].sourceRect.top + Bmp[Tiles::SEA_WAVES].Height; + Bmp[Tiles::SEA_WAVES].targetRect.left = 9; + Bmp[Tiles::SEA_WAVES].targetRect.right = Bmp[Tiles::SEA_WAVES].targetRect.left + Bmp[Tiles::SEA_WAVES].Width; + Bmp[Tiles::SEA_WAVES].targetRect.top = 23; + Bmp[Tiles::SEA_WAVES].targetRect.bottom = Bmp[Tiles::SEA_WAVES].targetRect.top + Bmp[Tiles::SEA_WAVES].Height; + Bmp[Tiles::SEA_WAVES].Sound = Sound::SURF; + + Bmp[Tiles::RIVER_1].Width = 34; + Bmp[Tiles::RIVER_1].Height = 8; + Bmp[Tiles::RIVER_1].sourceRect.left = 28; + Bmp[Tiles::RIVER_1].sourceRect.right = Bmp[Tiles::RIVER_1].sourceRect.left + Bmp[Tiles::RIVER_1].Width; + Bmp[Tiles::RIVER_1].sourceRect.top = 0; + Bmp[Tiles::RIVER_1].sourceRect.bottom = Bmp[Tiles::RIVER_1].sourceRect.top + Bmp[Tiles::RIVER_1].Height; + Bmp[Tiles::RIVER_1].targetRect.left = 10; + Bmp[Tiles::RIVER_1].targetRect.right = Bmp[Tiles::RIVER_1].targetRect.left + Bmp[Tiles::RIVER_1].Width; + Bmp[Tiles::RIVER_1].targetRect.top = 18; + Bmp[Tiles::RIVER_1].targetRect.bottom = Bmp[Tiles::RIVER_1].targetRect.top + Bmp[Tiles::RIVER_1].Height; + + Bmp[Tiles::RIVER_2].Width = 34; + Bmp[Tiles::RIVER_2].Height = 8; + Bmp[Tiles::RIVER_2].sourceRect.left = 62; + Bmp[Tiles::RIVER_2].sourceRect.right = Bmp[Tiles::RIVER_2].sourceRect.left + Bmp[Tiles::RIVER_2].Width; + Bmp[Tiles::RIVER_2].sourceRect.top = 0; + Bmp[Tiles::RIVER_2].sourceRect.bottom = Bmp[Tiles::RIVER_2].sourceRect.top + Bmp[Tiles::RIVER_2].Height; + Bmp[Tiles::RIVER_2].targetRect.left = 10; + Bmp[Tiles::RIVER_2].targetRect.right = Bmp[Tiles::RIVER_2].targetRect.left + Bmp[Tiles::RIVER_2].Width; + Bmp[Tiles::RIVER_2].targetRect.top = 19; + Bmp[Tiles::RIVER_2].targetRect.bottom = Bmp[Tiles::RIVER_2].targetRect.top + Bmp[Tiles::RIVER_2].Height; + + Bmp[Tiles::RIVER_3].Width = 34; + Bmp[Tiles::RIVER_3].Height = 34; + Bmp[Tiles::RIVER_3].sourceRect.left = 96; + Bmp[Tiles::RIVER_3].sourceRect.right = Bmp[Tiles::RIVER_3].sourceRect.left + Bmp[Tiles::RIVER_3].Width; + Bmp[Tiles::RIVER_3].sourceRect.top = 0; + Bmp[Tiles::RIVER_3].sourceRect.bottom = Bmp[Tiles::RIVER_3].sourceRect.top + Bmp[Tiles::RIVER_3].Height; + Bmp[Tiles::RIVER_3].targetRect.left = 10; + Bmp[Tiles::RIVER_3].targetRect.right = Bmp[Tiles::RIVER_3].targetRect.left + Bmp[Tiles::RIVER_3].Width; + Bmp[Tiles::RIVER_3].targetRect.top = 5; + Bmp[Tiles::RIVER_3].targetRect.bottom = Bmp[Tiles::RIVER_3].targetRect.top + Bmp[Tiles::RIVER_3].Height; + + Bmp[Tiles::RIVER_4].Width = 34; + Bmp[Tiles::RIVER_4].Height = 34; + Bmp[Tiles::RIVER_4].sourceRect.left = 130; + Bmp[Tiles::RIVER_4].sourceRect.right = Bmp[Tiles::RIVER_4].sourceRect.left + Bmp[Tiles::RIVER_4].Width; + Bmp[Tiles::RIVER_4].sourceRect.top = 0; + Bmp[Tiles::RIVER_4].sourceRect.bottom = Bmp[Tiles::RIVER_4].sourceRect.top + Bmp[Tiles::RIVER_4].Height; + Bmp[Tiles::RIVER_4].targetRect.left = 10; + Bmp[Tiles::RIVER_4].targetRect.right = Bmp[Tiles::RIVER_4].targetRect.left + Bmp[Tiles::RIVER_4].Width; + Bmp[Tiles::RIVER_4].targetRect.top = 5; + Bmp[Tiles::RIVER_4].targetRect.bottom = Bmp[Tiles::RIVER_4].targetRect.top + Bmp[Tiles::RIVER_4].Height; + + Bmp[Tiles::RIVER_5].Width = 34; + Bmp[Tiles::RIVER_5].Height = 18; + Bmp[Tiles::RIVER_5].sourceRect.left = 164; + Bmp[Tiles::RIVER_5].sourceRect.right = Bmp[Tiles::RIVER_5].sourceRect.left + Bmp[Tiles::RIVER_5].Width; + Bmp[Tiles::RIVER_5].sourceRect.top = 0; + Bmp[Tiles::RIVER_5].sourceRect.bottom = Bmp[Tiles::RIVER_5].sourceRect.top + Bmp[Tiles::RIVER_5].Height; + Bmp[Tiles::RIVER_5].targetRect.left = 10; + Bmp[Tiles::RIVER_5].targetRect.right = Bmp[Tiles::RIVER_5].targetRect.left + Bmp[Tiles::RIVER_5].Width; + Bmp[Tiles::RIVER_5].targetRect.top = 21; + Bmp[Tiles::RIVER_5].targetRect.bottom = Bmp[Tiles::RIVER_5].targetRect.top + Bmp[Tiles::RIVER_5].Height; + + Bmp[Tiles::RIVER_6].Width = 34; + Bmp[Tiles::RIVER_6].Height = 18; + Bmp[Tiles::RIVER_6].sourceRect.left = 198; + Bmp[Tiles::RIVER_6].sourceRect.right = Bmp[Tiles::RIVER_6].sourceRect.left + Bmp[Tiles::RIVER_6].Width; + Bmp[Tiles::RIVER_6].sourceRect.top = 0; + Bmp[Tiles::RIVER_6].sourceRect.bottom = Bmp[Tiles::RIVER_6].sourceRect.top + Bmp[Tiles::RIVER_6].Height; + Bmp[Tiles::RIVER_6].targetRect.left = 10; + Bmp[Tiles::RIVER_6].targetRect.right = Bmp[Tiles::RIVER_6].targetRect.left + Bmp[Tiles::RIVER_6].Width; + Bmp[Tiles::RIVER_6].targetRect.top = 21; + Bmp[Tiles::RIVER_6].targetRect.bottom = Bmp[Tiles::RIVER_6].targetRect.top + Bmp[Tiles::RIVER_6].Height; + + Bmp[Tiles::RIVER_7].Width = 18; + Bmp[Tiles::RIVER_7].Height = 18; + Bmp[Tiles::RIVER_7].sourceRect.left = 232; + Bmp[Tiles::RIVER_7].sourceRect.right = Bmp[Tiles::RIVER_7].sourceRect.left + Bmp[Tiles::RIVER_7].Width; + Bmp[Tiles::RIVER_7].sourceRect.top = 0; + Bmp[Tiles::RIVER_7].sourceRect.bottom = Bmp[Tiles::RIVER_7].sourceRect.top + Bmp[Tiles::RIVER_7].Height; + Bmp[Tiles::RIVER_7].targetRect.left = 10; + Bmp[Tiles::RIVER_7].targetRect.right = Bmp[Tiles::RIVER_7].targetRect.left + Bmp[Tiles::RIVER_7].Width; + Bmp[Tiles::RIVER_7].targetRect.top = 21; + Bmp[Tiles::RIVER_7].targetRect.bottom = Bmp[Tiles::RIVER_7].targetRect.top + Bmp[Tiles::RIVER_7].Height; + + Bmp[Tiles::RIVER_8].Width = 18; + Bmp[Tiles::RIVER_8].Height = 18; + Bmp[Tiles::RIVER_8].sourceRect.left = 250; + Bmp[Tiles::RIVER_8].sourceRect.right = Bmp[Tiles::RIVER_8].sourceRect.left + Bmp[Tiles::RIVER_8].Width; + Bmp[Tiles::RIVER_8].sourceRect.top = 0; + Bmp[Tiles::RIVER_8].sourceRect.bottom = Bmp[Tiles::RIVER_8].sourceRect.top + Bmp[Tiles::RIVER_8].Height; + Bmp[Tiles::RIVER_8].targetRect.left = 26; + Bmp[Tiles::RIVER_8].targetRect.right = Bmp[Tiles::RIVER_8].targetRect.left + Bmp[Tiles::RIVER_8].Width; + Bmp[Tiles::RIVER_8].targetRect.top = 21; + Bmp[Tiles::RIVER_8].targetRect.bottom = Bmp[Tiles::RIVER_8].targetRect.top + Bmp[Tiles::RIVER_8].Height; + + Bmp[Tiles::RIVER_9].Width = 34; + Bmp[Tiles::RIVER_9].Height = 15; + Bmp[Tiles::RIVER_9].sourceRect.left = 268; + Bmp[Tiles::RIVER_9].sourceRect.right = Bmp[Tiles::RIVER_9].sourceRect.left + Bmp[Tiles::RIVER_9].Width; + Bmp[Tiles::RIVER_9].sourceRect.top = 0; + Bmp[Tiles::RIVER_9].sourceRect.bottom = Bmp[Tiles::RIVER_9].sourceRect.top + Bmp[Tiles::RIVER_9].Height; + Bmp[Tiles::RIVER_9].targetRect.left = 10; + Bmp[Tiles::RIVER_9].targetRect.right = Bmp[Tiles::RIVER_9].targetRect.left + Bmp[Tiles::RIVER_9].Width; + Bmp[Tiles::RIVER_9].targetRect.top = 20; + Bmp[Tiles::RIVER_9].targetRect.bottom = Bmp[Tiles::RIVER_9].targetRect.top + Bmp[Tiles::RIVER_9].Height; + + Bmp[Tiles::RIVER_10].Width = 34; + Bmp[Tiles::RIVER_10].Height = 13; + Bmp[Tiles::RIVER_10].sourceRect.left = 302; + Bmp[Tiles::RIVER_10].sourceRect.right = Bmp[Tiles::RIVER_10].sourceRect.left + Bmp[Tiles::RIVER_10].Width; + Bmp[Tiles::RIVER_10].sourceRect.top = 0; + Bmp[Tiles::RIVER_10].sourceRect.bottom = Bmp[Tiles::RIVER_10].sourceRect.top + Bmp[Tiles::RIVER_10].Height; + Bmp[Tiles::RIVER_10].targetRect.left = 10; + Bmp[Tiles::RIVER_10].targetRect.right = Bmp[Tiles::RIVER_10].targetRect.left + Bmp[Tiles::RIVER_10].Width; + Bmp[Tiles::RIVER_10].targetRect.top = 26; + Bmp[Tiles::RIVER_10].targetRect.bottom = Bmp[Tiles::RIVER_10].targetRect.top + Bmp[Tiles::RIVER_10].Height; + + Bmp[Tiles::RIVER_END_1].Width = 42; + Bmp[Tiles::RIVER_END_1].Height = 22; + Bmp[Tiles::RIVER_END_1].sourceRect.left = 336; + Bmp[Tiles::RIVER_END_1].sourceRect.right = Bmp[Tiles::RIVER_END_1].sourceRect.left + Bmp[Tiles::RIVER_END_1].Width; + Bmp[Tiles::RIVER_END_1].sourceRect.top = 0; + Bmp[Tiles::RIVER_END_1].sourceRect.bottom = Bmp[Tiles::RIVER_END_1].sourceRect.top + Bmp[Tiles::RIVER_END_1].Height; + Bmp[Tiles::RIVER_END_1].targetRect.left = 2; + Bmp[Tiles::RIVER_END_1].targetRect.right = Bmp[Tiles::RIVER_END_1].targetRect.left + Bmp[Tiles::RIVER_END_1].Width; + Bmp[Tiles::RIVER_END_1].targetRect.top = 17; + Bmp[Tiles::RIVER_END_1].targetRect.bottom = Bmp[Tiles::RIVER_END_1].targetRect.top + Bmp[Tiles::RIVER_END_1].Height; + + Bmp[Tiles::RIVER_END_2].Width = 40; + Bmp[Tiles::RIVER_END_2].Height = 22; + Bmp[Tiles::RIVER_END_2].sourceRect.left = 378; + Bmp[Tiles::RIVER_END_2].sourceRect.right = Bmp[Tiles::RIVER_END_2].sourceRect.left + Bmp[Tiles::RIVER_END_2].Width; + Bmp[Tiles::RIVER_END_2].sourceRect.top = 0; + Bmp[Tiles::RIVER_END_2].sourceRect.bottom = Bmp[Tiles::RIVER_END_2].sourceRect.top + Bmp[Tiles::RIVER_END_2].Height; + Bmp[Tiles::RIVER_END_2].targetRect.left = 10; + Bmp[Tiles::RIVER_END_2].targetRect.right = Bmp[Tiles::RIVER_END_2].targetRect.left + Bmp[Tiles::RIVER_END_2].Width; + Bmp[Tiles::RIVER_END_2].targetRect.top = 17; + Bmp[Tiles::RIVER_END_2].targetRect.bottom = Bmp[Tiles::RIVER_END_2].targetRect.top + Bmp[Tiles::RIVER_END_2].Height; + + Bmp[Tiles::RIVER_END_3].Width = 40; + Bmp[Tiles::RIVER_END_3].Height = 22; + Bmp[Tiles::RIVER_END_3].sourceRect.left = 418; + Bmp[Tiles::RIVER_END_3].sourceRect.right = Bmp[Tiles::RIVER_END_3].sourceRect.left + Bmp[Tiles::RIVER_END_3].Width; + Bmp[Tiles::RIVER_END_3].sourceRect.top = 0; + Bmp[Tiles::RIVER_END_3].sourceRect.bottom = Bmp[Tiles::RIVER_END_3].sourceRect.top + Bmp[Tiles::RIVER_END_3].Height; + Bmp[Tiles::RIVER_END_3].targetRect.left = 10; + Bmp[Tiles::RIVER_END_3].targetRect.right = Bmp[Tiles::RIVER_END_3].targetRect.left + Bmp[Tiles::RIVER_END_3].Width; + Bmp[Tiles::RIVER_END_3].targetRect.top = 21; + Bmp[Tiles::RIVER_END_3].targetRect.bottom = Bmp[Tiles::RIVER_END_3].targetRect.top + Bmp[Tiles::RIVER_END_3].Height; + + Bmp[Tiles::RIVER_END_4].Width = 42; + Bmp[Tiles::RIVER_END_4].Height = 22; + Bmp[Tiles::RIVER_END_4].sourceRect.left = 458; + Bmp[Tiles::RIVER_END_4].sourceRect.right = Bmp[Tiles::RIVER_END_4].sourceRect.left + Bmp[Tiles::RIVER_END_4].Width; + Bmp[Tiles::RIVER_END_4].sourceRect.top = 0; + Bmp[Tiles::RIVER_END_4].sourceRect.bottom = Bmp[Tiles::RIVER_END_4].sourceRect.top + Bmp[Tiles::RIVER_END_4].Height; + Bmp[Tiles::RIVER_END_4].targetRect.left = 2; + Bmp[Tiles::RIVER_END_4].targetRect.right = Bmp[Tiles::RIVER_END_4].targetRect.left + Bmp[Tiles::RIVER_END_4].Width; + Bmp[Tiles::RIVER_END_4].targetRect.top = 21; + Bmp[Tiles::RIVER_END_4].targetRect.bottom = Bmp[Tiles::RIVER_END_4].targetRect.top + Bmp[Tiles::RIVER_END_4].Height; + + Bmp[Tiles::RIVER_START_1].Width = 30; + Bmp[Tiles::RIVER_START_1].Height = 19; + Bmp[Tiles::RIVER_START_1].sourceRect.left = 500; + Bmp[Tiles::RIVER_START_1].sourceRect.right = Bmp[Tiles::RIVER_START_1].sourceRect.left + Bmp[Tiles::RIVER_START_1].Width; + Bmp[Tiles::RIVER_START_1].sourceRect.top = 0; + Bmp[Tiles::RIVER_START_1].sourceRect.bottom = Bmp[Tiles::RIVER_START_1].sourceRect.top + Bmp[Tiles::RIVER_START_1].Height; + Bmp[Tiles::RIVER_START_1].targetRect.left = 16; + Bmp[Tiles::RIVER_START_1].targetRect.right = Bmp[Tiles::RIVER_START_1].targetRect.left + Bmp[Tiles::RIVER_START_1].Width; + Bmp[Tiles::RIVER_START_1].targetRect.top = 19; + Bmp[Tiles::RIVER_START_1].targetRect.bottom = Bmp[Tiles::RIVER_START_1].targetRect.top + Bmp[Tiles::RIVER_START_1].Height; + + Bmp[Tiles::RIVER_START_2].Width = 26; + Bmp[Tiles::RIVER_START_2].Height = 19; + Bmp[Tiles::RIVER_START_2].sourceRect.left = 530; + Bmp[Tiles::RIVER_START_2].sourceRect.right = Bmp[Tiles::RIVER_START_2].sourceRect.left + Bmp[Tiles::RIVER_START_2].Width; + Bmp[Tiles::RIVER_START_2].sourceRect.top = 0; + Bmp[Tiles::RIVER_START_2].sourceRect.bottom = Bmp[Tiles::RIVER_START_2].sourceRect.top + Bmp[Tiles::RIVER_START_2].Height; + Bmp[Tiles::RIVER_START_2].targetRect.left = 9; + Bmp[Tiles::RIVER_START_2].targetRect.right = Bmp[Tiles::RIVER_START_2].targetRect.left + Bmp[Tiles::RIVER_START_2].Width; + Bmp[Tiles::RIVER_START_2].targetRect.top = 20; + Bmp[Tiles::RIVER_START_2].targetRect.bottom = Bmp[Tiles::RIVER_START_2].targetRect.top + Bmp[Tiles::RIVER_START_2].Height; + + Bmp[Tiles::RIVER_START_3].Width = 25; + Bmp[Tiles::RIVER_START_3].Height = 16; + Bmp[Tiles::RIVER_START_3].sourceRect.left = 556; + Bmp[Tiles::RIVER_START_3].sourceRect.right = Bmp[Tiles::RIVER_START_3].sourceRect.left + Bmp[Tiles::RIVER_START_3].Width; + Bmp[Tiles::RIVER_START_3].sourceRect.top = 0; + Bmp[Tiles::RIVER_START_3].sourceRect.bottom = Bmp[Tiles::RIVER_START_3].sourceRect.top + Bmp[Tiles::RIVER_START_3].Height; + Bmp[Tiles::RIVER_START_3].targetRect.left = 19; + Bmp[Tiles::RIVER_START_3].targetRect.right = Bmp[Tiles::RIVER_START_3].targetRect.left + Bmp[Tiles::RIVER_START_3].Width; + Bmp[Tiles::RIVER_START_3].targetRect.top = 19; + Bmp[Tiles::RIVER_START_3].targetRect.bottom = Bmp[Tiles::RIVER_START_3].targetRect.top + Bmp[Tiles::RIVER_START_3].Height; + + Bmp[Tiles::RIVER_START_4].Width = 25; + Bmp[Tiles::RIVER_START_4].Height = 15; + Bmp[Tiles::RIVER_START_4].sourceRect.left = 581; + Bmp[Tiles::RIVER_START_4].sourceRect.right = Bmp[Tiles::RIVER_START_4].sourceRect.left + Bmp[Tiles::RIVER_START_4].Width; + Bmp[Tiles::RIVER_START_4].sourceRect.top = 0; + Bmp[Tiles::RIVER_START_4].sourceRect.bottom = Bmp[Tiles::RIVER_START_4].sourceRect.top + Bmp[Tiles::RIVER_START_4].Height; + Bmp[Tiles::RIVER_START_4].targetRect.left = 8; + Bmp[Tiles::RIVER_START_4].targetRect.right = Bmp[Tiles::RIVER_START_4].targetRect.left + Bmp[Tiles::RIVER_START_4].Width; + Bmp[Tiles::RIVER_START_4].targetRect.top = 21; + Bmp[Tiles::RIVER_START_4].targetRect.bottom = Bmp[Tiles::RIVER_START_4].targetRect.top + Bmp[Tiles::RIVER_START_4].Height; + + Bmp[Tiles::FLOODGATE_1].Width = 35; + Bmp[Tiles::FLOODGATE_1].Height = 22; + Bmp[Tiles::FLOODGATE_1].sourceRect.left = 164; + Bmp[Tiles::FLOODGATE_1].sourceRect.right = Bmp[Tiles::FLOODGATE_1].sourceRect.left + Bmp[Tiles::FLOODGATE_1].Width; + Bmp[Tiles::FLOODGATE_1].sourceRect.top = 126; + Bmp[Tiles::FLOODGATE_1].sourceRect.bottom = Bmp[Tiles::FLOODGATE_1].sourceRect.top + Bmp[Tiles::FLOODGATE_1].Height; + Bmp[Tiles::FLOODGATE_1].targetRect.left = 10; + Bmp[Tiles::FLOODGATE_1].targetRect.right = Bmp[Tiles::FLOODGATE_1].targetRect.left + Bmp[Tiles::FLOODGATE_1].Width; + Bmp[Tiles::FLOODGATE_1].targetRect.top = 17; + Bmp[Tiles::FLOODGATE_1].targetRect.bottom = Bmp[Tiles::FLOODGATE_1].targetRect.top + Bmp[Tiles::FLOODGATE_1].Height; + + Bmp[Tiles::FLOODGATE_2].Width = 34; + Bmp[Tiles::FLOODGATE_2].Height = 23; + Bmp[Tiles::FLOODGATE_2].sourceRect.left = 199; + Bmp[Tiles::FLOODGATE_2].sourceRect.right = Bmp[Tiles::FLOODGATE_2].sourceRect.left + Bmp[Tiles::FLOODGATE_2].Width; + Bmp[Tiles::FLOODGATE_2].sourceRect.top = 126; + Bmp[Tiles::FLOODGATE_2].sourceRect.bottom = Bmp[Tiles::FLOODGATE_2].sourceRect.top + Bmp[Tiles::FLOODGATE_2].Height; + Bmp[Tiles::FLOODGATE_2].targetRect.left = 10; + Bmp[Tiles::FLOODGATE_2].targetRect.right = Bmp[Tiles::FLOODGATE_2].targetRect.left + Bmp[Tiles::FLOODGATE_2].Width; + Bmp[Tiles::FLOODGATE_2].targetRect.top = 16; + Bmp[Tiles::FLOODGATE_2].targetRect.bottom = Bmp[Tiles::FLOODGATE_2].targetRect.top + Bmp[Tiles::FLOODGATE_2].Height; + + Bmp[Tiles::FLOODGATE_3].Width = 34; + Bmp[Tiles::FLOODGATE_3].Height = 22; + Bmp[Tiles::FLOODGATE_3].sourceRect.left = 233; + Bmp[Tiles::FLOODGATE_3].sourceRect.right = Bmp[Tiles::FLOODGATE_3].sourceRect.left + Bmp[Tiles::FLOODGATE_3].Width; + Bmp[Tiles::FLOODGATE_3].sourceRect.top = 126; + Bmp[Tiles::FLOODGATE_3].sourceRect.bottom = Bmp[Tiles::FLOODGATE_3].sourceRect.top + Bmp[Tiles::FLOODGATE_3].Height; + Bmp[Tiles::FLOODGATE_3].targetRect.left = 10; + Bmp[Tiles::FLOODGATE_3].targetRect.right = Bmp[Tiles::FLOODGATE_3].targetRect.left + Bmp[Tiles::FLOODGATE_3].Width; + Bmp[Tiles::FLOODGATE_3].targetRect.top = 17; + Bmp[Tiles::FLOODGATE_3].targetRect.bottom = Bmp[Tiles::FLOODGATE_3].targetRect.top + Bmp[Tiles::FLOODGATE_3].Height; + + Bmp[Tiles::FLOODGATE_4].Width = 33; + Bmp[Tiles::FLOODGATE_4].Height = 23; + Bmp[Tiles::FLOODGATE_4].sourceRect.left = 268; + Bmp[Tiles::FLOODGATE_4].sourceRect.right = Bmp[Tiles::FLOODGATE_4].sourceRect.left + Bmp[Tiles::FLOODGATE_4].Width; + Bmp[Tiles::FLOODGATE_4].sourceRect.top = 105; + Bmp[Tiles::FLOODGATE_4].sourceRect.bottom = Bmp[Tiles::FLOODGATE_4].sourceRect.top + Bmp[Tiles::FLOODGATE_4].Height; + Bmp[Tiles::FLOODGATE_4].targetRect.left = 11; + Bmp[Tiles::FLOODGATE_4].targetRect.right = Bmp[Tiles::FLOODGATE_4].targetRect.left + Bmp[Tiles::FLOODGATE_4].Width; + Bmp[Tiles::FLOODGATE_4].targetRect.top = 16; + Bmp[Tiles::FLOODGATE_4].targetRect.bottom = Bmp[Tiles::FLOODGATE_4].targetRect.top + Bmp[Tiles::FLOODGATE_4].Height; + + Bmp[Tiles::FLOODGATE_5].Width = 34; + Bmp[Tiles::FLOODGATE_5].Height = 17; + Bmp[Tiles::FLOODGATE_5].sourceRect.left = 302; + Bmp[Tiles::FLOODGATE_5].sourceRect.right = Bmp[Tiles::FLOODGATE_5].sourceRect.left + Bmp[Tiles::FLOODGATE_5].Width; + Bmp[Tiles::FLOODGATE_5].sourceRect.top = 91; + Bmp[Tiles::FLOODGATE_5].sourceRect.bottom = Bmp[Tiles::FLOODGATE_5].sourceRect.top + Bmp[Tiles::FLOODGATE_5].Height; + Bmp[Tiles::FLOODGATE_5].targetRect.left = 10; + Bmp[Tiles::FLOODGATE_5].targetRect.right = Bmp[Tiles::FLOODGATE_5].targetRect.left + Bmp[Tiles::FLOODGATE_5].Width; + Bmp[Tiles::FLOODGATE_5].targetRect.top = 20; + Bmp[Tiles::FLOODGATE_5].targetRect.bottom = Bmp[Tiles::FLOODGATE_5].targetRect.top + Bmp[Tiles::FLOODGATE_5].Height; + + Bmp[Tiles::FLOODGATE_6].Width = 35; + Bmp[Tiles::FLOODGATE_6].Height = 23; + Bmp[Tiles::FLOODGATE_6].sourceRect.left = 336; + Bmp[Tiles::FLOODGATE_6].sourceRect.right = Bmp[Tiles::FLOODGATE_6].sourceRect.left + Bmp[Tiles::FLOODGATE_6].Width; + Bmp[Tiles::FLOODGATE_6].sourceRect.top = 154; + Bmp[Tiles::FLOODGATE_6].sourceRect.bottom = Bmp[Tiles::FLOODGATE_6].sourceRect.top + Bmp[Tiles::FLOODGATE_6].Height; + Bmp[Tiles::FLOODGATE_6].targetRect.left = 10; + Bmp[Tiles::FLOODGATE_6].targetRect.right = Bmp[Tiles::FLOODGATE_6].targetRect.left + Bmp[Tiles::FLOODGATE_6].Width; + Bmp[Tiles::FLOODGATE_6].targetRect.top = 16; + Bmp[Tiles::FLOODGATE_6].targetRect.bottom = Bmp[Tiles::FLOODGATE_6].targetRect.top + Bmp[Tiles::FLOODGATE_6].Height; + + // Bauwerke + for (i = Tiles::FIELD; i <= Tiles::BONFIRE; i++) { + Bmp[i].IsAnimationRunning = false; + Bmp[i].Speed = 0; + Bmp[i].AnimationPhase = 0; + } + + Bmp[Tiles::FIELD].AnimationPhaseCount = 3; + Bmp[Tiles::FIELD].Surface = lpDDSBau; + Bmp[Tiles::FIELD].Width = 42; + Bmp[Tiles::FIELD].Height = 27; + Bmp[Tiles::FIELD].sourceRect.left = 0; + Bmp[Tiles::FIELD].sourceRect.right = 0 + Bmp[Tiles::FIELD].Width; + Bmp[Tiles::FIELD].sourceRect.top = 0; + Bmp[Tiles::FIELD].sourceRect.bottom = 0 + Bmp[Tiles::FIELD].Height; + Bmp[Tiles::FIELD].targetRect.left = 5; + Bmp[Tiles::FIELD].targetRect.right = Bmp[Tiles::FIELD].targetRect.left + Bmp[Tiles::FIELD].Width; + Bmp[Tiles::FIELD].targetRect.top = 15; + Bmp[Tiles::FIELD].targetRect.bottom = Bmp[Tiles::FIELD].targetRect.top + Bmp[Tiles::FIELD].Height; + Bmp[Tiles::FIELD].RequiredActionCases = 20; + + Bmp[Tiles::TENT].AnimationPhaseCount = 1; + Bmp[Tiles::TENT].Surface = lpDDSBau; + Bmp[Tiles::TENT].Width = 23; + Bmp[Tiles::TENT].Height = 20; + Bmp[Tiles::TENT].sourceRect.left = 42; + Bmp[Tiles::TENT].sourceRect.right = 42 + Bmp[Tiles::TENT].Width; + Bmp[Tiles::TENT].sourceRect.top = 0; + Bmp[Tiles::TENT].sourceRect.bottom = 0 + Bmp[Tiles::TENT].Height; + Bmp[Tiles::TENT].targetRect.left = 14; + Bmp[Tiles::TENT].targetRect.right = Bmp[Tiles::TENT].targetRect.left + Bmp[Tiles::TENT].Width; + Bmp[Tiles::TENT].targetRect.top = 9; + Bmp[Tiles::TENT].targetRect.bottom = Bmp[Tiles::TENT].targetRect.top + Bmp[Tiles::TENT].Height; + Bmp[Tiles::TENT].RequiredRawMaterials[Tiles::RAW_TREE_BRANCH] = 5; + Bmp[Tiles::TENT].RequiredRawMaterials[Tiles::RAW_LEAF] = 5; + Bmp[Tiles::TENT].RequiredActionCases = 16; + + Bmp[Tiles::BOAT].AnimationPhaseCount = 2; + Bmp[Tiles::BOAT].Surface = lpDDSBau; + Bmp[Tiles::BOAT].Width = 26; + Bmp[Tiles::BOAT].Height = 18; + Bmp[Tiles::BOAT].sourceRect.left = 65; + Bmp[Tiles::BOAT].sourceRect.right = 65 + Bmp[Tiles::BOAT].Width; + Bmp[Tiles::BOAT].sourceRect.top = 0; + Bmp[Tiles::BOAT].sourceRect.bottom = 0 + Bmp[Tiles::BOAT].Height; + Bmp[Tiles::BOAT].targetRect.left = 14; + Bmp[Tiles::BOAT].targetRect.right = Bmp[Tiles::BOAT].targetRect.left + Bmp[Tiles::BOAT].Width; + Bmp[Tiles::BOAT].targetRect.top = 20; + Bmp[Tiles::BOAT].targetRect.bottom = Bmp[Tiles::BOAT].targetRect.top + Bmp[Tiles::BOAT].Height; + Bmp[Tiles::BOAT].RequiredRawMaterials[Tiles::RAW_TREE_BRANCH] = 2; + Bmp[Tiles::BOAT].RequiredRawMaterials[Tiles::RAW_TREE_TRUNK] = 1; + Bmp[Tiles::BOAT].RequiredActionCases = 16; + + Bmp[Tiles::PIPE].AnimationPhaseCount = 2; + Bmp[Tiles::PIPE].Surface = lpDDSBau; + Bmp[Tiles::PIPE].Width = 34; + Bmp[Tiles::PIPE].Height = 21; + Bmp[Tiles::PIPE].sourceRect.left = 91; + Bmp[Tiles::PIPE].sourceRect.right = 91 + Bmp[Tiles::PIPE].Width; + Bmp[Tiles::PIPE].sourceRect.top = 0; + Bmp[Tiles::PIPE].sourceRect.bottom = 0 + Bmp[Tiles::PIPE].Height; + Bmp[Tiles::PIPE].targetRect.left = 11; + Bmp[Tiles::PIPE].targetRect.right = Bmp[Tiles::PIPE].targetRect.left + Bmp[Tiles::PIPE].Width; + Bmp[Tiles::PIPE].targetRect.top = 16; + Bmp[Tiles::PIPE].targetRect.bottom = Bmp[Tiles::PIPE].targetRect.top + Bmp[Tiles::PIPE].Height; + Bmp[Tiles::PIPE].RequiredRawMaterials[Tiles::RAW_TREE_TRUNK] = 1; + Bmp[Tiles::PIPE].RequiredActionCases = 18; + + Bmp[Tiles::SOS].AnimationPhaseCount = 1; + Bmp[Tiles::SOS].Surface = lpDDSBau; + Bmp[Tiles::SOS].Width = 36; + Bmp[Tiles::SOS].Height = 19; + Bmp[Tiles::SOS].sourceRect.left = 125; + Bmp[Tiles::SOS].sourceRect.right = 125 + Bmp[Tiles::SOS].Width; + Bmp[Tiles::SOS].sourceRect.top = 0; + Bmp[Tiles::SOS].sourceRect.bottom = 0 + Bmp[Tiles::SOS].Height; + Bmp[Tiles::SOS].targetRect.left = 11; + Bmp[Tiles::SOS].targetRect.right = Bmp[Tiles::SOS].targetRect.left + Bmp[Tiles::SOS].Width; + Bmp[Tiles::SOS].targetRect.top = 20; + Bmp[Tiles::SOS].targetRect.bottom = Bmp[Tiles::SOS].targetRect.top + Bmp[Tiles::SOS].Height; + Bmp[Tiles::SOS].RequiredRawMaterials[Tiles::RAW_STONE] = 10; + Bmp[Tiles::SOS].RequiredActionCases = 20; + + Bmp[Tiles::HOUSE_1].AnimationPhaseCount = 1; + Bmp[Tiles::HOUSE_1].Surface = lpDDSBau; + Bmp[Tiles::HOUSE_1].Width = 26; + Bmp[Tiles::HOUSE_1].Height = 41; + Bmp[Tiles::HOUSE_1].sourceRect.left = 161; + Bmp[Tiles::HOUSE_1].sourceRect.right = 161 + Bmp[Tiles::HOUSE_1].Width; + Bmp[Tiles::HOUSE_1].sourceRect.top = 0; + Bmp[Tiles::HOUSE_1].sourceRect.bottom = 0 + Bmp[Tiles::HOUSE_1].Height; + Bmp[Tiles::HOUSE_1].targetRect.left = 0; + Bmp[Tiles::HOUSE_1].targetRect.right = Bmp[Tiles::HOUSE_1].targetRect.left + Bmp[Tiles::HOUSE_1].Width; + Bmp[Tiles::HOUSE_1].targetRect.top = 0; + Bmp[Tiles::HOUSE_1].targetRect.bottom = Bmp[Tiles::HOUSE_1].targetRect.top + Bmp[Tiles::HOUSE_1].Height; + Bmp[Tiles::HOUSE_1].RequiredRawMaterials[Tiles::RAW_TREE_BRANCH] = 4; + Bmp[Tiles::HOUSE_1].RequiredActionCases = 19; + Bmp[Tiles::HOUSE_1].Sound = Sound::FOREST; + + Bmp[Tiles::HOUSE_2].AnimationPhaseCount = 1; + Bmp[Tiles::HOUSE_2].Surface = lpDDSBau; + Bmp[Tiles::HOUSE_2].Width = 34; + Bmp[Tiles::HOUSE_2].Height = 41; + Bmp[Tiles::HOUSE_2].sourceRect.left = 187; + Bmp[Tiles::HOUSE_2].sourceRect.right = 187 + Bmp[Tiles::HOUSE_2].Width; + Bmp[Tiles::HOUSE_2].sourceRect.top = 0; + Bmp[Tiles::HOUSE_2].sourceRect.bottom = 0 + Bmp[Tiles::HOUSE_2].Height; + Bmp[Tiles::HOUSE_2].targetRect.left = 0; + Bmp[Tiles::HOUSE_2].targetRect.right = Bmp[Tiles::HOUSE_2].targetRect.left + Bmp[Tiles::HOUSE_2].Width; + Bmp[Tiles::HOUSE_2].targetRect.top = 0; + Bmp[Tiles::HOUSE_2].targetRect.bottom = Bmp[Tiles::HOUSE_2].targetRect.top + Bmp[Tiles::HOUSE_2].Height; + Bmp[Tiles::HOUSE_2].RequiredRawMaterials[Tiles::RAW_TREE_BRANCH] = 3; + Bmp[Tiles::HOUSE_2].RequiredRawMaterials[Tiles::RAW_TREE_TRUNK] = 3; + Bmp[Tiles::HOUSE_2].RequiredActionCases = 21; + Bmp[Tiles::HOUSE_2].Sound = Sound::FOREST; + + Bmp[Tiles::HOUSE_3].AnimationPhaseCount = 1; + Bmp[Tiles::HOUSE_3].Surface = lpDDSBau; + Bmp[Tiles::HOUSE_3].Width = 34; + Bmp[Tiles::HOUSE_3].Height = 41; + Bmp[Tiles::HOUSE_3].sourceRect.left = 221; + Bmp[Tiles::HOUSE_3].sourceRect.right = 221 + Bmp[Tiles::HOUSE_3].Width; + Bmp[Tiles::HOUSE_3].sourceRect.top = 0; + Bmp[Tiles::HOUSE_3].sourceRect.bottom = 0 + Bmp[Tiles::HOUSE_3].Height; + Bmp[Tiles::HOUSE_3].targetRect.left = 0; + Bmp[Tiles::HOUSE_3].targetRect.right = Bmp[Tiles::HOUSE_3].targetRect.left + Bmp[Tiles::HOUSE_3].Width; + Bmp[Tiles::HOUSE_3].targetRect.top = 0; + Bmp[Tiles::HOUSE_3].targetRect.bottom = Bmp[Tiles::HOUSE_3].targetRect.top + Bmp[Tiles::HOUSE_3].Height; + Bmp[Tiles::HOUSE_3].RequiredRawMaterials[Tiles::RAW_TREE_BRANCH] = 4; + Bmp[Tiles::HOUSE_3].RequiredRawMaterials[Tiles::RAW_TREE_TRUNK] = 4; + Bmp[Tiles::HOUSE_3].RequiredRawMaterials[Tiles::RAW_LEAF] = 5; + Bmp[Tiles::HOUSE_3].RequiredActionCases = 21; + Bmp[Tiles::HOUSE_3].Sound = Sound::FOREST; + + Bmp[Tiles::BONFIRE].AnimationPhaseCount = 1; + Bmp[Tiles::BONFIRE].Surface = lpDDSBau; + Bmp[Tiles::BONFIRE].Width = 21; + Bmp[Tiles::BONFIRE].Height = 19; + Bmp[Tiles::BONFIRE].sourceRect.left = 255; + Bmp[Tiles::BONFIRE].sourceRect.right = 255 + Bmp[Tiles::BONFIRE].Width; + Bmp[Tiles::BONFIRE].sourceRect.top = 0; + Bmp[Tiles::BONFIRE].sourceRect.bottom = 0 + Bmp[Tiles::BONFIRE].Height; + Bmp[Tiles::BONFIRE].targetRect.left = 15; + Bmp[Tiles::BONFIRE].targetRect.right = Bmp[Tiles::BONFIRE].targetRect.left + Bmp[Tiles::BONFIRE].Width; + Bmp[Tiles::BONFIRE].targetRect.top = 10; + Bmp[Tiles::BONFIRE].targetRect.bottom = Bmp[Tiles::BONFIRE].targetRect.top + Bmp[Tiles::BONFIRE].Height; + Bmp[Tiles::BONFIRE].RequiredRawMaterials[Tiles::RAW_TREE_BRANCH] = 5; + Bmp[Tiles::BONFIRE].RequiredRawMaterials[Tiles::RAW_TREE_TRUNK] = 4; + Bmp[Tiles::BONFIRE].RequiredActionCases = 9; + + // Allgemein Bäume + for (i = Tiles::TREE_1; i <= Tiles::TREE_4; i++) { + Bmp[i].IsAnimationRunning = true; + Bmp[i].AnimationPhaseCount = 4; + Bmp[i].Speed = 4; + Bmp[i].AnimationPhase = 0; + Bmp[i].Surface = lpDDSBaum; + Bmp[i].Sound = Sound::FOREST; + } + + // Baum1 + Bmp[Tiles::TREE_1].sourceRect.left = 0; + Bmp[Tiles::TREE_1].sourceRect.top = 0; + Bmp[Tiles::TREE_1].sourceRect.right = 21; + Bmp[Tiles::TREE_1].sourceRect.bottom = 26; + Bmp[Tiles::TREE_1].Width = static_cast(Bmp[Tiles::TREE_1].sourceRect.right - Bmp[Tiles::TREE_1].sourceRect.left); + Bmp[Tiles::TREE_1].Height = static_cast(Bmp[Tiles::TREE_1].sourceRect.bottom - Bmp[Tiles::TREE_1].sourceRect.top); + + // Baum2 + Bmp[Tiles::TREE_2].sourceRect.left = 21; + Bmp[Tiles::TREE_2].sourceRect.top = 0; + Bmp[Tiles::TREE_2].sourceRect.right = 42; + Bmp[Tiles::TREE_2].sourceRect.bottom = 26; + Bmp[Tiles::TREE_2].Width = static_cast(Bmp[Tiles::TREE_2].sourceRect.right - Bmp[Tiles::TREE_2].sourceRect.left); + Bmp[Tiles::TREE_2].Height = static_cast(Bmp[Tiles::TREE_2].sourceRect.bottom - Bmp[Tiles::TREE_2].sourceRect.top); + + // Baum3 + Bmp[Tiles::TREE_3].sourceRect.left = 42; + Bmp[Tiles::TREE_3].sourceRect.top = 0; + Bmp[Tiles::TREE_3].sourceRect.right = 64; + Bmp[Tiles::TREE_3].sourceRect.bottom = 27; + Bmp[Tiles::TREE_3].Width = static_cast(Bmp[Tiles::TREE_3].sourceRect.right - Bmp[Tiles::TREE_3].sourceRect.left); + Bmp[Tiles::TREE_3].Height = static_cast(Bmp[Tiles::TREE_3].sourceRect.bottom - Bmp[Tiles::TREE_3].sourceRect.top); + + // Baum4 + Bmp[Tiles::TREE_4].sourceRect.left = 64; + Bmp[Tiles::TREE_4].sourceRect.top = 0; + Bmp[Tiles::TREE_4].sourceRect.right = 81; + Bmp[Tiles::TREE_4].sourceRect.bottom = 16; + Bmp[Tiles::TREE_4].Width = static_cast(Bmp[Tiles::TREE_4].sourceRect.right - Bmp[Tiles::TREE_4].sourceRect.left); + Bmp[Tiles::TREE_4].Height = static_cast(Bmp[Tiles::TREE_4].sourceRect.bottom - Bmp[Tiles::TREE_4].sourceRect.top); + + // Baumgroß + Bmp[Tiles::TREE_BIG].sourceRect.left = 238; + Bmp[Tiles::TREE_BIG].sourceRect.top = 0; + Bmp[Tiles::TREE_BIG].sourceRect.right = 238 + 26; + Bmp[Tiles::TREE_BIG].sourceRect.bottom = 41; + Bmp[Tiles::TREE_BIG].Width = static_cast(Bmp[Tiles::TREE_BIG].sourceRect.right - Bmp[Tiles::TREE_BIG].sourceRect.left); + Bmp[Tiles::TREE_BIG].Height = static_cast(Bmp[Tiles::TREE_BIG].sourceRect.bottom - Bmp[Tiles::TREE_BIG].sourceRect.top); + Bmp[Tiles::TREE_BIG].IsAnimationRunning = false; + Bmp[Tiles::TREE_BIG].AnimationPhaseCount = 1; + Bmp[Tiles::TREE_BIG].Speed = 0; + Bmp[Tiles::TREE_BIG].AnimationPhase = 0; + Bmp[Tiles::TREE_BIG].Surface = lpDDSBaum; + Bmp[Tiles::TREE_BIG].Sound = Sound::FOREST; + + // Feuer + Bmp[Tiles::FIRE].AnimationPhaseCount = 3; + Bmp[Tiles::FIRE].Surface = lpDDSBau; + Bmp[Tiles::FIRE].Width = 21; + Bmp[Tiles::FIRE].Height = 28; + Bmp[Tiles::FIRE].sourceRect.left = 276; + Bmp[Tiles::FIRE].sourceRect.right = 276 + Bmp[Tiles::FIRE].Width; + Bmp[Tiles::FIRE].sourceRect.top = 0; + Bmp[Tiles::FIRE].sourceRect.bottom = 0 + Bmp[Tiles::FIRE].Height; + Bmp[Tiles::FIRE].targetRect.left = 15; + Bmp[Tiles::FIRE].targetRect.right = Bmp[Tiles::FIRE].targetRect.left + Bmp[Tiles::FIRE].Width; + Bmp[Tiles::FIRE].targetRect.top = 1; + Bmp[Tiles::FIRE].targetRect.bottom = Bmp[Tiles::FIRE].targetRect.top + Bmp[Tiles::FIRE].Height; + Bmp[Tiles::FIRE].IsAnimationRunning = true; + Bmp[Tiles::FIRE].Speed = 6; + Bmp[Tiles::FIRE].AnimationPhase = 0; + Bmp[Tiles::FIRE].Sound = Sound::FIRE; + + // WRACK + Bmp[Tiles::WRECK_1].AnimationPhaseCount = 3; + Bmp[Tiles::WRECK_1].Surface = lpDDSBau; + Bmp[Tiles::WRECK_1].Width = 24; + Bmp[Tiles::WRECK_1].Height = 18; + Bmp[Tiles::WRECK_1].sourceRect.left = 391; + Bmp[Tiles::WRECK_1].sourceRect.right = 391 + Bmp[Tiles::WRECK_1].Width; + Bmp[Tiles::WRECK_1].sourceRect.top = 0; + Bmp[Tiles::WRECK_1].sourceRect.bottom = 0 + Bmp[Tiles::WRECK_1].Height; + Bmp[Tiles::WRECK_1].targetRect.left = 15; + Bmp[Tiles::WRECK_1].targetRect.right = Bmp[Tiles::WRECK_1].targetRect.left + Bmp[Tiles::WRECK_1].Width; + Bmp[Tiles::WRECK_1].targetRect.top = 20; + Bmp[Tiles::WRECK_1].targetRect.bottom = Bmp[Tiles::WRECK_1].targetRect.top + Bmp[Tiles::WRECK_1].Height; + Bmp[Tiles::WRECK_1].IsAnimationRunning = true; + Bmp[Tiles::WRECK_1].Speed = 5; + Bmp[Tiles::WRECK_1].AnimationPhase = 0; + + // WRACK2 + Bmp[Tiles::WRECK_2].AnimationPhaseCount = 3; + Bmp[Tiles::WRECK_2].Surface = lpDDSBau; + Bmp[Tiles::WRECK_2].Width = 27; + Bmp[Tiles::WRECK_2].Height = 26; + Bmp[Tiles::WRECK_2].sourceRect.left = 415; + Bmp[Tiles::WRECK_2].sourceRect.right = 415 + Bmp[Tiles::WRECK_2].Width; + Bmp[Tiles::WRECK_2].sourceRect.top = 0; + Bmp[Tiles::WRECK_2].sourceRect.bottom = 0 + Bmp[Tiles::WRECK_2].Height; + Bmp[Tiles::WRECK_2].targetRect.left = 15; + Bmp[Tiles::WRECK_2].targetRect.right = Bmp[Tiles::WRECK_2].targetRect.left + Bmp[Tiles::WRECK_2].Width; + Bmp[Tiles::WRECK_2].targetRect.top = 16; + Bmp[Tiles::WRECK_2].targetRect.bottom = Bmp[Tiles::WRECK_2].targetRect.top + Bmp[Tiles::WRECK_2].Height; + Bmp[Tiles::WRECK_2].IsAnimationRunning = true; + Bmp[Tiles::WRECK_2].Speed = 5; + Bmp[Tiles::WRECK_2].AnimationPhase = 0; + + // Früchte + // Busch + Bmp[Tiles::BUSH].sourceRect.left = 81; + Bmp[Tiles::BUSH].sourceRect.top = 0; + Bmp[Tiles::BUSH].sourceRect.right = 81 + 20; + Bmp[Tiles::BUSH].sourceRect.bottom = 13; + Bmp[Tiles::BUSH].Width = static_cast(Bmp[Tiles::BUSH].sourceRect.right - Bmp[Tiles::BUSH].sourceRect.left); + Bmp[Tiles::BUSH].Height = static_cast(Bmp[Tiles::BUSH].sourceRect.bottom - Bmp[Tiles::BUSH].sourceRect.top); + Bmp[Tiles::BUSH].IsAnimationRunning = false; + Bmp[Tiles::BUSH].AnimationPhaseCount = 3; + Bmp[Tiles::BUSH].Speed = 0; + Bmp[Tiles::BUSH].AnimationPhase = 0; + Bmp[Tiles::BUSH].Surface = lpDDSBaum; + + // Buttons + + // StandardBmponsinitialisierung + for (i = Tiles::BUTTON_GRID; i <= Tiles::BUTTON_DESTROY; i++) { + Bmp[i].IsAnimationRunning = false; + Bmp[i].Surface = lpDDSButtons; + Bmp[i].AnimationPhaseCount = 1; + Bmp[i].AnimationPhase = 0; + } + + // ButtGitter + Bmp[Tiles::BUTTON_GRID].sourceRect.left = 0; + Bmp[Tiles::BUTTON_GRID].sourceRect.top = 0; + Bmp[Tiles::BUTTON_GRID].sourceRect.right = 28; + Bmp[Tiles::BUTTON_GRID].sourceRect.bottom = 28; + Bmp[Tiles::BUTTON_GRID].targetRect.left = rcPanel.left + 173; + Bmp[Tiles::BUTTON_GRID].targetRect.top = rcPanel.top + 26; + Bmp[Tiles::BUTTON_GRID].targetRect.right = Bmp[Tiles::BUTTON_GRID].targetRect.left + 28; + Bmp[Tiles::BUTTON_GRID].targetRect.bottom = Bmp[Tiles::BUTTON_GRID].targetRect.top + 28; + Bmp[Tiles::BUTTON_GRID].Width = static_cast(Bmp[Tiles::BUTTON_GRID].sourceRect.right - Bmp[Tiles::BUTTON_GRID].sourceRect.left); + Bmp[Tiles::BUTTON_GRID].Height = static_cast(Bmp[Tiles::BUTTON_GRID].sourceRect.bottom - Bmp[Tiles::BUTTON_GRID].sourceRect.top); + Bmp[Tiles::BUTTON_GRID].AnimationPhaseCount = 2; + + // BUTTANIMATION + Bmp[Tiles::BUTTON_ANIMATION].sourceRect.left = 0; + Bmp[Tiles::BUTTON_ANIMATION].sourceRect.top = 56; + Bmp[Tiles::BUTTON_ANIMATION].sourceRect.right = 28; + Bmp[Tiles::BUTTON_ANIMATION].sourceRect.bottom = 56 + 28; + Bmp[Tiles::BUTTON_ANIMATION].targetRect.left = rcPanel.left + 173; + Bmp[Tiles::BUTTON_ANIMATION].targetRect.top = rcPanel.top + 60; + Bmp[Tiles::BUTTON_ANIMATION].targetRect.right = Bmp[Tiles::BUTTON_ANIMATION].targetRect.left + 28; + Bmp[Tiles::BUTTON_ANIMATION].targetRect.bottom = Bmp[Tiles::BUTTON_ANIMATION].targetRect.top + 28; + Bmp[Tiles::BUTTON_ANIMATION].Width = static_cast(Bmp[Tiles::BUTTON_ANIMATION].sourceRect.right - Bmp[Tiles::BUTTON_ANIMATION].sourceRect.left); + Bmp[Tiles::BUTTON_ANIMATION].Height = static_cast(Bmp[Tiles::BUTTON_ANIMATION].sourceRect.bottom - Bmp[Tiles::BUTTON_ANIMATION].sourceRect.top); + Bmp[Tiles::BUTTON_ANIMATION].AnimationPhaseCount = 2; + + // BUTTBEENDEN + Bmp[Tiles::BUTTON_END].sourceRect.left = 0; + Bmp[Tiles::BUTTON_END].sourceRect.top = 112; + Bmp[Tiles::BUTTON_END].sourceRect.right = 20; + Bmp[Tiles::BUTTON_END].sourceRect.bottom = 112 + 20; + Bmp[Tiles::BUTTON_END].targetRect.left = rcPanel.left + 60; + Bmp[Tiles::BUTTON_END].targetRect.top = rcPanel.top + 2; + Bmp[Tiles::BUTTON_END].targetRect.right = Bmp[Tiles::BUTTON_END].targetRect.left + 20; + Bmp[Tiles::BUTTON_END].targetRect.bottom = Bmp[Tiles::BUTTON_END].targetRect.top + 20; + Bmp[Tiles::BUTTON_END].Width = static_cast(Bmp[Tiles::BUTTON_END].sourceRect.right - Bmp[Tiles::BUTTON_END].sourceRect.left); + Bmp[Tiles::BUTTON_END].Height = static_cast(Bmp[Tiles::BUTTON_END].sourceRect.bottom - Bmp[Tiles::BUTTON_END].sourceRect.top); + Bmp[Tiles::BUTTON_END].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_END].Speed = 4; + + // BUTTNEU + Bmp[Tiles::BUTTON_NEW].sourceRect.left = 0; + Bmp[Tiles::BUTTON_NEW].sourceRect.top = 192; + Bmp[Tiles::BUTTON_NEW].sourceRect.right = 20; + Bmp[Tiles::BUTTON_NEW].sourceRect.bottom = 192 + 20; + Bmp[Tiles::BUTTON_NEW].targetRect.left = rcPanel.left + 100; + Bmp[Tiles::BUTTON_NEW].targetRect.top = rcPanel.top + 2; + Bmp[Tiles::BUTTON_NEW].targetRect.right = Bmp[Tiles::BUTTON_NEW].targetRect.left + 20; + Bmp[Tiles::BUTTON_NEW].targetRect.bottom = Bmp[Tiles::BUTTON_NEW].targetRect.top + 20; + Bmp[Tiles::BUTTON_NEW].Width = static_cast(Bmp[Tiles::BUTTON_NEW].sourceRect.right - Bmp[Tiles::BUTTON_NEW].sourceRect.left); + Bmp[Tiles::BUTTON_NEW].Height = static_cast(Bmp[Tiles::BUTTON_NEW].sourceRect.bottom - Bmp[Tiles::BUTTON_NEW].sourceRect.top); + Bmp[Tiles::BUTTON_NEW].AnimationPhaseCount = 2; + Bmp[Tiles::BUTTON_NEW].Speed = 3; + + + // BUTTTAGNEU + Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.left = 0; + Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.top = 232; + Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.right = 20; + Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.bottom = 232 + 20; + Bmp[Tiles::BUTTON_NEW_DAY].targetRect.left = rcPanel.left + 140; + Bmp[Tiles::BUTTON_NEW_DAY].targetRect.top = rcPanel.top + 2; + Bmp[Tiles::BUTTON_NEW_DAY].targetRect.right = Bmp[Tiles::BUTTON_NEW_DAY].targetRect.left + 20; + Bmp[Tiles::BUTTON_NEW_DAY].targetRect.bottom = Bmp[Tiles::BUTTON_NEW_DAY].targetRect.top + 20; + Bmp[Tiles::BUTTON_NEW_DAY].Width = static_cast(Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.right - Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.left); + Bmp[Tiles::BUTTON_NEW_DAY].Height = static_cast(Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.bottom - Bmp[Tiles::BUTTON_NEW_DAY].sourceRect.top); + Bmp[Tiles::BUTTON_NEW_DAY].AnimationPhaseCount = 2; + Bmp[Tiles::BUTTON_NEW_DAY].Speed = 2; + + // BUTTSOUND + Bmp[Tiles::BUTTON_SOUND].sourceRect.left = 0; + Bmp[Tiles::BUTTON_SOUND].sourceRect.top = 272; + Bmp[Tiles::BUTTON_SOUND].sourceRect.right = 28; + Bmp[Tiles::BUTTON_SOUND].sourceRect.bottom = 272 + 28; + Bmp[Tiles::BUTTON_SOUND].targetRect.left = rcPanel.left + 173; + Bmp[Tiles::BUTTON_SOUND].targetRect.top = rcPanel.top + 94; + Bmp[Tiles::BUTTON_SOUND].targetRect.right = Bmp[Tiles::BUTTON_SOUND].targetRect.left + 28; + Bmp[Tiles::BUTTON_SOUND].targetRect.bottom = Bmp[Tiles::BUTTON_SOUND].targetRect.top + 28; + Bmp[Tiles::BUTTON_SOUND].Width = static_cast(Bmp[Tiles::BUTTON_SOUND].sourceRect.right - Bmp[Tiles::BUTTON_SOUND].sourceRect.left); + Bmp[Tiles::BUTTON_SOUND].Height = static_cast(Bmp[Tiles::BUTTON_SOUND].sourceRect.bottom - Bmp[Tiles::BUTTON_SOUND].sourceRect.top); + Bmp[Tiles::BUTTON_SOUND].AnimationPhaseCount = 2; + + // ButtAktion + Bmp[Tiles::BUTTON_ACTION].sourceRect.left = 28; + Bmp[Tiles::BUTTON_ACTION].sourceRect.top = 0; + Bmp[Tiles::BUTTON_ACTION].sourceRect.right = 28 + 35; + Bmp[Tiles::BUTTON_ACTION].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_ACTION].targetRect.left = rcPanel.left + 29; + Bmp[Tiles::BUTTON_ACTION].targetRect.top = rcPanel.top + 191; + Bmp[Tiles::BUTTON_ACTION].targetRect.right = Bmp[Tiles::BUTTON_ACTION].targetRect.left + 35; + Bmp[Tiles::BUTTON_ACTION].targetRect.bottom = Bmp[Tiles::BUTTON_ACTION].targetRect.top + 35; + Bmp[Tiles::BUTTON_ACTION].Width = static_cast(Bmp[Tiles::BUTTON_ACTION].sourceRect.right - Bmp[Tiles::BUTTON_ACTION].sourceRect.left); + Bmp[Tiles::BUTTON_ACTION].Height = static_cast(Bmp[Tiles::BUTTON_ACTION].sourceRect.bottom - Bmp[Tiles::BUTTON_ACTION].sourceRect.top); + Bmp[Tiles::BUTTON_ACTION].AnimationPhaseCount = 3; + Bmp[Tiles::BUTTON_ACTION].Speed = 6; + + // BUTTBAUEN + Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.left = 203; + Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.top = 0; + Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.right = 203 + 35; + Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.left = rcPanel.left + 70; + Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.top = rcPanel.top + 191; + Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.right = Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.left + 35; + Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.bottom = Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.top + 35; + Bmp[Tiles::BUTTON_CONSTRUCT].Width = static_cast(Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.right - Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.left); + Bmp[Tiles::BUTTON_CONSTRUCT].Height = static_cast(Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.bottom - Bmp[Tiles::BUTTON_CONSTRUCT].sourceRect.top); + Bmp[Tiles::BUTTON_CONSTRUCT].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_CONSTRUCT].Speed = 5; + + + // BUTTINVENTAR + Bmp[Tiles::BUTTON_INVENTORY].sourceRect.left = 168; + Bmp[Tiles::BUTTON_INVENTORY].sourceRect.top = 0; + Bmp[Tiles::BUTTON_INVENTORY].sourceRect.right = 168 + 35; + Bmp[Tiles::BUTTON_INVENTORY].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_INVENTORY].targetRect.left = rcPanel.left + 152; + Bmp[Tiles::BUTTON_INVENTORY].targetRect.top = rcPanel.top + 191; + Bmp[Tiles::BUTTON_INVENTORY].targetRect.right = Bmp[Tiles::BUTTON_INVENTORY].targetRect.left + 35; + Bmp[Tiles::BUTTON_INVENTORY].targetRect.bottom = Bmp[Tiles::BUTTON_INVENTORY].targetRect.top + 35; + Bmp[Tiles::BUTTON_INVENTORY].Width = static_cast(Bmp[Tiles::BUTTON_INVENTORY].sourceRect.right - Bmp[Tiles::BUTTON_INVENTORY].sourceRect.left); + Bmp[Tiles::BUTTON_INVENTORY].Height = static_cast(Bmp[Tiles::BUTTON_INVENTORY].sourceRect.bottom - Bmp[Tiles::BUTTON_INVENTORY].sourceRect.top); + Bmp[Tiles::BUTTON_INVENTORY].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_INVENTORY].Speed = 4; + + // BUTTWEITER + Bmp[Tiles::BUTTON_CONTINUE].sourceRect.left = 343; + Bmp[Tiles::BUTTON_CONTINUE].sourceRect.top = 0; + Bmp[Tiles::BUTTON_CONTINUE].sourceRect.right = 343 + 35; + Bmp[Tiles::BUTTON_CONTINUE].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_CONTINUE].targetRect.left = rcPanel.left + 111; + Bmp[Tiles::BUTTON_CONTINUE].targetRect.top = rcPanel.top + 191; + Bmp[Tiles::BUTTON_CONTINUE].targetRect.right = Bmp[Tiles::BUTTON_CONTINUE].targetRect.left + 35; + Bmp[Tiles::BUTTON_CONTINUE].targetRect.bottom = Bmp[Tiles::BUTTON_CONTINUE].targetRect.top + 35; + Bmp[Tiles::BUTTON_CONTINUE].Width = static_cast(Bmp[Tiles::BUTTON_CONTINUE].sourceRect.right - Bmp[Tiles::BUTTON_CONTINUE].sourceRect.left); + Bmp[Tiles::BUTTON_CONTINUE].Height = static_cast(Bmp[Tiles::BUTTON_CONTINUE].sourceRect.bottom - Bmp[Tiles::BUTTON_CONTINUE].sourceRect.top); + Bmp[Tiles::BUTTON_CONTINUE].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_CONTINUE].Speed = 4; + Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase = -1; + + // BUTTSTOP + Bmp[Tiles::BUTTON_STOP].sourceRect.left = 378; + Bmp[Tiles::BUTTON_STOP].sourceRect.top = 0; + Bmp[Tiles::BUTTON_STOP].sourceRect.right = 378 + 35; + Bmp[Tiles::BUTTON_STOP].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_STOP].targetRect.left = rcPanel.left + 111; + Bmp[Tiles::BUTTON_STOP].targetRect.top = rcPanel.top + 191; + Bmp[Tiles::BUTTON_STOP].targetRect.right = Bmp[Tiles::BUTTON_STOP].targetRect.left + 35; + Bmp[Tiles::BUTTON_STOP].targetRect.bottom = Bmp[Tiles::BUTTON_STOP].targetRect.top + 35; + Bmp[Tiles::BUTTON_STOP].Width = static_cast(Bmp[Tiles::BUTTON_STOP].sourceRect.right - Bmp[Tiles::BUTTON_STOP].sourceRect.left); + Bmp[Tiles::BUTTON_STOP].Height = static_cast(Bmp[Tiles::BUTTON_STOP].sourceRect.bottom - Bmp[Tiles::BUTTON_STOP].sourceRect.top); + Bmp[Tiles::BUTTON_STOP].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_STOP].Speed = 4; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + // BUTTABLEGEN + Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.left = 483; + Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.top = 0; + Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.right = 483 + 35; + Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.left = rcPanel.left + 111; + Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.top = rcPanel.top + 191; + Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.right = Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.left + 35; + Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.bottom = Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.top + 35; + Bmp[Tiles::BUTTON_LAY_DOWN].Width = static_cast(Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.right - Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.left); + Bmp[Tiles::BUTTON_LAY_DOWN].Height = static_cast(Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.bottom - Bmp[Tiles::BUTTON_LAY_DOWN].sourceRect.top); + Bmp[Tiles::BUTTON_LAY_DOWN].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_LAY_DOWN].Speed = 3; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + + // BUTTSUCHEN + Bmp[Tiles::BUTTON_SEARCH].sourceRect.left = 63; + Bmp[Tiles::BUTTON_SEARCH].sourceRect.top = 0; + Bmp[Tiles::BUTTON_SEARCH].sourceRect.right = 63 + 35; + Bmp[Tiles::BUTTON_SEARCH].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_SEARCH].targetRect.left = rcPanel.left + 29; + Bmp[Tiles::BUTTON_SEARCH].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_SEARCH].targetRect.right = Bmp[Tiles::BUTTON_SEARCH].targetRect.left + 35; + Bmp[Tiles::BUTTON_SEARCH].targetRect.bottom = Bmp[Tiles::BUTTON_SEARCH].targetRect.top + 35; + Bmp[Tiles::BUTTON_SEARCH].Width = static_cast(Bmp[Tiles::BUTTON_SEARCH].sourceRect.right - Bmp[Tiles::BUTTON_SEARCH].sourceRect.left); + Bmp[Tiles::BUTTON_SEARCH].Height = static_cast(Bmp[Tiles::BUTTON_SEARCH].sourceRect.bottom - Bmp[Tiles::BUTTON_SEARCH].sourceRect.top); + Bmp[Tiles::BUTTON_SEARCH].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_SEARCH].Speed = 4; + + // BUTTESSEN + Bmp[Tiles::BUTTON_EAT].sourceRect.left = 133; + Bmp[Tiles::BUTTON_EAT].sourceRect.top = 0; + Bmp[Tiles::BUTTON_EAT].sourceRect.right = 133 + 35; + Bmp[Tiles::BUTTON_EAT].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_EAT].targetRect.left = rcPanel.left + 70; + Bmp[Tiles::BUTTON_EAT].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_EAT].targetRect.right = Bmp[Tiles::BUTTON_EAT].targetRect.left + 35; + Bmp[Tiles::BUTTON_EAT].targetRect.bottom = Bmp[Tiles::BUTTON_EAT].targetRect.top + 35; + Bmp[Tiles::BUTTON_EAT].Width = static_cast(Bmp[Tiles::BUTTON_EAT].sourceRect.right - Bmp[Tiles::BUTTON_EAT].sourceRect.left); + Bmp[Tiles::BUTTON_EAT].Height = static_cast(Bmp[Tiles::BUTTON_EAT].sourceRect.bottom - Bmp[Tiles::BUTTON_EAT].sourceRect.top); + Bmp[Tiles::BUTTON_EAT].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_EAT].Speed = 4; + + // BUTTSCHLAFEN + Bmp[Tiles::BUTTON_SLEEP].sourceRect.left = 308; + Bmp[Tiles::BUTTON_SLEEP].sourceRect.top = 0; + Bmp[Tiles::BUTTON_SLEEP].sourceRect.right = 308 + 35; + Bmp[Tiles::BUTTON_SLEEP].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_SLEEP].targetRect.left = rcPanel.left + 111; + Bmp[Tiles::BUTTON_SLEEP].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_SLEEP].targetRect.right = Bmp[Tiles::BUTTON_SLEEP].targetRect.left + 35; + Bmp[Tiles::BUTTON_SLEEP].targetRect.bottom = Bmp[Tiles::BUTTON_SLEEP].targetRect.top + 35; + Bmp[Tiles::BUTTON_SLEEP].Width = static_cast(Bmp[Tiles::BUTTON_SLEEP].sourceRect.right - Bmp[Tiles::BUTTON_SLEEP].sourceRect.left); + Bmp[Tiles::BUTTON_SLEEP].Height = static_cast(Bmp[Tiles::BUTTON_SLEEP].sourceRect.bottom - Bmp[Tiles::BUTTON_SLEEP].sourceRect.top); + Bmp[Tiles::BUTTON_SLEEP].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_SLEEP].Speed = 3; + + // BUTTFAELLEN + Bmp[Tiles::BUTTON_CHOP].sourceRect.left = 98; + Bmp[Tiles::BUTTON_CHOP].sourceRect.top = 0; + Bmp[Tiles::BUTTON_CHOP].sourceRect.right = 98 + 35; + Bmp[Tiles::BUTTON_CHOP].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_CHOP].targetRect.left = rcPanel.left + 152; + Bmp[Tiles::BUTTON_CHOP].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_CHOP].targetRect.right = Bmp[Tiles::BUTTON_CHOP].targetRect.left + 35; + Bmp[Tiles::BUTTON_CHOP].targetRect.bottom = Bmp[Tiles::BUTTON_CHOP].targetRect.top + 35; + Bmp[Tiles::BUTTON_CHOP].Width = static_cast(Bmp[Tiles::BUTTON_CHOP].sourceRect.right - Bmp[Tiles::BUTTON_CHOP].sourceRect.left); + Bmp[Tiles::BUTTON_CHOP].Height = static_cast(Bmp[Tiles::BUTTON_CHOP].sourceRect.bottom - Bmp[Tiles::BUTTON_CHOP].sourceRect.top); + Bmp[Tiles::BUTTON_CHOP].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_CHOP].Speed = 4; + Bmp[Tiles::BUTTON_CHOP].AnimationPhase = -1; + + // BUTTANGELN + Bmp[Tiles::BUTTON_FISH].sourceRect.left = 413; + Bmp[Tiles::BUTTON_FISH].sourceRect.top = 0; + Bmp[Tiles::BUTTON_FISH].sourceRect.right = 413 + 35; + Bmp[Tiles::BUTTON_FISH].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_FISH].targetRect.left = rcPanel.left + 29; + Bmp[Tiles::BUTTON_FISH].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_FISH].targetRect.right = Bmp[Tiles::BUTTON_FISH].targetRect.left + 35; + Bmp[Tiles::BUTTON_FISH].targetRect.bottom = Bmp[Tiles::BUTTON_FISH].targetRect.top + 35; + Bmp[Tiles::BUTTON_FISH].Width = static_cast(Bmp[Tiles::BUTTON_FISH].sourceRect.right - Bmp[Tiles::BUTTON_FISH].sourceRect.left); + Bmp[Tiles::BUTTON_FISH].Height = static_cast(Bmp[Tiles::BUTTON_FISH].sourceRect.bottom - Bmp[Tiles::BUTTON_FISH].sourceRect.top); + Bmp[Tiles::BUTTON_FISH].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_FISH].Speed = 3; + Bmp[Tiles::BUTTON_FISH].AnimationPhase = -1; + + // BUTTANZUENDEN + Bmp[Tiles::BUTTON_IGNITE].sourceRect.left = 28; + Bmp[Tiles::BUTTON_IGNITE].sourceRect.top = 175; + Bmp[Tiles::BUTTON_IGNITE].sourceRect.right = 28 + 35; + Bmp[Tiles::BUTTON_IGNITE].sourceRect.bottom = 175 + 35; + Bmp[Tiles::BUTTON_IGNITE].targetRect.left = rcPanel.left + 70; + Bmp[Tiles::BUTTON_IGNITE].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_IGNITE].targetRect.right = Bmp[Tiles::BUTTON_IGNITE].targetRect.left + 35; + Bmp[Tiles::BUTTON_IGNITE].targetRect.bottom = Bmp[Tiles::BUTTON_IGNITE].targetRect.top + 35; + Bmp[Tiles::BUTTON_IGNITE].Width = static_cast(Bmp[Tiles::BUTTON_IGNITE].sourceRect.right - Bmp[Tiles::BUTTON_IGNITE].sourceRect.left); + Bmp[Tiles::BUTTON_IGNITE].Height = static_cast(Bmp[Tiles::BUTTON_IGNITE].sourceRect.bottom - Bmp[Tiles::BUTTON_IGNITE].sourceRect.top); + Bmp[Tiles::BUTTON_IGNITE].AnimationPhaseCount = 3; + Bmp[Tiles::BUTTON_IGNITE].Speed = 4; + Bmp[Tiles::BUTTON_IGNITE].AnimationPhase = -1; + + // BUTTAUSSCHAU + Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.left = 63; + Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.top = 175; + Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.right = 63 + 35; + Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.bottom = 175 + 35; + Bmp[Tiles::BUTTON_LOOK_OUT].targetRect.left = rcPanel.left + 111; + Bmp[Tiles::BUTTON_LOOK_OUT].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_LOOK_OUT].targetRect.right = Bmp[Tiles::BUTTON_LOOK_OUT].targetRect.left + 35; + Bmp[Tiles::BUTTON_LOOK_OUT].targetRect.bottom = Bmp[Tiles::BUTTON_LOOK_OUT].targetRect.top + 35; + Bmp[Tiles::BUTTON_LOOK_OUT].Width = static_cast(Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.right - Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.left); + Bmp[Tiles::BUTTON_LOOK_OUT].Height = static_cast(Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.bottom - Bmp[Tiles::BUTTON_LOOK_OUT].sourceRect.top); + Bmp[Tiles::BUTTON_LOOK_OUT].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_LOOK_OUT].Speed = 3; + Bmp[Tiles::BUTTON_LOOK_OUT].AnimationPhase = -1; + + // BUTTSCHATZKARTE + Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.left = 98; + Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.top = 175; + Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.right = 98 + 35; + Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.bottom = 175 + 35; + Bmp[Tiles::BUTTON_TREASUREMAP].targetRect.left = rcPanel.left + 152; + Bmp[Tiles::BUTTON_TREASUREMAP].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_TREASUREMAP].targetRect.right = Bmp[Tiles::BUTTON_TREASUREMAP].targetRect.left + 35; + Bmp[Tiles::BUTTON_TREASUREMAP].targetRect.bottom = Bmp[Tiles::BUTTON_TREASUREMAP].targetRect.top + 35; + Bmp[Tiles::BUTTON_TREASUREMAP].Width = static_cast(Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.right - Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.left); + Bmp[Tiles::BUTTON_TREASUREMAP].Height = static_cast(Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.bottom - Bmp[Tiles::BUTTON_TREASUREMAP].sourceRect.top); + Bmp[Tiles::BUTTON_TREASUREMAP].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_TREASUREMAP].Speed = 3; + Bmp[Tiles::BUTTON_TREASUREMAP].AnimationPhase = -1; + + // BUTTSCHATZ + Bmp[Tiles::BUTTON_TREASURE].sourceRect.left = 133; + Bmp[Tiles::BUTTON_TREASURE].sourceRect.top = 175; + Bmp[Tiles::BUTTON_TREASURE].sourceRect.right = 133 + 35; + Bmp[Tiles::BUTTON_TREASURE].sourceRect.bottom = 175 + 35; + Bmp[Tiles::BUTTON_TREASURE].targetRect.left = rcPanel.left + 29; + Bmp[Tiles::BUTTON_TREASURE].targetRect.top = rcPanel.top + 380; + Bmp[Tiles::BUTTON_TREASURE].targetRect.right = Bmp[Tiles::BUTTON_TREASURE].targetRect.left + 35; + Bmp[Tiles::BUTTON_TREASURE].targetRect.bottom = Bmp[Tiles::BUTTON_TREASURE].targetRect.top + 35; + Bmp[Tiles::BUTTON_TREASURE].Width = static_cast(Bmp[Tiles::BUTTON_TREASURE].sourceRect.right - Bmp[Tiles::BUTTON_TREASURE].sourceRect.left); + Bmp[Tiles::BUTTON_TREASURE].Height = static_cast(Bmp[Tiles::BUTTON_TREASURE].sourceRect.bottom - Bmp[Tiles::BUTTON_TREASURE].sourceRect.top); + Bmp[Tiles::BUTTON_TREASURE].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_TREASURE].Speed = 3; + Bmp[Tiles::BUTTON_TREASURE].AnimationPhase = -1; + + // BUTTSCHLEUDER + Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.left = 168; + Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.top = 175; + Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.right = 168 + 35; + Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.bottom = 175 + 35; + Bmp[Tiles::BUTTON_SLINGSHOT].targetRect.left = rcPanel.left + 70; + Bmp[Tiles::BUTTON_SLINGSHOT].targetRect.top = rcPanel.top + 380; + Bmp[Tiles::BUTTON_SLINGSHOT].targetRect.right = Bmp[Tiles::BUTTON_SLINGSHOT].targetRect.left + 35; + Bmp[Tiles::BUTTON_SLINGSHOT].targetRect.bottom = Bmp[Tiles::BUTTON_SLINGSHOT].targetRect.top + 35; + Bmp[Tiles::BUTTON_SLINGSHOT].Width = static_cast(Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.right - Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.left); + Bmp[Tiles::BUTTON_SLINGSHOT].Height = static_cast(Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.bottom - Bmp[Tiles::BUTTON_SLINGSHOT].sourceRect.top); + Bmp[Tiles::BUTTON_SLINGSHOT].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_SLINGSHOT].Speed = 3; + Bmp[Tiles::BUTTON_SLINGSHOT].AnimationPhase = -1; + + // BUTTFELD + Bmp[Tiles::BUTTON_FARM].sourceRect.left = 238; + Bmp[Tiles::BUTTON_FARM].sourceRect.top = 0; + Bmp[Tiles::BUTTON_FARM].sourceRect.right = 238 + 35; + Bmp[Tiles::BUTTON_FARM].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_FARM].targetRect.left = rcPanel.left + 70; + Bmp[Tiles::BUTTON_FARM].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_FARM].targetRect.right = Bmp[Tiles::BUTTON_FARM].targetRect.left + 35; + Bmp[Tiles::BUTTON_FARM].targetRect.bottom = Bmp[Tiles::BUTTON_FARM].targetRect.top + 35; + Bmp[Tiles::BUTTON_FARM].Width = static_cast(Bmp[Tiles::BUTTON_FARM].sourceRect.right - Bmp[Tiles::BUTTON_FARM].sourceRect.left); + Bmp[Tiles::BUTTON_FARM].Height = static_cast(Bmp[Tiles::BUTTON_FARM].sourceRect.bottom - Bmp[Tiles::BUTTON_FARM].sourceRect.top); + Bmp[Tiles::BUTTON_FARM].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_FARM].Speed = 3; + Bmp[Tiles::BUTTON_FARM].AnimationPhase = -1; + + // BUTTZELT + Bmp[Tiles::BUTTON_TENT].sourceRect.left = 273; + Bmp[Tiles::BUTTON_TENT].sourceRect.top = 0; + Bmp[Tiles::BUTTON_TENT].sourceRect.right = 273 + 35; + Bmp[Tiles::BUTTON_TENT].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_TENT].targetRect.left = rcPanel.left + 29; + Bmp[Tiles::BUTTON_TENT].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_TENT].targetRect.right = Bmp[Tiles::BUTTON_TENT].targetRect.left + 35; + Bmp[Tiles::BUTTON_TENT].targetRect.bottom = Bmp[Tiles::BUTTON_TENT].targetRect.top + 35; + Bmp[Tiles::BUTTON_TENT].Width = static_cast(Bmp[Tiles::BUTTON_TENT].sourceRect.right - Bmp[Tiles::BUTTON_TENT].sourceRect.left); + Bmp[Tiles::BUTTON_TENT].Height = static_cast(Bmp[Tiles::BUTTON_TENT].sourceRect.bottom - Bmp[Tiles::BUTTON_TENT].sourceRect.top); + Bmp[Tiles::BUTTON_TENT].AnimationPhaseCount = 3; + Bmp[Tiles::BUTTON_TENT].Speed = 3; + Bmp[Tiles::BUTTON_TENT].AnimationPhase = 0; + + // BUTTBOOT + Bmp[Tiles::BUTTON_BOAT].sourceRect.left = 448; + Bmp[Tiles::BUTTON_BOAT].sourceRect.top = 0; + Bmp[Tiles::BUTTON_BOAT].sourceRect.right = 448 + 35; + Bmp[Tiles::BUTTON_BOAT].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_BOAT].targetRect.left = rcPanel.left + 111; + Bmp[Tiles::BUTTON_BOAT].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_BOAT].targetRect.right = Bmp[Tiles::BUTTON_BOAT].targetRect.left + 35; + Bmp[Tiles::BUTTON_BOAT].targetRect.bottom = Bmp[Tiles::BUTTON_BOAT].targetRect.top + 35; + Bmp[Tiles::BUTTON_BOAT].Width = static_cast(Bmp[Tiles::BUTTON_BOAT].sourceRect.right - Bmp[Tiles::BUTTON_BOAT].sourceRect.left); + Bmp[Tiles::BUTTON_BOAT].Height = static_cast(Bmp[Tiles::BUTTON_BOAT].sourceRect.bottom - Bmp[Tiles::BUTTON_BOAT].sourceRect.top); + Bmp[Tiles::BUTTON_BOAT].AnimationPhaseCount = 3; + Bmp[Tiles::BUTTON_BOAT].Speed = 3; + Bmp[Tiles::BUTTON_BOAT].AnimationPhase = -1; + + // BUTTROHR + Bmp[Tiles::BUTTON_PIPE].sourceRect.left = 518; + Bmp[Tiles::BUTTON_PIPE].sourceRect.top = 0; + Bmp[Tiles::BUTTON_PIPE].sourceRect.right = 518 + 35; + Bmp[Tiles::BUTTON_PIPE].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_PIPE].targetRect.left = rcPanel.left + 152; + Bmp[Tiles::BUTTON_PIPE].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::BUTTON_PIPE].targetRect.right = Bmp[Tiles::BUTTON_PIPE].targetRect.left + 35; + Bmp[Tiles::BUTTON_PIPE].targetRect.bottom = Bmp[Tiles::BUTTON_PIPE].targetRect.top + 35; + Bmp[Tiles::BUTTON_PIPE].Width = static_cast(Bmp[Tiles::BUTTON_PIPE].sourceRect.right - Bmp[Tiles::BUTTON_PIPE].sourceRect.left); + Bmp[Tiles::BUTTON_PIPE].Height = static_cast(Bmp[Tiles::BUTTON_PIPE].sourceRect.bottom - Bmp[Tiles::BUTTON_PIPE].sourceRect.top); + Bmp[Tiles::BUTTON_PIPE].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_PIPE].Speed = 2; + Bmp[Tiles::BUTTON_PIPE].AnimationPhase = -1; + + // BUTTSOS + Bmp[Tiles::BUTTON_SOS].sourceRect.left = 588; + Bmp[Tiles::BUTTON_SOS].sourceRect.top = 0; + Bmp[Tiles::BUTTON_SOS].sourceRect.right = 588 + 35; + Bmp[Tiles::BUTTON_SOS].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_SOS].targetRect.left = rcPanel.left + 29; + Bmp[Tiles::BUTTON_SOS].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_SOS].targetRect.right = Bmp[Tiles::BUTTON_SOS].targetRect.left + 35; + Bmp[Tiles::BUTTON_SOS].targetRect.bottom = Bmp[Tiles::BUTTON_SOS].targetRect.top + 35; + Bmp[Tiles::BUTTON_SOS].Width = static_cast(Bmp[Tiles::BUTTON_SOS].sourceRect.right - Bmp[Tiles::BUTTON_SOS].sourceRect.left); + Bmp[Tiles::BUTTON_SOS].Height = static_cast(Bmp[Tiles::BUTTON_SOS].sourceRect.bottom - Bmp[Tiles::BUTTON_SOS].sourceRect.top); + Bmp[Tiles::BUTTON_SOS].AnimationPhaseCount = 3; + Bmp[Tiles::BUTTON_SOS].Speed = 2; + + // BUTTHAUS1 + Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.left = 623; + Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.top = 0; + Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.right = 623 + 35; + Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_HOUSE_1].targetRect.left = rcPanel.left + 70; + Bmp[Tiles::BUTTON_HOUSE_1].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_HOUSE_1].targetRect.right = Bmp[Tiles::BUTTON_HOUSE_1].targetRect.left + 35; + Bmp[Tiles::BUTTON_HOUSE_1].targetRect.bottom = Bmp[Tiles::BUTTON_HOUSE_1].targetRect.top + 35; + Bmp[Tiles::BUTTON_HOUSE_1].Width = static_cast(Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.right - Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.left); + Bmp[Tiles::BUTTON_HOUSE_1].Height = static_cast(Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.bottom - Bmp[Tiles::BUTTON_HOUSE_1].sourceRect.top); + Bmp[Tiles::BUTTON_HOUSE_1].AnimationPhaseCount = 5; + Bmp[Tiles::BUTTON_HOUSE_1].Speed = 3; + Bmp[Tiles::BUTTON_HOUSE_1].AnimationPhase = -1; + + // BUTTHAUS2 + Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.left = 658; + Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.top = 0; + Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.right = 658 + 35; + Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_HOUSE_2].targetRect.left = rcPanel.left + 111; + Bmp[Tiles::BUTTON_HOUSE_2].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_HOUSE_2].targetRect.right = Bmp[Tiles::BUTTON_HOUSE_2].targetRect.left + 35; + Bmp[Tiles::BUTTON_HOUSE_2].targetRect.bottom = Bmp[Tiles::BUTTON_HOUSE_2].targetRect.top + 35; + Bmp[Tiles::BUTTON_HOUSE_2].Width = static_cast(Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.right - Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.left); + Bmp[Tiles::BUTTON_HOUSE_2].Height = static_cast(Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.bottom - Bmp[Tiles::BUTTON_HOUSE_2].sourceRect.top); + Bmp[Tiles::BUTTON_HOUSE_2].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_HOUSE_2].Speed = 3; + Bmp[Tiles::BUTTON_HOUSE_2].AnimationPhase = -1; + + // BUTTHAUS3 + Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.left = 693; + Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.top = 0; + Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.right = 693 + 35; + Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_HOUSE_3].targetRect.left = rcPanel.left + 152; + Bmp[Tiles::BUTTON_HOUSE_3].targetRect.top = rcPanel.top + 325; + Bmp[Tiles::BUTTON_HOUSE_3].targetRect.right = Bmp[Tiles::BUTTON_HOUSE_3].targetRect.left + 35; + Bmp[Tiles::BUTTON_HOUSE_3].targetRect.bottom = Bmp[Tiles::BUTTON_HOUSE_3].targetRect.top + 35; + Bmp[Tiles::BUTTON_HOUSE_3].Width = static_cast(Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.right - Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.left); + Bmp[Tiles::BUTTON_HOUSE_3].Height = static_cast(Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.bottom - Bmp[Tiles::BUTTON_HOUSE_3].sourceRect.top); + Bmp[Tiles::BUTTON_HOUSE_3].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_HOUSE_3].Speed = 3; + Bmp[Tiles::BUTTON_HOUSE_3].AnimationPhase = -1; + + // BUTTFEUERST + Bmp[Tiles::BUTTON_FIRE].sourceRect.left = 728; + Bmp[Tiles::BUTTON_FIRE].sourceRect.top = 0; + Bmp[Tiles::BUTTON_FIRE].sourceRect.right = 728 + 35; + Bmp[Tiles::BUTTON_FIRE].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_FIRE].targetRect.left = rcPanel.left + 29; + Bmp[Tiles::BUTTON_FIRE].targetRect.top = rcPanel.top + 380; + Bmp[Tiles::BUTTON_FIRE].targetRect.right = Bmp[Tiles::BUTTON_FIRE].targetRect.left + 35; + Bmp[Tiles::BUTTON_FIRE].targetRect.bottom = Bmp[Tiles::BUTTON_FIRE].targetRect.top + 35; + Bmp[Tiles::BUTTON_FIRE].Width = static_cast(Bmp[Tiles::BUTTON_FIRE].sourceRect.right - Bmp[Tiles::BUTTON_FIRE].sourceRect.left); + Bmp[Tiles::BUTTON_FIRE].Height = static_cast(Bmp[Tiles::BUTTON_FIRE].sourceRect.bottom - Bmp[Tiles::BUTTON_FIRE].sourceRect.top); + Bmp[Tiles::BUTTON_FIRE].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_FIRE].Speed = 3; + + // BUTTFRAGEZ + Bmp[Tiles::BUTTON_QUESTION].sourceRect.left = 203; + Bmp[Tiles::BUTTON_QUESTION].sourceRect.top = 175; + Bmp[Tiles::BUTTON_QUESTION].sourceRect.right = 203 + 35; + Bmp[Tiles::BUTTON_QUESTION].sourceRect.bottom = 175 + 35; + Bmp[Tiles::BUTTON_QUESTION].targetRect.left = 0; + Bmp[Tiles::BUTTON_QUESTION].targetRect.top = 0; + Bmp[Tiles::BUTTON_QUESTION].targetRect.right = 0 + 35; + Bmp[Tiles::BUTTON_QUESTION].targetRect.bottom = 0 + 35; + Bmp[Tiles::BUTTON_QUESTION].Width = static_cast(Bmp[Tiles::BUTTON_QUESTION].sourceRect.right - Bmp[Tiles::BUTTON_QUESTION].sourceRect.left); + Bmp[Tiles::BUTTON_QUESTION].Height = static_cast(Bmp[Tiles::BUTTON_QUESTION].sourceRect.bottom - Bmp[Tiles::BUTTON_QUESTION].sourceRect.top); + Bmp[Tiles::BUTTON_QUESTION].AnimationPhaseCount = 1; + Bmp[Tiles::BUTTON_QUESTION].Speed = 0; + + // BUTTDESTROY + Bmp[Tiles::BUTTON_DESTROY].sourceRect.left = 553; + Bmp[Tiles::BUTTON_DESTROY].sourceRect.top = 0; + Bmp[Tiles::BUTTON_DESTROY].sourceRect.right = 553 + 35; + Bmp[Tiles::BUTTON_DESTROY].sourceRect.bottom = 35; + Bmp[Tiles::BUTTON_DESTROY].targetRect.left = rcPanel.left + 152; + Bmp[Tiles::BUTTON_DESTROY].targetRect.top = rcPanel.top + 380; + Bmp[Tiles::BUTTON_DESTROY].targetRect.right = Bmp[Tiles::BUTTON_DESTROY].targetRect.left + 35; + Bmp[Tiles::BUTTON_DESTROY].targetRect.bottom = Bmp[Tiles::BUTTON_DESTROY].targetRect.top + 35; + Bmp[Tiles::BUTTON_DESTROY].Width = static_cast(Bmp[Tiles::BUTTON_DESTROY].sourceRect.right - Bmp[Tiles::BUTTON_DESTROY].sourceRect.left); + Bmp[Tiles::BUTTON_DESTROY].Height = static_cast(Bmp[Tiles::BUTTON_DESTROY].sourceRect.bottom - Bmp[Tiles::BUTTON_DESTROY].sourceRect.top); + Bmp[Tiles::BUTTON_DESTROY].AnimationPhaseCount = 4; + Bmp[Tiles::BUTTON_DESTROY].Speed = 5; + + // SpzAni + for (i = Tiles::TREE_DOWN_1; i <= Tiles::TREE_DOWN_4; i++) { + Bmp[i].IsAnimationRunning = true; + Bmp[i].Surface = lpDDSBaum; + Bmp[i].AnimationPhase = 0; + Bmp[i].targetRect.left = 0; + Bmp[i].targetRect.top = 0; + Bmp[i].targetRect.right = 0; + Bmp[i].targetRect.bottom = 0; + Bmp[i].AnimationPhaseCount = 3; + Bmp[i].Speed = 4; + } + + // BAUM1DOWN + Bmp[Tiles::TREE_DOWN_1].sourceRect.left = 101; + Bmp[Tiles::TREE_DOWN_1].sourceRect.top = 0; + Bmp[Tiles::TREE_DOWN_1].sourceRect.right = 101 + 35; + Bmp[Tiles::TREE_DOWN_1].sourceRect.bottom = 27; + Bmp[Tiles::TREE_DOWN_1].Width = static_cast(Bmp[Tiles::TREE_DOWN_1].sourceRect.right - Bmp[Tiles::TREE_DOWN_1].sourceRect.left); + Bmp[Tiles::TREE_DOWN_1].Height = static_cast(Bmp[Tiles::TREE_DOWN_1].sourceRect.bottom - Bmp[Tiles::TREE_DOWN_1].sourceRect.top); + + // BAUM2DOWN + Bmp[Tiles::TREE_DOWN_2].sourceRect.left = 136; + Bmp[Tiles::TREE_DOWN_2].sourceRect.top = 0; + Bmp[Tiles::TREE_DOWN_2].sourceRect.right = 136 + 36; + Bmp[Tiles::TREE_DOWN_2].sourceRect.bottom = 27; + Bmp[Tiles::TREE_DOWN_2].Width = static_cast(Bmp[Tiles::TREE_DOWN_2].sourceRect.right - Bmp[Tiles::TREE_DOWN_2].sourceRect.left); + Bmp[Tiles::TREE_DOWN_2].Height = static_cast(Bmp[Tiles::TREE_DOWN_2].sourceRect.bottom - Bmp[Tiles::TREE_DOWN_2].sourceRect.top); + + // BAUM3DOWN + Bmp[Tiles::TREE_DOWN_3].sourceRect.left = 172; + Bmp[Tiles::TREE_DOWN_3].sourceRect.top = 0; + Bmp[Tiles::TREE_DOWN_3].sourceRect.right = 172 + 34; + Bmp[Tiles::TREE_DOWN_3].sourceRect.bottom = 28; + Bmp[Tiles::TREE_DOWN_3].Width = static_cast(Bmp[Tiles::TREE_DOWN_3].sourceRect.right - Bmp[Tiles::TREE_DOWN_3].sourceRect.left); + Bmp[Tiles::TREE_DOWN_3].Height = static_cast(Bmp[Tiles::TREE_DOWN_3].sourceRect.bottom - Bmp[Tiles::TREE_DOWN_3].sourceRect.top); + + // BAUM4DOWN + Bmp[Tiles::TREE_DOWN_4].sourceRect.left = 206; + Bmp[Tiles::TREE_DOWN_4].sourceRect.top = 0; + Bmp[Tiles::TREE_DOWN_4].sourceRect.right = 206 + 32; + Bmp[Tiles::TREE_DOWN_4].sourceRect.bottom = 17; + Bmp[Tiles::TREE_DOWN_4].Width = static_cast(Bmp[Tiles::TREE_DOWN_4].sourceRect.right - Bmp[Tiles::TREE_DOWN_4].sourceRect.left); + Bmp[Tiles::TREE_DOWN_4].Height = static_cast(Bmp[Tiles::TREE_DOWN_4].sourceRect.bottom - Bmp[Tiles::TREE_DOWN_4].sourceRect.top); + + // Sonstiges + + // Säule1 + Bmp[Tiles::COLUMN_1].AnimationPhaseCount = 1; + Bmp[Tiles::COLUMN_1].sourceRect.left = 205; + Bmp[Tiles::COLUMN_1].sourceRect.top = 115; + Bmp[Tiles::COLUMN_1].sourceRect.right = Bmp[Tiles::COLUMN_1].sourceRect.left + 11; + Bmp[Tiles::COLUMN_1].sourceRect.bottom = Bmp[Tiles::COLUMN_1].sourceRect.top + 115; + Bmp[Tiles::COLUMN_1].targetRect.left = rcPanel.left + 52; + Bmp[Tiles::COLUMN_1].targetRect.top = rcPanel.top + 471; + Bmp[Tiles::COLUMN_1].targetRect.right = Bmp[Tiles::COLUMN_1].targetRect.left + 11; + Bmp[Tiles::COLUMN_1].targetRect.bottom = Bmp[Tiles::COLUMN_1].targetRect.top + 115; + Bmp[Tiles::COLUMN_1].Width = static_cast(Bmp[Tiles::COLUMN_1].sourceRect.right - Bmp[Tiles::COLUMN_1].sourceRect.left); + Bmp[Tiles::COLUMN_1].Height = static_cast(Bmp[Tiles::COLUMN_1].sourceRect.bottom - Bmp[Tiles::COLUMN_1].sourceRect.top); + Bmp[Tiles::COLUMN_1].Surface = lpDDSPanel; + + // Säule2 + Bmp[Tiles::COLUMN_2].AnimationPhaseCount = 1; + Bmp[Tiles::COLUMN_2].sourceRect.left = 216; + Bmp[Tiles::COLUMN_2].sourceRect.top = 115; + Bmp[Tiles::COLUMN_2].sourceRect.right = Bmp[Tiles::COLUMN_2].sourceRect.left + 11; + Bmp[Tiles::COLUMN_2].sourceRect.bottom = Bmp[Tiles::COLUMN_2].sourceRect.top + 115; + Bmp[Tiles::COLUMN_2].targetRect.left = rcPanel.left + 114; + Bmp[Tiles::COLUMN_2].targetRect.top = rcPanel.top + 471; + Bmp[Tiles::COLUMN_2].targetRect.right = Bmp[Tiles::COLUMN_2].targetRect.left + 11; + Bmp[Tiles::COLUMN_2].targetRect.bottom = Bmp[Tiles::COLUMN_2].targetRect.top + 115; + Bmp[Tiles::COLUMN_2].Width = static_cast(Bmp[Tiles::COLUMN_2].sourceRect.right - Bmp[Tiles::COLUMN_2].sourceRect.left); + Bmp[Tiles::COLUMN_2].Height = static_cast(Bmp[Tiles::COLUMN_2].sourceRect.bottom - Bmp[Tiles::COLUMN_2].sourceRect.top); + Bmp[Tiles::COLUMN_2].Surface = lpDDSPanel; + + // Säule3 + Bmp[Tiles::COLUMN_3].AnimationPhaseCount = 1; + Bmp[Tiles::COLUMN_3].sourceRect.left = 227; + Bmp[Tiles::COLUMN_3].sourceRect.top = 115; + Bmp[Tiles::COLUMN_3].sourceRect.right = Bmp[Tiles::COLUMN_3].sourceRect.left + 11; + Bmp[Tiles::COLUMN_3].sourceRect.bottom = Bmp[Tiles::COLUMN_3].sourceRect.top + 115; + Bmp[Tiles::COLUMN_3].targetRect.left = rcPanel.left + 175; + Bmp[Tiles::COLUMN_3].targetRect.top = rcPanel.top + 471; + Bmp[Tiles::COLUMN_3].targetRect.right = Bmp[Tiles::COLUMN_3].targetRect.left + 11; + Bmp[Tiles::COLUMN_3].targetRect.bottom = Bmp[Tiles::COLUMN_3].targetRect.top + 115; + Bmp[Tiles::COLUMN_3].Width = static_cast(Bmp[Tiles::COLUMN_3].sourceRect.right - Bmp[Tiles::COLUMN_3].sourceRect.left); + Bmp[Tiles::COLUMN_3].Height = static_cast(Bmp[Tiles::COLUMN_3].sourceRect.bottom - Bmp[Tiles::COLUMN_3].sourceRect.top); + Bmp[Tiles::COLUMN_3].Surface = lpDDSPanel; + + // Rohstoffe + for (i = Tiles::RAW_TREE_BRANCH; i <= Tiles::RAW_SLINGSHOT; i++) { + Bmp[i].AnimationPhaseCount = 1; + Bmp[i].sourceRect.left = 18 + (i - Tiles::RAW_TREE_BRANCH) * 16; + Bmp[i].sourceRect.top = 0; + Bmp[i].sourceRect.right = Bmp[i].sourceRect.left + 16; + Bmp[i].sourceRect.bottom = Bmp[i].sourceRect.top + 15; + Bmp[i].Width = static_cast(Bmp[i].sourceRect.right - Bmp[i].sourceRect.left); + Bmp[i].Height = static_cast(Bmp[i].sourceRect.bottom - Bmp[i].sourceRect.top); + Bmp[i].Surface = lpDDSInventar; + } + + // RohAst + Bmp[Tiles::RAW_TREE_BRANCH].targetRect.left = rcPanel.left + 34; + Bmp[Tiles::RAW_TREE_BRANCH].targetRect.top = rcPanel.top + 280; + Bmp[Tiles::RAW_TREE_BRANCH].targetRect.right = Bmp[Tiles::RAW_TREE_BRANCH].targetRect.left + 16; + Bmp[Tiles::RAW_TREE_BRANCH].targetRect.bottom = Bmp[Tiles::RAW_TREE_BRANCH].targetRect.top + 15; + // ROHSTEIN + Bmp[Tiles::RAW_STONE].targetRect.left = rcPanel.left + 34; + Bmp[Tiles::RAW_STONE].targetRect.top = rcPanel.top + 300; + Bmp[Tiles::RAW_STONE].targetRect.right = Bmp[Tiles::RAW_STONE].targetRect.left + 16; + Bmp[Tiles::RAW_STONE].targetRect.bottom = Bmp[Tiles::RAW_STONE].targetRect.top + 15; + // ROHSTAMM + Bmp[Tiles::RAW_TREE_TRUNK].targetRect.left = rcPanel.left + 34; + Bmp[Tiles::RAW_TREE_TRUNK].targetRect.top = rcPanel.top + 360; + Bmp[Tiles::RAW_TREE_TRUNK].targetRect.right = Bmp[Tiles::RAW_TREE_TRUNK].targetRect.left + 16; + Bmp[Tiles::RAW_TREE_TRUNK].targetRect.bottom = Bmp[Tiles::RAW_TREE_TRUNK].targetRect.top + 15; + // ROHAXT + Bmp[Tiles::RAW_AXE].targetRect.left = rcPanel.left + 150; + Bmp[Tiles::RAW_AXE].targetRect.top = rcPanel.top + 280; + Bmp[Tiles::RAW_AXE].targetRect.right = Bmp[Tiles::RAW_AXE].targetRect.left + 16; + Bmp[Tiles::RAW_AXE].targetRect.bottom = Bmp[Tiles::RAW_AXE].targetRect.top + 15; + // ROHBLATT + Bmp[Tiles::RAW_LEAF].targetRect.left = rcPanel.left + 34; + Bmp[Tiles::RAW_LEAF].targetRect.top = rcPanel.top + 320; + Bmp[Tiles::RAW_LEAF].targetRect.right = Bmp[Tiles::RAW_LEAF].targetRect.left + 16; + Bmp[Tiles::RAW_LEAF].targetRect.bottom = Bmp[Tiles::RAW_LEAF].targetRect.top + 15; + // ROHEGGE + Bmp[Tiles::RAW_HOE].targetRect.left = rcPanel.left + 150; + Bmp[Tiles::RAW_HOE].targetRect.top = rcPanel.top + 300; + Bmp[Tiles::RAW_HOE].targetRect.right = Bmp[Tiles::RAW_HOE].targetRect.left + 16; + Bmp[Tiles::RAW_HOE].targetRect.bottom = Bmp[Tiles::RAW_HOE].targetRect.top + 15; + // ROHLIANE + Bmp[Tiles::RAW_LIANA].targetRect.left = rcPanel.left + 34; + Bmp[Tiles::RAW_LIANA].targetRect.top = rcPanel.top + 340; + Bmp[Tiles::RAW_LIANA].targetRect.right = Bmp[Tiles::RAW_LIANA].targetRect.left + 16; + Bmp[Tiles::RAW_LIANA].targetRect.bottom = Bmp[Tiles::RAW_LIANA].targetRect.top + 15; + // ROHANGEL + Bmp[Tiles::RAW_FISHING_POLE].targetRect.left = rcPanel.left + 150; + Bmp[Tiles::RAW_FISHING_POLE].targetRect.top = rcPanel.top + 320; + Bmp[Tiles::RAW_FISHING_POLE].targetRect.right = Bmp[Tiles::RAW_FISHING_POLE].targetRect.left + 16; + Bmp[Tiles::RAW_FISHING_POLE].targetRect.bottom = Bmp[Tiles::RAW_FISHING_POLE].targetRect.top + 15; + // ROHHAMMER + Bmp[Tiles::RAW_HAMMER].targetRect.left = rcPanel.left + 150; + Bmp[Tiles::RAW_HAMMER].targetRect.top = rcPanel.top + 340; + Bmp[Tiles::RAW_HAMMER].targetRect.right = Bmp[Tiles::RAW_HAMMER].targetRect.left + 16; + Bmp[Tiles::RAW_HAMMER].targetRect.bottom = Bmp[Tiles::RAW_HAMMER].targetRect.top + 15; + // ROHFERNROHR + Bmp[Tiles::RAW_TELESCOPE].targetRect.left = rcPanel.left + 150; + Bmp[Tiles::RAW_TELESCOPE].targetRect.top = rcPanel.top + 360; + Bmp[Tiles::RAW_TELESCOPE].targetRect.right = Bmp[Tiles::RAW_TELESCOPE].targetRect.left + 16; + Bmp[Tiles::RAW_TELESCOPE].targetRect.bottom = Bmp[Tiles::RAW_TELESCOPE].targetRect.top + 15; + // ROHSTREICHHOLZ + Bmp[Tiles::RAW_MATCH].targetRect.left = rcPanel.left + 105; + Bmp[Tiles::RAW_MATCH].targetRect.top = rcPanel.top + 280; + Bmp[Tiles::RAW_MATCH].targetRect.right = Bmp[Tiles::RAW_MATCH].targetRect.left + 16; + Bmp[Tiles::RAW_MATCH].targetRect.bottom = Bmp[Tiles::RAW_MATCH].targetRect.top + 15; + // ROHSCHAUFEL + Bmp[Tiles::RAW_SHOVEL].targetRect.left = rcPanel.left + 105; + Bmp[Tiles::RAW_SHOVEL].targetRect.top = rcPanel.top + 320; + Bmp[Tiles::RAW_SHOVEL].targetRect.right = Bmp[Tiles::RAW_SHOVEL].targetRect.left + 16; + Bmp[Tiles::RAW_SHOVEL].targetRect.bottom = Bmp[Tiles::RAW_SHOVEL].targetRect.top + 15; + // ROHKARTE + Bmp[Tiles::RAW_MAP].targetRect.left = rcPanel.left + 105; + Bmp[Tiles::RAW_MAP].targetRect.top = rcPanel.top + 320; + Bmp[Tiles::RAW_MAP].targetRect.right = Bmp[Tiles::RAW_MAP].targetRect.left + 16; + Bmp[Tiles::RAW_MAP].targetRect.bottom = Bmp[Tiles::RAW_MAP].targetRect.top + 15; + // ROHSCHLEUDER + Bmp[Tiles::RAW_SLINGSHOT].targetRect.left = rcPanel.left + 105; + Bmp[Tiles::RAW_SLINGSHOT].targetRect.top = rcPanel.top + 340; + Bmp[Tiles::RAW_SLINGSHOT].targetRect.right = Bmp[Tiles::RAW_SLINGSHOT].targetRect.left + 16; + Bmp[Tiles::RAW_SLINGSHOT].targetRect.bottom = Bmp[Tiles::RAW_SLINGSHOT].targetRect.top + 15; + + // ROEMISCH1 + Bmp[Tiles::ROEMISCH1].AnimationPhaseCount = 1; + Bmp[Tiles::ROEMISCH1].sourceRect.left = 0; + Bmp[Tiles::ROEMISCH1].sourceRect.top = 0; + Bmp[Tiles::ROEMISCH1].sourceRect.right = Bmp[Tiles::ROEMISCH1].sourceRect.left + 3; + Bmp[Tiles::ROEMISCH1].sourceRect.bottom = Bmp[Tiles::ROEMISCH1].sourceRect.top + 13; + Bmp[Tiles::ROEMISCH1].targetRect.left = rcPanel.left + 50; + Bmp[Tiles::ROEMISCH1].targetRect.top = rcPanel.top; + Bmp[Tiles::ROEMISCH1].targetRect.right = Bmp[Tiles::ROEMISCH1].targetRect.left + 3; + Bmp[Tiles::ROEMISCH1].targetRect.bottom = Bmp[Tiles::ROEMISCH1].targetRect.top + 13; + Bmp[Tiles::ROEMISCH1].Width = static_cast(Bmp[Tiles::ROEMISCH1].sourceRect.right - Bmp[Tiles::ROEMISCH1].sourceRect.left); + Bmp[Tiles::ROEMISCH1].Height = static_cast(Bmp[Tiles::ROEMISCH1].sourceRect.bottom - Bmp[Tiles::ROEMISCH1].sourceRect.top); + Bmp[Tiles::ROEMISCH1].Surface = lpDDSInventar; + + // ROEMISCH2 + Bmp[Tiles::ROEMISCH2].AnimationPhaseCount = 1; + Bmp[Tiles::ROEMISCH2].sourceRect.left = 3; + Bmp[Tiles::ROEMISCH2].sourceRect.top = 0; + Bmp[Tiles::ROEMISCH2].sourceRect.right = Bmp[Tiles::ROEMISCH2].sourceRect.left + 15; + Bmp[Tiles::ROEMISCH2].sourceRect.bottom = Bmp[Tiles::ROEMISCH2].sourceRect.top + 10; + Bmp[Tiles::ROEMISCH2].targetRect.left = rcPanel.left + 50; + Bmp[Tiles::ROEMISCH2].targetRect.top = rcPanel.top; + Bmp[Tiles::ROEMISCH2].targetRect.right = Bmp[Tiles::ROEMISCH2].targetRect.left + 15; + Bmp[Tiles::ROEMISCH2].targetRect.bottom = Bmp[Tiles::ROEMISCH2].targetRect.top + 10; + Bmp[Tiles::ROEMISCH2].Width = static_cast(Bmp[Tiles::ROEMISCH2].sourceRect.right - Bmp[Tiles::ROEMISCH2].sourceRect.left); + Bmp[Tiles::ROEMISCH2].Height = static_cast(Bmp[Tiles::ROEMISCH2].sourceRect.bottom - Bmp[Tiles::ROEMISCH2].sourceRect.top); + Bmp[Tiles::ROEMISCH2].Surface = lpDDSInventar; + + // INVPAPIER + Bmp[Tiles::INVENTORY_PAPER].AnimationPhaseCount = 1; + Bmp[Tiles::INVENTORY_PAPER].sourceRect.left = 0; + Bmp[Tiles::INVENTORY_PAPER].sourceRect.top = 15; + Bmp[Tiles::INVENTORY_PAPER].sourceRect.right = Bmp[Tiles::INVENTORY_PAPER].sourceRect.left + 178; + Bmp[Tiles::INVENTORY_PAPER].sourceRect.bottom = Bmp[Tiles::INVENTORY_PAPER].sourceRect.top + 114; + Bmp[Tiles::INVENTORY_PAPER].targetRect.left = rcPanel.left + 15; + Bmp[Tiles::INVENTORY_PAPER].targetRect.top = rcPanel.top + 270; + Bmp[Tiles::INVENTORY_PAPER].targetRect.right = Bmp[Tiles::INVENTORY_PAPER].targetRect.left + 178; + Bmp[Tiles::INVENTORY_PAPER].targetRect.bottom = Bmp[Tiles::INVENTORY_PAPER].targetRect.top + 114; + Bmp[Tiles::INVENTORY_PAPER].Width = static_cast(Bmp[Tiles::INVENTORY_PAPER].sourceRect.right - Bmp[Tiles::INVENTORY_PAPER].sourceRect.left); + Bmp[Tiles::INVENTORY_PAPER].Height = static_cast(Bmp[Tiles::INVENTORY_PAPER].sourceRect.bottom - Bmp[Tiles::INVENTORY_PAPER].sourceRect.top); + Bmp[Tiles::INVENTORY_PAPER].Surface = lpDDSInventar; + + // RING + Bmp[Tiles::RING].AnimationPhaseCount = 1; + Bmp[Tiles::RING].sourceRect.left = 205; + Bmp[Tiles::RING].sourceRect.top = 230; + Bmp[Tiles::RING].sourceRect.right = Bmp[Tiles::RING].sourceRect.left + 37; + Bmp[Tiles::RING].sourceRect.bottom = Bmp[Tiles::RING].sourceRect.top + 150; + Bmp[Tiles::RING].targetRect.left = rcPanel.left + 5; + Bmp[Tiles::RING].targetRect.top = rcPanel.top - 113; + Bmp[Tiles::RING].targetRect.right = Bmp[Tiles::RING].targetRect.left + 30; + Bmp[Tiles::RING].targetRect.bottom = Bmp[Tiles::RING].targetRect.top; + Bmp[Tiles::RING].Width = static_cast(Bmp[Tiles::RING].sourceRect.right - Bmp[Tiles::RING].sourceRect.left); + Bmp[Tiles::RING].Height = static_cast(Bmp[Tiles::RING].sourceRect.bottom - Bmp[Tiles::RING].sourceRect.top); + Bmp[Tiles::RING].Surface = lpDDSPanel; + + // KREUZ + Bmp[Tiles::CROSS].AnimationPhaseCount = 1; + Bmp[Tiles::CROSS].sourceRect.left = 205; + Bmp[Tiles::CROSS].sourceRect.top = 380; + Bmp[Tiles::CROSS].sourceRect.right = Bmp[Tiles::CROSS].sourceRect.left + 40; + Bmp[Tiles::CROSS].sourceRect.bottom = Bmp[Tiles::CROSS].sourceRect.top + 22; + Bmp[Tiles::CROSS].Width = static_cast(Bmp[Tiles::CROSS].sourceRect.right - Bmp[Tiles::CROSS].sourceRect.left); + Bmp[Tiles::CROSS].Height = static_cast(Bmp[Tiles::CROSS].sourceRect.bottom - Bmp[Tiles::CROSS].sourceRect.top); + Bmp[Tiles::CROSS].Surface = lpDDSPanel; + + // JA + Bmp[Tiles::YES].AnimationPhaseCount = 1; + Bmp[Tiles::YES].sourceRect.left = 0; + Bmp[Tiles::YES].sourceRect.top = 154; + Bmp[Tiles::YES].sourceRect.right = Bmp[Tiles::YES].sourceRect.left + 41; + Bmp[Tiles::YES].sourceRect.bottom = Bmp[Tiles::YES].sourceRect.top + 42; + Bmp[Tiles::YES].Width = static_cast(Bmp[Tiles::YES].sourceRect.right - Bmp[Tiles::YES].sourceRect.left); + Bmp[Tiles::YES].Height = static_cast(Bmp[Tiles::YES].sourceRect.bottom - Bmp[Tiles::YES].sourceRect.top); + Bmp[Tiles::YES].Surface = lpDDSPaper; + + // NEIN + Bmp[Tiles::NO].AnimationPhaseCount = 1; + Bmp[Tiles::NO].sourceRect.left = 41; + Bmp[Tiles::NO].sourceRect.top = 154; + Bmp[Tiles::NO].sourceRect.right = Bmp[Tiles::NO].sourceRect.left + 100; + Bmp[Tiles::NO].sourceRect.bottom = Bmp[Tiles::NO].sourceRect.top + 39; + Bmp[Tiles::NO].Width = static_cast(Bmp[Tiles::NO].sourceRect.right - Bmp[Tiles::NO].sourceRect.left); + Bmp[Tiles::NO].Height = static_cast(Bmp[Tiles::NO].sourceRect.bottom - Bmp[Tiles::NO].sourceRect.top); + Bmp[Tiles::NO].Surface = lpDDSPaper; + + // Sonne + Bmp[Tiles::SUN].AnimationPhaseCount = 1; + Bmp[Tiles::SUN].sourceRect.left = 205; + Bmp[Tiles::SUN].sourceRect.top = 65; + Bmp[Tiles::SUN].sourceRect.right = Bmp[Tiles::SUN].sourceRect.left + 51; + Bmp[Tiles::SUN].sourceRect.bottom = Bmp[Tiles::SUN].sourceRect.top + 50; + Bmp[Tiles::SUN].targetRect.left = rcPanel.left + 30; + Bmp[Tiles::SUN].targetRect.top = rcPanel.top + 630; + Bmp[Tiles::SUN].targetRect.right = Bmp[Tiles::SUN].targetRect.left + 152; + Bmp[Tiles::SUN].targetRect.bottom = Bmp[Tiles::SUN].targetRect.top + 55; + Bmp[Tiles::SUN].Width = static_cast(Bmp[Tiles::SUN].sourceRect.right - Bmp[Tiles::SUN].sourceRect.left); + Bmp[Tiles::SUN].Height = static_cast(Bmp[Tiles::SUN].sourceRect.bottom - Bmp[Tiles::SUN].sourceRect.top); + Bmp[Tiles::SUN].Surface = lpDDSPanel; + + // PROGRAMMIERUNG + Bmp[Tiles::PROGRAMMING].AnimationPhaseCount = 1; + Bmp[Tiles::PROGRAMMING].sourceRect.left = 0; + Bmp[Tiles::PROGRAMMING].sourceRect.top = 0; + Bmp[Tiles::PROGRAMMING].sourceRect.right = Bmp[Tiles::PROGRAMMING].sourceRect.left + 348; + Bmp[Tiles::PROGRAMMING].sourceRect.bottom = Bmp[Tiles::PROGRAMMING].sourceRect.top + 49; + Bmp[Tiles::PROGRAMMING].Width = static_cast(Bmp[Tiles::PROGRAMMING].sourceRect.right - Bmp[Tiles::PROGRAMMING].sourceRect.left); + Bmp[Tiles::PROGRAMMING].Height = static_cast(Bmp[Tiles::PROGRAMMING].sourceRect.bottom - Bmp[Tiles::PROGRAMMING].sourceRect.top); + Bmp[Tiles::PROGRAMMING].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::PROGRAMMING].Width / 2; + Bmp[Tiles::PROGRAMMING].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::PROGRAMMING].Height / 2; + Bmp[Tiles::PROGRAMMING].targetRect.right = Bmp[Tiles::PROGRAMMING].targetRect.left + Bmp[Tiles::PROGRAMMING].Width; + Bmp[Tiles::PROGRAMMING].targetRect.bottom = Bmp[Tiles::PROGRAMMING].targetRect.top + Bmp[Tiles::PROGRAMMING].Height; + Bmp[Tiles::PROGRAMMING].Surface = lpDDSCredits; + + // DIRKPLATE + Bmp[Tiles::DIRK_PLATE].AnimationPhaseCount = 1; + Bmp[Tiles::DIRK_PLATE].sourceRect.left = 0; + Bmp[Tiles::DIRK_PLATE].sourceRect.top = 49; + Bmp[Tiles::DIRK_PLATE].sourceRect.right = Bmp[Tiles::DIRK_PLATE].sourceRect.left + 196; + Bmp[Tiles::DIRK_PLATE].sourceRect.bottom = Bmp[Tiles::DIRK_PLATE].sourceRect.top + 47; + Bmp[Tiles::DIRK_PLATE].Width = static_cast(Bmp[Tiles::DIRK_PLATE].sourceRect.right - Bmp[Tiles::DIRK_PLATE].sourceRect.left); + Bmp[Tiles::DIRK_PLATE].Height = static_cast(Bmp[Tiles::DIRK_PLATE].sourceRect.bottom - Bmp[Tiles::DIRK_PLATE].sourceRect.top); + Bmp[Tiles::DIRK_PLATE].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::DIRK_PLATE].Width / 2; + Bmp[Tiles::DIRK_PLATE].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::DIRK_PLATE].Height / 2; + Bmp[Tiles::DIRK_PLATE].targetRect.right = Bmp[Tiles::DIRK_PLATE].targetRect.left + Bmp[Tiles::DIRK_PLATE].Width; + Bmp[Tiles::DIRK_PLATE].targetRect.bottom = Bmp[Tiles::DIRK_PLATE].targetRect.top + Bmp[Tiles::DIRK_PLATE].Height; + Bmp[Tiles::DIRK_PLATE].Surface = lpDDSCredits; + + // MATTHIAS + Bmp[Tiles::MATTHIAS].AnimationPhaseCount = 1; + Bmp[Tiles::MATTHIAS].sourceRect.left = 0; + Bmp[Tiles::MATTHIAS].sourceRect.top = 96; + Bmp[Tiles::MATTHIAS].sourceRect.right = Bmp[Tiles::MATTHIAS].sourceRect.left + 379; + Bmp[Tiles::MATTHIAS].sourceRect.bottom = Bmp[Tiles::MATTHIAS].sourceRect.top + 47; + Bmp[Tiles::MATTHIAS].Width = static_cast(Bmp[Tiles::MATTHIAS].sourceRect.right - Bmp[Tiles::MATTHIAS].sourceRect.left); + Bmp[Tiles::MATTHIAS].Height = static_cast(Bmp[Tiles::MATTHIAS].sourceRect.bottom - Bmp[Tiles::MATTHIAS].sourceRect.top); + Bmp[Tiles::MATTHIAS].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::MATTHIAS].Width / 2; + Bmp[Tiles::MATTHIAS].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::MATTHIAS].Height / 2; + Bmp[Tiles::MATTHIAS].targetRect.right = Bmp[Tiles::MATTHIAS].targetRect.left + Bmp[Tiles::MATTHIAS].Width; + Bmp[Tiles::MATTHIAS].targetRect.bottom = Bmp[Tiles::MATTHIAS].targetRect.top + Bmp[Tiles::MATTHIAS].Height; + Bmp[Tiles::MATTHIAS].Surface = lpDDSCredits; + + // TESTSPIELER + Bmp[Tiles::TEST_PLAYER].AnimationPhaseCount = 1; + Bmp[Tiles::TEST_PLAYER].sourceRect.left = 0; + Bmp[Tiles::TEST_PLAYER].sourceRect.top = 143; + Bmp[Tiles::TEST_PLAYER].sourceRect.right = Bmp[Tiles::TEST_PLAYER].sourceRect.left + 210; + Bmp[Tiles::TEST_PLAYER].sourceRect.bottom = Bmp[Tiles::TEST_PLAYER].sourceRect.top + 55; + Bmp[Tiles::TEST_PLAYER].Width = static_cast(Bmp[Tiles::TEST_PLAYER].sourceRect.right - Bmp[Tiles::TEST_PLAYER].sourceRect.left); + Bmp[Tiles::TEST_PLAYER].Height = static_cast(Bmp[Tiles::TEST_PLAYER].sourceRect.bottom - Bmp[Tiles::TEST_PLAYER].sourceRect.top); + Bmp[Tiles::TEST_PLAYER].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::TEST_PLAYER].Width / 2; + Bmp[Tiles::TEST_PLAYER].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::TEST_PLAYER].Height / 2; + Bmp[Tiles::TEST_PLAYER].targetRect.right = Bmp[Tiles::TEST_PLAYER].targetRect.left + Bmp[Tiles::TEST_PLAYER].Width; + Bmp[Tiles::TEST_PLAYER].targetRect.bottom = Bmp[Tiles::TEST_PLAYER].targetRect.top + Bmp[Tiles::TEST_PLAYER].Height; + Bmp[Tiles::TEST_PLAYER].Surface = lpDDSCredits; + + // TOBIAS + Bmp[Tiles::TOBIAS].AnimationPhaseCount = 1; + Bmp[Tiles::TOBIAS].sourceRect.left = 0; + Bmp[Tiles::TOBIAS].sourceRect.top = 198; + Bmp[Tiles::TOBIAS].sourceRect.right = Bmp[Tiles::TOBIAS].sourceRect.left + 273; + Bmp[Tiles::TOBIAS].sourceRect.bottom = Bmp[Tiles::TOBIAS].sourceRect.top + 56; + Bmp[Tiles::TOBIAS].Width = static_cast(Bmp[Tiles::TOBIAS].sourceRect.right - Bmp[Tiles::TOBIAS].sourceRect.left); + Bmp[Tiles::TOBIAS].Height = static_cast(Bmp[Tiles::TOBIAS].sourceRect.bottom - Bmp[Tiles::TOBIAS].sourceRect.top); + Bmp[Tiles::TOBIAS].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::TOBIAS].Width / 2; + Bmp[Tiles::TOBIAS].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::TOBIAS].Height / 2; + Bmp[Tiles::TOBIAS].targetRect.right = Bmp[Tiles::TOBIAS].targetRect.left + Bmp[Tiles::TOBIAS].Width; + Bmp[Tiles::TOBIAS].targetRect.bottom = Bmp[Tiles::TOBIAS].targetRect.top + Bmp[Tiles::TOBIAS].Height; + Bmp[Tiles::TOBIAS].Surface = lpDDSCredits; + + // SIGRID + Bmp[Tiles::SIGRID].AnimationPhaseCount = 1; + Bmp[Tiles::SIGRID].sourceRect.left = 0; + Bmp[Tiles::SIGRID].sourceRect.top = 254; + Bmp[Tiles::SIGRID].sourceRect.right = Bmp[Tiles::SIGRID].sourceRect.left + 226; + Bmp[Tiles::SIGRID].sourceRect.bottom = Bmp[Tiles::SIGRID].sourceRect.top + 56; + Bmp[Tiles::SIGRID].Width = static_cast(Bmp[Tiles::SIGRID].sourceRect.right - Bmp[Tiles::SIGRID].sourceRect.left); + Bmp[Tiles::SIGRID].Height = static_cast(Bmp[Tiles::SIGRID].sourceRect.bottom - Bmp[Tiles::SIGRID].sourceRect.top); + Bmp[Tiles::SIGRID].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::SIGRID].Width / 2; + Bmp[Tiles::SIGRID].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::SIGRID].Height / 2; + Bmp[Tiles::SIGRID].targetRect.right = Bmp[Tiles::SIGRID].targetRect.left + Bmp[Tiles::SIGRID].Width; + Bmp[Tiles::SIGRID].targetRect.bottom = Bmp[Tiles::SIGRID].targetRect.top + Bmp[Tiles::SIGRID].Height; + Bmp[Tiles::SIGRID].Surface = lpDDSCredits; + + // PATHFINDING + Bmp[Tiles::PATHFINDING].AnimationPhaseCount = 1; + Bmp[Tiles::PATHFINDING].sourceRect.left = 0; + Bmp[Tiles::PATHFINDING].sourceRect.top = 353; + Bmp[Tiles::PATHFINDING].sourceRect.right = Bmp[Tiles::PATHFINDING].sourceRect.left + 233; + Bmp[Tiles::PATHFINDING].sourceRect.bottom = Bmp[Tiles::PATHFINDING].sourceRect.top + 59; + Bmp[Tiles::PATHFINDING].Width = static_cast(Bmp[Tiles::PATHFINDING].sourceRect.right - Bmp[Tiles::PATHFINDING].sourceRect.left); + Bmp[Tiles::PATHFINDING].Height = static_cast(Bmp[Tiles::PATHFINDING].sourceRect.bottom - Bmp[Tiles::PATHFINDING].sourceRect.top); + Bmp[Tiles::PATHFINDING].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::PATHFINDING].Width / 2; + Bmp[Tiles::PATHFINDING].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::PATHFINDING].Height / 2; + Bmp[Tiles::PATHFINDING].targetRect.right = Bmp[Tiles::PATHFINDING].targetRect.left + Bmp[Tiles::PATHFINDING].Width; + Bmp[Tiles::PATHFINDING].targetRect.bottom = Bmp[Tiles::PATHFINDING].targetRect.top + Bmp[Tiles::PATHFINDING].Height; + Bmp[Tiles::PATHFINDING].Surface = lpDDSCredits; + + // JOHN + Bmp[Tiles::JOHN].AnimationPhaseCount = 1; + Bmp[Tiles::JOHN].sourceRect.left = 0; + Bmp[Tiles::JOHN].sourceRect.top = 412; + Bmp[Tiles::JOHN].sourceRect.right = Bmp[Tiles::JOHN].sourceRect.left + 347; + Bmp[Tiles::JOHN].sourceRect.bottom = Bmp[Tiles::JOHN].sourceRect.top + 56; + Bmp[Tiles::JOHN].Width = static_cast(Bmp[Tiles::JOHN].sourceRect.right - Bmp[Tiles::JOHN].sourceRect.left); + Bmp[Tiles::JOHN].Height = static_cast(Bmp[Tiles::JOHN].sourceRect.bottom - Bmp[Tiles::JOHN].sourceRect.top); + Bmp[Tiles::JOHN].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::JOHN].Width / 2; + Bmp[Tiles::JOHN].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::JOHN].Height / 2; + Bmp[Tiles::JOHN].targetRect.right = Bmp[Tiles::JOHN].targetRect.left + Bmp[Tiles::JOHN].Width; + Bmp[Tiles::JOHN].targetRect.bottom = Bmp[Tiles::JOHN].targetRect.top + Bmp[Tiles::JOHN].Height; + Bmp[Tiles::JOHN].Surface = lpDDSCredits; + + // HEIKO + Bmp[Tiles::HEIKO].AnimationPhaseCount = 1; + Bmp[Tiles::HEIKO].sourceRect.left = 0; + Bmp[Tiles::HEIKO].sourceRect.top = 468; + Bmp[Tiles::HEIKO].sourceRect.right = Bmp[Tiles::HEIKO].sourceRect.left + 236; + Bmp[Tiles::HEIKO].sourceRect.bottom = Bmp[Tiles::HEIKO].sourceRect.top + 47; + Bmp[Tiles::HEIKO].Width = static_cast(Bmp[Tiles::HEIKO].sourceRect.right - Bmp[Tiles::HEIKO].sourceRect.left); + Bmp[Tiles::HEIKO].Height = static_cast(Bmp[Tiles::HEIKO].sourceRect.bottom - Bmp[Tiles::HEIKO].sourceRect.top); + Bmp[Tiles::HEIKO].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::HEIKO].Width / 2; + Bmp[Tiles::HEIKO].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::HEIKO].Height / 2; + Bmp[Tiles::HEIKO].targetRect.right = Bmp[Tiles::HEIKO].targetRect.left + Bmp[Tiles::HEIKO].Width; + Bmp[Tiles::HEIKO].targetRect.bottom = Bmp[Tiles::HEIKO].targetRect.top + Bmp[Tiles::HEIKO].Height; + Bmp[Tiles::HEIKO].Surface = lpDDSCredits; + + // GISELA + Bmp[Tiles::GISELA].AnimationPhaseCount = 1; + Bmp[Tiles::GISELA].sourceRect.left = 0; + Bmp[Tiles::GISELA].sourceRect.top = 515; + Bmp[Tiles::GISELA].sourceRect.right = Bmp[Tiles::GISELA].sourceRect.left + 232; + Bmp[Tiles::GISELA].sourceRect.bottom = Bmp[Tiles::GISELA].sourceRect.top + 47; + Bmp[Tiles::GISELA].Width = static_cast(Bmp[Tiles::GISELA].sourceRect.right - Bmp[Tiles::GISELA].sourceRect.left); + Bmp[Tiles::GISELA].Height = static_cast(Bmp[Tiles::GISELA].sourceRect.bottom - Bmp[Tiles::GISELA].sourceRect.top); + Bmp[Tiles::GISELA].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::GISELA].Width / 2; + Bmp[Tiles::GISELA].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::GISELA].Height / 2; + Bmp[Tiles::GISELA].targetRect.right = Bmp[Tiles::GISELA].targetRect.left + Bmp[Tiles::GISELA].Width; + Bmp[Tiles::GISELA].targetRect.bottom = Bmp[Tiles::GISELA].targetRect.top + Bmp[Tiles::GISELA].Height; + Bmp[Tiles::GISELA].Surface = lpDDSCredits; + + // WEITEREHILFE + Bmp[Tiles::FURTHER_HELP].AnimationPhaseCount = 1; + Bmp[Tiles::FURTHER_HELP].sourceRect.left = 0; + Bmp[Tiles::FURTHER_HELP].sourceRect.top = 562; + Bmp[Tiles::FURTHER_HELP].sourceRect.right = Bmp[Tiles::FURTHER_HELP].sourceRect.left + 258; + Bmp[Tiles::FURTHER_HELP].sourceRect.bottom = Bmp[Tiles::FURTHER_HELP].sourceRect.top + 46; + Bmp[Tiles::FURTHER_HELP].Width = static_cast(Bmp[Tiles::FURTHER_HELP].sourceRect.right - Bmp[Tiles::FURTHER_HELP].sourceRect.left); + Bmp[Tiles::FURTHER_HELP].Height = static_cast(Bmp[Tiles::FURTHER_HELP].sourceRect.bottom - Bmp[Tiles::FURTHER_HELP].sourceRect.top); + Bmp[Tiles::FURTHER_HELP].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::FURTHER_HELP].Width / 2; + Bmp[Tiles::FURTHER_HELP].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::FURTHER_HELP].Height / 2; + Bmp[Tiles::FURTHER_HELP].targetRect.right = Bmp[Tiles::FURTHER_HELP].targetRect.left + Bmp[Tiles::FURTHER_HELP].Width; + Bmp[Tiles::FURTHER_HELP].targetRect.bottom = Bmp[Tiles::FURTHER_HELP].targetRect.top + Bmp[Tiles::FURTHER_HELP].Height; + Bmp[Tiles::FURTHER_HELP].Surface = lpDDSCredits; + + // DPSOFTWARE + Bmp[Tiles::DPSOFTWARE].AnimationPhaseCount = 1; + Bmp[Tiles::DPSOFTWARE].sourceRect.left = 0; + Bmp[Tiles::DPSOFTWARE].sourceRect.top = 608; + Bmp[Tiles::DPSOFTWARE].sourceRect.right = Bmp[Tiles::DPSOFTWARE].sourceRect.left + 291; + Bmp[Tiles::DPSOFTWARE].sourceRect.bottom = Bmp[Tiles::DPSOFTWARE].sourceRect.top + 99; + Bmp[Tiles::DPSOFTWARE].Width = static_cast(Bmp[Tiles::DPSOFTWARE].sourceRect.right - Bmp[Tiles::DPSOFTWARE].sourceRect.left); + Bmp[Tiles::DPSOFTWARE].Height = static_cast(Bmp[Tiles::DPSOFTWARE].sourceRect.bottom - Bmp[Tiles::DPSOFTWARE].sourceRect.top); + Bmp[Tiles::DPSOFTWARE].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::DPSOFTWARE].Width / 2; + Bmp[Tiles::DPSOFTWARE].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::DPSOFTWARE].Height / 2; + Bmp[Tiles::DPSOFTWARE].targetRect.right = Bmp[Tiles::DPSOFTWARE].targetRect.left + Bmp[Tiles::DPSOFTWARE].Width; + Bmp[Tiles::DPSOFTWARE].targetRect.bottom = Bmp[Tiles::DPSOFTWARE].targetRect.top + Bmp[Tiles::DPSOFTWARE].Height; + Bmp[Tiles::DPSOFTWARE].Surface = lpDDSCredits; + + // SCHWARZ + Bmp[Tiles::SCHWARZ].AnimationPhaseCount = 1; + Bmp[Tiles::SCHWARZ].sourceRect.left = 0; + Bmp[Tiles::SCHWARZ].sourceRect.top = 608; + Bmp[Tiles::SCHWARZ].sourceRect.right = Bmp[Tiles::SCHWARZ].sourceRect.left + 1; + Bmp[Tiles::SCHWARZ].sourceRect.bottom = Bmp[Tiles::SCHWARZ].sourceRect.top + 1; + Bmp[Tiles::SCHWARZ].Width = static_cast(Bmp[Tiles::SCHWARZ].sourceRect.right - Bmp[Tiles::SCHWARZ].sourceRect.left); + Bmp[Tiles::SCHWARZ].Height = static_cast(Bmp[Tiles::SCHWARZ].sourceRect.bottom - Bmp[Tiles::SCHWARZ].sourceRect.top); + Bmp[Tiles::SCHWARZ].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::SCHWARZ].Width / 2; + Bmp[Tiles::SCHWARZ].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::SCHWARZ].Height / 2; + Bmp[Tiles::SCHWARZ].targetRect.right = Bmp[Tiles::SCHWARZ].targetRect.left + Bmp[Tiles::SCHWARZ].Width; + Bmp[Tiles::SCHWARZ].targetRect.bottom = Bmp[Tiles::SCHWARZ].targetRect.top + Bmp[Tiles::SCHWARZ].Height; + Bmp[Tiles::SCHWARZ].Surface = lpDDSCredits; + + // SOUNDS + Bmp[Tiles::SOUNDS].AnimationPhaseCount = 1; + Bmp[Tiles::SOUNDS].sourceRect.left = 0; + Bmp[Tiles::SOUNDS].sourceRect.top = 310; + Bmp[Tiles::SOUNDS].sourceRect.right = Bmp[Tiles::SOUNDS].sourceRect.left + 144; + Bmp[Tiles::SOUNDS].sourceRect.bottom = Bmp[Tiles::SOUNDS].sourceRect.top + 43; + Bmp[Tiles::SOUNDS].Width = static_cast(Bmp[Tiles::SOUNDS].sourceRect.right - Bmp[Tiles::SOUNDS].sourceRect.left); + Bmp[Tiles::SOUNDS].Height = static_cast(Bmp[Tiles::SOUNDS].sourceRect.bottom - Bmp[Tiles::SOUNDS].sourceRect.top); + Bmp[Tiles::SOUNDS].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::SOUNDS].Width / 2; + Bmp[Tiles::SOUNDS].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::SOUNDS].Height / 2; + Bmp[Tiles::SOUNDS].targetRect.right = Bmp[Tiles::SOUNDS].targetRect.left + Bmp[Tiles::SOUNDS].Width; + Bmp[Tiles::SOUNDS].targetRect.bottom = Bmp[Tiles::SOUNDS].targetRect.top + Bmp[Tiles::SOUNDS].Height; + Bmp[Tiles::SOUNDS].Surface = lpDDSCredits; + + // MUSIK + Bmp[Tiles::MUSIC].AnimationPhaseCount = 1; + Bmp[Tiles::MUSIC].sourceRect.left = 160; + Bmp[Tiles::MUSIC].sourceRect.top = 310; + Bmp[Tiles::MUSIC].sourceRect.right = Bmp[Tiles::MUSIC].sourceRect.left + 124; + Bmp[Tiles::MUSIC].sourceRect.bottom = Bmp[Tiles::MUSIC].sourceRect.top + 39; + Bmp[Tiles::MUSIC].Width = static_cast(Bmp[Tiles::MUSIC].sourceRect.right - Bmp[Tiles::MUSIC].sourceRect.left); + Bmp[Tiles::MUSIC].Height = static_cast(Bmp[Tiles::MUSIC].sourceRect.bottom - Bmp[Tiles::MUSIC].sourceRect.top); + Bmp[Tiles::MUSIC].targetRect.left = MAX_SCREEN_X / 2 - Bmp[Tiles::MUSIC].Width / 2; + Bmp[Tiles::MUSIC].targetRect.top = MAX_SCREEN_Y - Bmp[Tiles::MUSIC].Height / 2; + Bmp[Tiles::MUSIC].targetRect.right = Bmp[Tiles::MUSIC].targetRect.left + Bmp[Tiles::MUSIC].Width; + Bmp[Tiles::MUSIC].targetRect.bottom = Bmp[Tiles::MUSIC].targetRect.top + Bmp[Tiles::MUSIC].Height; + Bmp[Tiles::MUSIC].Surface = lpDDSCredits; + + for (i = 0; i < 10; i++) + for (k = 0; k < 10; k++) { + CreditsList[i][k].IsRunning = false; + CreditsList[i][k].Picture = -1; } - Wav[Sound::STORM].Dateiname = "sounds/sturm.wav"; - Wav[Sound::STORM].Volume = 85; + CreditsList[0][0].Picture = Tiles::PROGRAMMING; + CreditsList[0][1].IsRunning = true; // nur den hier true setzen, löst dann alles andere aus + CreditsList[0][1].Picture = Tiles::DIRK_PLATE; + CreditsList[1][0].Picture = Tiles::MUSIC; + CreditsList[1][1].Picture = Tiles::HEIKO; + CreditsList[2][0].Picture = Tiles::SOUNDS; + CreditsList[2][1].Picture = Tiles::DIRK_PLATE; + CreditsList[3][0].Picture = Tiles::TEST_PLAYER; + CreditsList[3][1].Picture = Tiles::MATTHIAS; + CreditsList[3][2].Picture = Tiles::TOBIAS; + CreditsList[3][3].Picture = Tiles::SIGRID; + CreditsList[4][0].Picture = Tiles::PATHFINDING; + CreditsList[4][1].Picture = Tiles::JOHN; + CreditsList[5][0].Picture = Tiles::FURTHER_HELP; + CreditsList[5][1].Picture = Tiles::HEIKO; + CreditsList[5][2].Picture = Tiles::GISELA; + CreditsList[6][0].Picture = Tiles::SCHWARZ; + CreditsList[6][1].Picture = Tiles::DPSOFTWARE; + + // Textausgabe + TextBereich[TXTTEXTFELD].HasText = false; + TextBereich[TXTTEXTFELD].textRect.left = 9; + TextBereich[TXTTEXTFELD].textRect.top = MAX_SCREEN_Y - 17; + TextBereich[TXTTEXTFELD].textRect.right = MAX_SCREEN_X - 200; + TextBereich[TXTTEXTFELD].textRect.bottom = MAX_SCREEN_Y - 2; + + TextBereich[TXTFPS].HasText = false; + TextBereich[TXTFPS].textRect.left = MAX_SCREEN_X - 40; + TextBereich[TXTFPS].textRect.top = 3; + TextBereich[TXTFPS].textRect.right = TextBereich[TXTFPS].textRect.left + 2 * FONT1_LETTER_WIDTH; + TextBereich[TXTFPS].textRect.bottom = TextBereich[TXTFPS].textRect.top + FONT1_LETTER_HEIGHT; + + TextBereich[TXTTAGESZEIT].HasText = true; + TextBereich[TXTTAGESZEIT].textRect.left = MAX_SCREEN_X - 110; + TextBereich[TXTTAGESZEIT].textRect.top = MAX_SCREEN_Y - 20; + TextBereich[TXTTAGESZEIT].textRect.right = TextBereich[TXTTAGESZEIT].textRect.left + 5 * FONT2_LETTER_WIDTH; + TextBereich[TXTTAGESZEIT].textRect.bottom = TextBereich[TXTTAGESZEIT].textRect.top + FONT2_LETTER_HEIGHT; + + TextBereich[TXTPAPIER].HasText = false; + TextBereich[TXTPAPIER].textRect.left = 450; + TextBereich[TXTPAPIER].textRect.top = 160; + TextBereich[TXTPAPIER].textRect.right = 830; + TextBereich[TXTPAPIER].textRect.bottom = 560; + + TextBereich[TXTCHANCE].HasText = false; + TextBereich[TXTCHANCE].textRect.left = Bmp[Tiles::RING].targetRect.left + 5; + TextBereich[TXTCHANCE].textRect.top = Bmp[Tiles::RING].targetRect.top + Bmp[Tiles::RING].Height + 10; + TextBereich[TXTCHANCE].textRect.right = TextBereich[TXTCHANCE].textRect.left + 3 * FONT2_LETTER_WIDTH; + TextBereich[TXTCHANCE].textRect.bottom = TextBereich[TXTCHANCE].textRect.top + FONT2_LETTER_HEIGHT; + + Guy.ResourceAmount[Resources::Water] = 100; + Guy.ResourceAmount[Resources::Food] = 100; + Guy.ResourceAmount[Resources::Health] = 100; + + for (i = Tiles::RAW_TREE_BRANCH; i <= Tiles::RAW_SLINGSHOT; i++) { + Guy.Inventory[i] = 0; + } + + CursorTyp = Tiles::CURSOR_ARROW; + Gitter = false; + PapierText = -1; + HauptMenue = 0; + TwoClicks = -1; + Night = false; + Frage = -1; + FPS = 100; + CurrentFrame = 0; + MousePosition.x = MAX_SCREEN_X / 2; + MousePosition.y = MAX_SCREEN_Y / 2; + Direct::Reset(); + SchatzPos.x = -1; + SchatzPos.y = -1; + SchatzGef = false; +} + +void InitWaves() +{ + // Sounds + for (short i = 0; i < Sound::COUNT; i++) { + Wav[i].Filename = "sounds/klick.wav"; + Wav[i].Loop = false; + Wav[i].Volume = 100; + } - Wav[Sound::SWIM].Dateiname = "sounds/schwimmen.wav"; - Wav[Sound::SWIM].Volume = 90; + Wav[Sound::STORM].Filename = "sounds/sturm.wav"; + Wav[Sound::STORM].Volume = 85; - Wav[Sound::SPLAT].Dateiname = "sounds/platsch.wav"; - Wav[Sound::SPLAT].Volume = 95; + Wav[Sound::SWIM].Filename = "sounds/schwimmen.wav"; + Wav[Sound::SWIM].Volume = 90; - Wav[Sound::LOG].Dateiname = "sounds/faellen.wav"; - Wav[Sound::LOG].Volume = 100; + Wav[Sound::SPLAT].Filename = "sounds/platsch.wav"; + Wav[Sound::SPLAT].Volume = 95; - Wav[Sound::HIT].Dateiname = "sounds/schlagen.wav"; - Wav[Sound::HIT].Volume = 100; + Wav[Sound::LOG].Filename = "sounds/faellen.wav"; + Wav[Sound::LOG].Volume = 100; - Wav[Sound::SLINGSHOT].Dateiname = "sounds/schleuder.wav"; - Wav[Sound::SLINGSHOT].Volume = 100; + Wav[Sound::HIT].Filename = "sounds/schlagen.wav"; + Wav[Sound::HIT].Volume = 100; - Wav[Sound::DIG].Dateiname = "sounds/schaufeln.wav"; - Wav[Sound::DIG].Volume = 90; + Wav[Sound::SLINGSHOT].Filename = "sounds/schleuder.wav"; + Wav[Sound::SLINGSHOT].Volume = 100; - Wav[Sound::HAMMER].Dateiname = "sounds/hammer.wav"; - Wav[Sound::HAMMER].Volume = 100; + Wav[Sound::DIG].Filename = "sounds/schaufeln.wav"; + Wav[Sound::DIG].Volume = 90; - Wav[Sound::CRASH].Dateiname = "sounds/crash.wav"; - Wav[Sound::CRASH].Volume = 100; + Wav[Sound::HAMMER].Filename = "sounds/hammer.wav"; + Wav[Sound::HAMMER].Volume = 100; - Wav[Sound::SNORE].Dateiname = "sounds/schnarchen.wav"; - Wav[Sound::SNORE].Volume = 90; + Wav[Sound::CRASH].Filename = "sounds/crash.wav"; + Wav[Sound::CRASH].Volume = 100; - Wav[Sound::DRINK].Dateiname = "sounds/trinken.wav"; - Wav[Sound::DRINK].Volume = 95; + Wav[Sound::SNORE].Filename = "sounds/schnarchen.wav"; + Wav[Sound::SNORE].Volume = 90; - Wav[Sound::CRACKLE].Dateiname = "sounds/knistern.wav"; - Wav[Sound::CRACKLE].Volume = 90; + Wav[Sound::DRINK].Filename = "sounds/trinken.wav"; + Wav[Sound::DRINK].Volume = 95; - Wav[Sound::FISH].Dateiname = "sounds/angel.wav"; - Wav[Sound::FISH].Volume = 100; + Wav[Sound::CRACKLE].Filename = "sounds/knistern.wav"; + Wav[Sound::CRACKLE].Volume = 90; - Wav[Sound::FOREST].Dateiname = "sounds/wald.wav"; - Wav[Sound::FOREST].Volume = 90; + Wav[Sound::FISH].Filename = "sounds/angel.wav"; + Wav[Sound::FISH].Volume = 100; - Wav[Sound::FIRE].Dateiname = "sounds/feuer.wav"; - Wav[Sound::FIRE].Volume = 100; + Wav[Sound::FOREST].Filename = "sounds/wald.wav"; + Wav[Sound::FOREST].Volume = 90; - Wav[Sound::SURF].Dateiname = "sounds/brandung.wav"; - Wav[Sound::SURF].Volume = 100; + Wav[Sound::FIRE].Filename = "sounds/feuer.wav"; + Wav[Sound::FIRE].Volume = 100; - Wav[Sound::TIMBER].Dateiname = "sounds/baumfaellt.wav"; - Wav[Sound::TIMBER].Volume = 100; + Wav[Sound::SURF].Filename = "sounds/brandung.wav"; + Wav[Sound::SURF].Volume = 100; - Wav[Sound::RIVER].Dateiname = "sounds/fluss.wav"; - Wav[Sound::RIVER].Volume = 85; + Wav[Sound::TIMBER].Filename = "sounds/baumfaellt.wav"; + Wav[Sound::TIMBER].Volume = 100; - Wav[Sound::CLICK].Dateiname = "sounds/klick.wav"; - Wav[Sound::CLICK].Volume = 95; + Wav[Sound::RIVER].Filename = "sounds/fluss.wav"; + Wav[Sound::RIVER].Volume = 85; - Wav[Sound::CLICK2].Dateiname = "sounds/klick2.wav"; - Wav[Sound::CLICK2].Volume = 95; + Wav[Sound::CLICK].Filename = "sounds/klick.wav"; + Wav[Sound::CLICK].Volume = 95; - Wav[Sound::OUTRO].Dateiname = "sounds/abspann.wav"; - Wav[Sound::OUTRO].Volume = 100; - Wav[Sound::OUTRO].Loop = true; + Wav[Sound::CLICK2].Filename = "sounds/klick2.wav"; + Wav[Sound::CLICK2].Volume = 95; - Wav[Sound::LOGO].Dateiname = "sounds/logo.wav"; - Wav[Sound::LOGO].Volume = 100; - Wav[Sound::LOGO].Loop = true; + Wav[Sound::OUTRO].Filename = "sounds/abspann.wav"; + Wav[Sound::OUTRO].Volume = 100; + Wav[Sound::OUTRO].Loop = true; - Wav[Sound::WOLF].Dateiname = "sounds/wolf.wav"; - Wav[Sound::WOLF].Volume = 90; + Wav[Sound::LOGO].Filename = "sounds/logo.wav"; + Wav[Sound::LOGO].Volume = 100; + Wav[Sound::LOGO].Loop = true; - Wav[Sound::INVENTION].Dateiname = "sounds/erfindung.wav"; - Wav[Sound::INVENTION].Volume = 95; + Wav[Sound::WOLF].Filename = "sounds/wolf.wav"; + Wav[Sound::WOLF].Volume = 90; - // Testweise alle Sounds gleich in den Speicher laden - for (short i = 1; i < Sound::COUNT; i++) - Sound::LoadSound(i); + Wav[Sound::INVENTION].Filename = "sounds/erfindung.wav"; + Wav[Sound::INVENTION].Volume = 95; + + // Testweise alle Sounds gleich in den Speicher laden + for (short i = 1; i < Sound::COUNT; i++) { + Sound::LoadSound(i); } +} - void NeuesSpiel(bool neu) - { - short x, y; - bool LoadOK = false; - - InitStructs(); - InitWaves(); - - if (!neu) LoadOK = LoadGame(); - - if ((!LoadOK) || (neu)) - { - // Für die Statusanzeige - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - ddbltfx.dwFillColor = Renderer::RGB2DWORD(70, 70, 100); - lpDDSPrimary->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - ddbltfx.dwFillColor = Renderer::RGB2DWORD(255, 0, 255); - lpDDSSchrift->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - - // Landschaft erzeugen - - Renderer::DrawString("Erschaffe Landschaft...", 5, 5, 2); - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - lpDDSPrimary->Blt(&rcRectdes, lpDDSSchrift, &rcRectdes, DDBLT_KEYSRC | DDBLT_WAIT, nullptr); - World::Compute(200, 600); - - Renderer::DrawString("Ueberflute Land...", 5, 35, 2); - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - lpDDSPrimary->Blt(&rcRectdes, lpDDSSchrift, &rcRectdes, DDBLT_KEYSRC | DDBLT_WAIT, nullptr); - World::Meer(); - - Renderer::DrawString("Lege Fluss fest...", 5, 65, 2); - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - lpDDSPrimary->Blt(&rcRectdes, lpDDSSchrift, &rcRectdes, DDBLT_KEYSRC | DDBLT_WAIT, nullptr); - World::Fluss(); - Math::CalcKoor(); - - Renderer::DrawString("Pflanze Baeume...", 5, 95, 2); - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - lpDDSPrimary->Blt(&rcRectdes, lpDDSSchrift, &rcRectdes, DDBLT_KEYSRC | DDBLT_WAIT, nullptr); - World::Baeume(30); - - World::Piratenwrack(); - - // Guy Position - Guy.Pos.x = 1; - Guy.Pos.y = MAXYKACH / 2; - Guy.PosScreen.x = - (Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][0].x + - Scape[Guy.Pos.x][Guy.Pos.y].xScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][2].x) / 2; - Guy.PosScreen.y = - (Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][1].y + - Scape[Guy.Pos.x][Guy.Pos.y].yScreen + EckKoor[Scape[Guy.Pos.x][Guy.Pos.y].Typ][3].y) / 2; - - Camera.x = Guy.PosScreen.x - static_cast(rcGesamt.right / 2); - Camera.y = Guy.PosScreen.y - static_cast(rcGesamt.bottom / 2); - - Chance = 0; - - BootsFahrt = false; - if (!BootsFahrt) World::ChangeBootsFahrt(); - - Tag = 1; - Stunden = 0; - Minuten = 0; - - Spielzustand = State::INTRO; - Guy.Aktiv = false; - Guy.Zustand = GUYSCHIFF; - Guy.AkNummer = 0; - Guy.Aktion = Action::INTRO; - } +void NewGame(bool neu) +{ + short x, y; + bool LoadOK = false; + + if (!neu) { + LoadOK = LoadGame(); + } + + if ((!LoadOK) || (neu)) { + // For the status display + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + + screenTexture = Renderer::createEmptyTexture(MAX_SCREEN_X, MAX_SCREEN_Y, sf::Color(70, 70, 100)); + + // Landschaft erzeugen + + Renderer::DrawString("Create landscape...", 5, 5, 2); + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + World::Compute(200, 600); + + Renderer::DrawString("Create sea...", 5, 35, 2); + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + World::CreateSea(); + + Renderer::DrawString("Establish river flow...", 5, 65, 2); + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + World::CreateRiver(); + Math::CalcKoor(); - // SchriftSurface löschen + Renderer::DrawString("Plant trees...", 5, 95, 2); rcRectdes.left = 0; rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - ddbltfx.dwFillColor = Renderer::RGB2DWORD(255, 0, 255); - lpDDSSchrift->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - - bool Anitmp = LAnimation; - bool Entdeckttmp[MAXXKACH][MAXYKACH]; - - LAnimation = false; - // Schatzvergraben und Schatzkarte malen - for (y = 0; y < MAXYKACH; y++) - for (x = 0; x < MAXXKACH; x++) - { - Entdeckttmp[x][y] = Scape[x][y].Entdeckt; - Scape[x][y].Entdeckt = true; - } - - World::Generate(); // Einmal vor dem Schatz schon entdeckt malen - World::Schatz(); - - for (y = 0; y < MAXYKACH; y++) for (x = 0; x < MAXXKACH; x++) Scape[x][y].Entdeckt = Entdeckttmp[x][y]; - World::Entdecken(); - LAnimation = Anitmp; - World::Generate(); // Und nochmal ohne das die Gegend entdeckt ist - Guy.PosAlt = Guy.PosScreen; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + World::CreateTrees(30); + + World::CreatePirateWreck(); + + // Guy Position + Guy.Pos.x = 1; + Guy.Pos.y = MAX_TILESY / 2; + Guy.ScreenPosition.x = + (Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][0].x + + Landscape[Guy.Pos.x][Guy.Pos.y].xScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][2].x) / 2; + Guy.ScreenPosition.y = + (Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][1].y + + Landscape[Guy.Pos.x][Guy.Pos.y].yScreen + CornerCoord[Landscape[Guy.Pos.x][Guy.Pos.y].Type][3].y) / 2; + + Camera.x = Guy.ScreenPosition.x - static_cast(rcGesamt.right / 2); + Camera.y = Guy.ScreenPosition.y - static_cast(rcGesamt.bottom / 2); + + Chance = 0; + + IsInBoat = false; + + if (!IsInBoat) { + World::ToggleIsInBoat(); + } + + Tag = 1; + Hours = 0; + Minutes = 0; + + s_GameState = State::INTRO; + Guy.IsActive = false; + Guy.AnimationState = Tiles::GUY_SHIP; + Guy.ActionStep = 0; + Guy.CurrentAction = Action::INTRO; } + + // Delete font surface + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + + bool Anitmp = LAnimation; + bool Entdeckttmp[MAX_TILES_X][MAX_TILESY]; + + LAnimation = false; + + // Schatzvergraben und Schatzkarte malen + for (y = 0; y < MAX_TILESY; y++) + for (x = 0; x < MAX_TILES_X; x++) { + Entdeckttmp[x][y] = Landscape[x][y].Discovered; + Landscape[x][y].Discovered = true; + } + + World::Generate(); // Einmal vor dem Schatz schon entdeckt malen + World::Treasure(); + + for (y = 0; y < MAX_TILESY; y++) for (x = 0; x < MAX_TILES_X; x++) { + Landscape[x][y].Discovered = Entdeckttmp[x][y]; + } + + World::UpdateDiscovered(); + LAnimation = Anitmp; + World::Generate(); // Und nochmal ohne das die Gegend entdeckt ist + Guy.OriginalPosition = Guy.ScreenPosition; +} } // namespace Game diff --git a/src/Game.hpp b/src/Game.hpp index 160fdc7..f398d5c 100644 --- a/src/Game.hpp +++ b/src/Game.hpp @@ -3,11 +3,10 @@ #include "headers.hpp" #include "extern.hpp" -namespace Game -{ - void NeuesSpiel(bool neu); // Neues Spiel starten - void InitStructs(); // Initialisiert die Structs - void InitWaves(); // Initialisiert die Wav Structs - void SaveGame(); // Speichert den Spielstand - bool LoadGame(); // Lädt den Spielstand +namespace Game { +void NewGame(bool neu); // Neues Spiel starten +void InitStructs(); // Initialisiert die Structs +void InitWaves(); // Initialisiert die Wav Structs +void SaveGame(); // Speichert den Spielstand +bool LoadGame(); // Lädt den Spielstand } diff --git a/src/Math.cpp b/src/Math.cpp index a1e7c2d..0b8137c 100644 --- a/src/Math.cpp +++ b/src/Math.cpp @@ -13,1274 +13,1368 @@ #include #include -namespace Math +#define ROUND(s) ((short) ((short)(s-0.5) == (short) s ? s+1:s)) //Zahlen runden Macro + +namespace Math { +float Schrittx, Schritty; // Zum Figur laufen lassen +Coordinate GuyPosScreenStart; // Absolute StartPosition bei einem Schritt (Für CalcGuyKoor) + +void UpdateMousePosition(short Button, short Push, short xDiff, short yDiff) { - float Schrittx, Schritty; // Zum Figur laufen lassen - ZWEID GuyPosScreenStart; // Absolute StartPosition bei einem Schritt (Für CalcGuyKoor) - - void MouseInSpielflaeche(short Button, short Push, short xDiff, short yDiff) - { - char Text[1024], TextTmp[1024]; // Text für Infoleiste - - // Info anzeigen - ZWEID Erg = Renderer::GetKachel((MousePosition.x + Camera.x), (MousePosition.y + Camera.y)); // Die angeklickte Kachel - if (Scape[Erg.x][Erg.y].Entdeckt) - { - LoadString(g_hInst, 45 + Scape[Erg.x][Erg.y].Art, Text, 1024); - if ((Scape[Erg.x][Erg.y].Objekt != -1) && (Scape[Erg.x][Erg.y].Objekt != MEERWELLEN)) - { - LoadString(g_hInst, MIT, TextTmp, 1024); - strcat(Text, " "); - strcat(Text, TextTmp); - strcat(Text, " "); - - if ((Scape[Erg.x][Erg.y].Objekt >= BAUM1) && (Scape[Erg.x][Erg.y].Objekt <= BAUM4)) - LoadString(g_hInst, BAUMTEXT, TextTmp, 1024); - else if ((Scape[Erg.x][Erg.y].Objekt >= FLUSS1) && (Scape[Erg.x][Erg.y].Objekt <= SCHLEUSE6)) - LoadString(g_hInst, FLUSSTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == BUSCH) - LoadString(g_hInst, BUSCHTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == ZELT) - LoadString(g_hInst, ZELTTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == FELD) - LoadString(g_hInst, FELDTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == BOOT) - LoadString(g_hInst, BOOTTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == ROHR) - LoadString(g_hInst, ROHRTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == SOS) - LoadString(g_hInst, SOSTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == HAUS1) - LoadString(g_hInst, HAUS1TEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == HAUS2) - LoadString(g_hInst, HAUS2TEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == HAUS3) - LoadString(g_hInst, HAUS3TEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == BAUMGROSS) - LoadString(g_hInst, BAUMGROSSTEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == FEUERSTELLE) - LoadString(g_hInst, FEUERSTELLETEXT, TextTmp, 1024); - else if (Scape[Erg.x][Erg.y].Objekt == FEUER) - LoadString(g_hInst, FEUERTEXT, TextTmp, 1024); - else if ((Scape[Erg.x][Erg.y].Objekt == WRACK) || (Scape[Erg.x][Erg.y].Objekt == WRACK2)) - LoadString(g_hInst, WRACKTEXT, TextTmp, 1024); - strcat(Text, TextTmp); - - if ((Scape[Erg.x][Erg.y].Objekt >= FELD) && - (Scape[Erg.x][Erg.y].Objekt <= FEUERSTELLE)) - { - // Baufortschrittanzeigen - strcat(Text, " "); - strcat(Text, "("); - std::sprintf(TextTmp, "%d", (Scape[Erg.x][Erg.y].AkNummer * 100) / Bmp[Scape[Erg.x][Erg.y].Objekt].AkAnzahl); - strcat(Text, TextTmp); - strcat(Text, "%"); - strcat(Text, ")"); - // benötigte Rohstoffe anzeigen - World::MakeRohString(Erg.x, Erg.y, -1); - strcat(Text, RohString); - } +// char Text[1024], TextTmp[1024]; // Text für Infoleiste + std::string Text; + + + // Info anzeigen + Coordinate Erg = Renderer::GetTile((MousePosition.x + Camera.x), (MousePosition.y + Camera.y)); // Die angeklickte Kachel + + if (Erg.x >= 0 && Erg.y >= 0 && Landscape[Erg.x][Erg.y].Discovered) { + Text = GetLanguageString(45 + Landscape[Erg.x][Erg.y].Terrain); + + if ((Landscape[Erg.x][Erg.y].Object != Tiles::INVALID) && (Landscape[Erg.x][Erg.y].Object != Tiles::SEA_WAVES)) { + Text += " "; + Text += GetLanguageString(STRING_WITH); + Text += " "; + + if ((Landscape[Erg.x][Erg.y].Object >= Tiles::TREE_1) && (Landscape[Erg.x][Erg.y].Object <= Tiles::TREE_4)) { + Text += GetLanguageString(STRING_TREE); + } else if ((Landscape[Erg.x][Erg.y].Object >= Tiles::RIVER_1) && (Landscape[Erg.x][Erg.y].Object <= Tiles::FLOODGATE_6)) { + Text += GetLanguageString(FLUSSTEXT); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::BUSH) { + Text += GetLanguageString(STRING_BUSH); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::TENT) { + Text += GetLanguageString(STRING_TENT); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::FIELD) { + Text += GetLanguageString(STRING_FIELD); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::BOAT) { + Text += GetLanguageString(BOOTTEXT); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::PIPE) { + Text += GetLanguageString(ROHRTEXT); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::SOS) { + Text += GetLanguageString(SOSTEXT); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::HOUSE_1) { + Text += GetLanguageString(HAUS1TEXT); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::HOUSE_2) { + Text += GetLanguageString(STRING_TREE_AND_PLATFORM); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::HOUSE_3) { + Text += GetLanguageString(HAUS3TEXT); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::TREE_BIG) { + Text += GetLanguageString(STRING_BIG_TREE); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::BONFIRE) { + Text += GetLanguageString(STRING_BONFIRE); + } else if (Landscape[Erg.x][Erg.y].Object == Tiles::FIRE) { + Text += GetLanguageString(STRING_SMOKE_SIGNAL); + } else if ((Landscape[Erg.x][Erg.y].Object == Tiles::WRECK_1) || (Landscape[Erg.x][Erg.y].Object == Tiles::WRECK_2)) { + Text += GetLanguageString(WRACKTEXT); } - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(Text, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - } - // rechte Maustastescrollen - if ((Button == 1) && (Push == 0)) - { - Camera.x += xDiff; - Camera.y += yDiff; - CursorTyp = CURICHTUNG; + if ((Landscape[Erg.x][Erg.y].Object >= Tiles::FIELD) && + (Landscape[Erg.x][Erg.y].Object <= Tiles::BONFIRE)) { + // Baufortschrittanzeigen + Text += " ("; + Text += std::to_string((Landscape[Erg.x][Erg.y].ConstructionActionStep * 100) / Bmp[Landscape[Erg.x][Erg.y].Object].RequiredActionCases); + Text += "%)"; + // benötigte Rohstoffe anzeigen + World::RawMaterialsDescriptionString(Erg.x, Erg.y, -1); + Text += RohString; + } } - // Wenn Maustaste gedrückt wird - if ((Button == 0) && (Push == 1)) - { - if ((Erg.x != -1) && (Erg.y != -1) && - (Scape[Erg.x][Erg.y].Entdeckt) && (!Guy.Aktiv) && + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(Text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + } + + // rechte Maustastescrollen + if ((Button == 1) && (Push == 0)) { + Camera.x += xDiff; + Camera.y += yDiff; + CursorTyp = Tiles::CURSOR_DIRECTION; + } + + // Wenn Maustaste gedrückt wird + if ((Button == 0) && (Push == 1)) { + if ((Erg.x != -1) && (Erg.y != -1) && + (Landscape[Erg.x][Erg.y].Discovered) && (!Guy.IsActive) && ((Erg.x != Guy.Pos.x) || (Erg.y != Guy.Pos.y)) && - (Erg.x > 0) && (Erg.x < MAXXKACH - 1) && - (Erg.y > 0) && (Erg.y < MAXYKACH - 1)) - { - // Klicksound abspielen - PlaySound(Sound::CLICK2, 100); - if ((Erg.x == RouteZiel.x) && (Erg.y == RouteZiel.y)) - { - Routing::MarkRoute(false); - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktiv = true; - RoutePunkt = -1; - Steps = 0; - Step = 0; - } - else - { - Routing::MarkRoute(false); - RouteStart.x = Guy.Pos.x; - RouteStart.y = Guy.Pos.y; - RouteZiel.x = Erg.x; - RouteZiel.y = Erg.y; - if (Routing::FindTheWay()) Routing::MarkRoute(true); - else // Wenn keine Route gefunden - { - RouteStart.x = -1; - RouteStart.y = -1; - RouteZiel.x = -1; - RouteZiel.y = -1; - MessageBeep(MB_OK); - } + (Erg.x > 0) && (Erg.x < MAX_TILES_X - 1) && + (Erg.y > 0) && (Erg.y < MAX_TILESY - 1)) { + // Klicksound abspielen + PlaySound(Sound::CLICK2, 100); + + if ((Erg.x == RouteDestination.x) && (Erg.y == RouteDestination.y)) { + Routing::MarkRoute(false); + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.IsActive = true; + RoutePunkt = -1; + Steps = 0; + Step = 0; + } else { + Routing::MarkRoute(false); + RouteStart.x = Guy.Pos.x; + RouteStart.y = Guy.Pos.y; + RouteDestination.x = Erg.x; + RouteDestination.y = Erg.y; + + if (Routing::FindTheWay()) { + Routing::MarkRoute(true); + } else { // Wenn keine Route gefunden + RouteStart.x = -1; + RouteStart.y = -1; + RouteDestination.x = -1; + RouteDestination.y = -1; +// MessageBeep(MB_OK); } } - else PlaySound(Sound::CLICK, 100); + } else { + PlaySound(Sound::CLICK, 100); } } +} - void MouseInPanel(short Button, short Push) - { - // wenn die Maus in der Minimap ist -> - if ((InRect(MousePosition.x, MousePosition.y, rcKarte)) && (Button == 0) && (Push != -1)) - { - // Mauskoordinaten in Minimap - short mx = MousePosition.x - static_cast(rcKarte.left); - short my = MousePosition.y - static_cast(rcKarte.top); - Camera.x = ((KXPIXEL / 4) * (mx - my) + MAXXKACH * KXPIXEL / 2) - - static_cast((rcSpielflaeche.right - rcSpielflaeche.left) / 2); - Camera.y = ((KXPIXEL / 7) * (my + mx)) - - static_cast((rcSpielflaeche.bottom - rcSpielflaeche.top) / 2); - } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTGITTER].rcDes)) - { - if (Gitter) Renderer::DrawText(GITTERAUS, TXTTEXTFELD, 2); - else Renderer::DrawText(GITTERAN, TXTTEXTFELD, 2); - - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Gitter = !Gitter; - World::Generate(); - } +void MouseInPanel(short Button, short Push) +{ + // wenn die Maus in der Minimap ist -> + if ((InRect(MousePosition.x, MousePosition.y, rcKarte)) && (Button == 0) && (Push != -1)) { + // Mauskoordinaten in Minimap + short mx = MousePosition.x - static_cast(rcKarte.left); + short my = MousePosition.y - static_cast(rcKarte.top); + Camera.x = ((TILE_SIZE_X / 4) * (mx - my) + MAX_TILES_X * TILE_SIZE_X / 2) + - static_cast((rcPlayingSurface.right - rcPlayingSurface.left) / 2); + Camera.y = ((TILE_SIZE_X / 7) * (my + mx)) + - static_cast((rcPlayingSurface.bottom - rcPlayingSurface.top) / 2); + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_GRID].targetRect)) { + if (Gitter) { + Renderer::DrawText(GITTERAUS, TXTTEXTFELD, 2); + } else { + Renderer::DrawText(GITTERAN, TXTTEXTFELD, 2); } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTANIMATION].rcDes)) - { - if (LAnimation) Renderer::DrawText(ANIMATIONAUS, TXTTEXTFELD, 2); - else Renderer::DrawText(ANIMATIONAN, TXTTEXTFELD, 2); - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - LAnimation = !LAnimation; - World::Generate(); - } + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Gitter = !Gitter; + World::Generate(); } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSOUND].rcDes)) - { - if (Soundzustand == 1) Renderer::DrawText(SOUNDAUS, TXTTEXTFELD, 2); - else if (Soundzustand == 0) Renderer::DrawText(SOUNDAN, TXTTEXTFELD, 2); - else Renderer::DrawText(KEINSOUND, TXTTEXTFELD, 2); - - if ((Button == 0) && (Push == 1)) - { - if (Soundzustand == 1) - { - for (short i = 1; i < Sound::COUNT; i++) Sound::StopSound(i); - Soundzustand = 0; - } - else if (Soundzustand == 0) - { - Soundzustand = 1; - PlaySound(Sound::CLICK2, 100); - } - else PlaySound(Sound::CLICK, 100); - } + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_ANIMATION].targetRect)) { + if (LAnimation) { + Renderer::DrawText(ANIMATIONAUS, TXTTEXTFELD, 2); + } else { + Renderer::DrawText(ANIMATIONAN, TXTTEXTFELD, 2); } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTBEENDEN].rcDes)) - { - Renderer::DrawText(BEENDEN, TXTTEXTFELD, 2); - Bmp[BUTTBEENDEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - Guy.Aktiv = false; - Guy.Aktion = Action::QUIT; - } + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + LAnimation = !LAnimation; + World::Generate(); } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTNEU].rcDes)) - { - Renderer::DrawText(NEU, TXTTEXTFELD, 2); - Bmp[BUTTNEU].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - Guy.Aktiv = false; - Guy.Aktion = Action::RESTART; - } + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_SOUND].targetRect)) { + if (s_SoundState == 1) { + Renderer::DrawText(SOUNDAUS, TXTTEXTFELD, 2); + } else if (s_SoundState == 0) { + Renderer::DrawText(SOUNDAN, TXTTEXTFELD, 2); + } else { + Renderer::DrawText(KEINSOUND, TXTTEXTFELD, 2); } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTTAGNEU].rcDes)) - { - Renderer::DrawText(TAGNEU2, TXTTEXTFELD, 2); - Bmp[BUTTTAGNEU].Animation = true; - if ((Button == 0) && (Push == 1)) - { + + if ((Button == 0) && (Push == 1)) { + if (s_SoundState == 1) { + for (short i = 1; i < Sound::COUNT; i++) { + Sound::StopSound(i); + } + + s_SoundState = 0; + } else if (s_SoundState == 0) { + s_SoundState = 1; PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - Guy.Aktiv = false; - Guy.Aktion = Action::DAY_RESTART; + } else { + PlaySound(Sound::CLICK, 100); } } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTAKTION].rcDes)) - { - if (HauptMenue == Menu::ACTION) Renderer::DrawText(MEAKTIONZU, TXTTEXTFELD, 2); - else Renderer::DrawText(MEAKTIONAUF, TXTTEXTFELD, 2); - Bmp[BUTTAKTION].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if (HauptMenue == Menu::ACTION) HauptMenue = Menu::NONE; - else HauptMenue = Menu::ACTION; - } + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_END].targetRect)) { + Renderer::DrawText(BEENDEN, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_END].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + Guy.IsActive = false; + Guy.CurrentAction = Action::QUIT; } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTBAUEN].rcDes) && - (Bmp[BUTTBAUEN].Phase != -1)) - { - if (HauptMenue == Menu::BUILD) Renderer::DrawText(MEBAUENZU, TXTTEXTFELD, 2); - else Renderer::DrawText(MEBAUENAUF, TXTTEXTFELD, 2); - Bmp[BUTTBAUEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if (HauptMenue == Menu::BUILD) HauptMenue = Menu::NONE; - else HauptMenue = Menu::BUILD; - } + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_NEW].targetRect)) { + Renderer::DrawText(NEU, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_NEW].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + Guy.IsActive = false; + Guy.CurrentAction = Action::RESTART; } - else if (InRect(MousePosition.x, MousePosition.y, Bmp[BUTTINVENTAR].rcDes)) - { - if (HauptMenue == Menu::INVENTORY) Renderer::DrawText(MEINVENTARZU, TXTTEXTFELD, 2); - else Renderer::DrawText(MEINVENTARAUF, TXTTEXTFELD, 2); - Bmp[BUTTINVENTAR].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if (HauptMenue == Menu::INVENTORY) HauptMenue = Menu::NONE; - else HauptMenue = Menu::INVENTORY; + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_NEW_DAY].targetRect)) { + Renderer::DrawText(TAGNEU2, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_NEW_DAY].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + Guy.IsActive = false; + Guy.CurrentAction = Action::DAY_RESTART; + } + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_ACTION].targetRect)) { + if (HauptMenue == Menu::ACTION) { + Renderer::DrawText(MEAKTIONZU, TXTTEXTFELD, 2); + } else { + Renderer::DrawText(MEAKTIONAUF, TXTTEXTFELD, 2); + } + + Bmp[Tiles::BUTTON_ACTION].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if (HauptMenue == Menu::ACTION) { + HauptMenue = Menu::NONE; + } else { + HauptMenue = Menu::ACTION; } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTWEITER].rcDes)) && - (Bmp[BUTTWEITER].Phase != -1)) - { - Renderer::DrawText(WEITER, TXTTEXTFELD, 2); + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_CONSTRUCT].targetRect) && + (Bmp[Tiles::BUTTON_CONSTRUCT].AnimationPhase != -1)) { + if (HauptMenue == Menu::BUILD) { + Renderer::DrawText(MEBAUENZU, TXTTEXTFELD, 2); + } else { + Renderer::DrawText(MEBAUENAUF, TXTTEXTFELD, 2); + } - Bmp[BUTTWEITER].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Bmp[BUTTSTOP].Phase = 0; - Routing::MarkRoute(false); - RouteZiel.x = -1; - RouteZiel.y = -1; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - switch (Scape[Guy.Pos.x][Guy.Pos.y].Objekt) - { - case ZELT: Guy.Aktion = Action::TENT; - break; - case FELD: Guy.Aktion = Action::FIELD; - break; - case BOOT: Guy.Aktion = Action::BOAT; - break; - case ROHR: Guy.Aktion = Action::PIPE; - break; - case SOS: Guy.Aktion = Action::SOS_SIGN; - break; - case HAUS1: Guy.Aktion = Action::HOUSE1; - break; - case HAUS2: Guy.Aktion = Action::HOUSE2; - break; - case HAUS3: Guy.Aktion = Action::HOUSE3; - break; - case FEUERSTELLE: Guy.Aktion = Action::FIREPLACE; - break; - } + Bmp[Tiles::BUTTON_CONSTRUCT].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if (HauptMenue == Menu::BUILD) { + HauptMenue = Menu::NONE; + } else { + HauptMenue = Menu::BUILD; } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSTOP].rcDes)) && - (Bmp[BUTTSTOP].Phase != -1)) - { - Renderer::DrawText(STOP, TXTTEXTFELD, 2); + } else if (InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_INVENTORY].targetRect)) { + if (HauptMenue == Menu::INVENTORY) { + Renderer::DrawText(MEINVENTARZU, TXTTEXTFELD, 2); + } else { + Renderer::DrawText(MEINVENTARAUF, TXTTEXTFELD, 2); + } - Bmp[BUTTSTOP].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - Guy.Aktion = Action::CANCEL; - Bmp[BUTTSTOP].Phase = -1; + Bmp[Tiles::BUTTON_INVENTORY].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if (HauptMenue == Menu::INVENTORY) { + HauptMenue = Menu::NONE; + } else { + HauptMenue = Menu::INVENTORY; } } + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_CONTINUE].targetRect)) && + (Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1)) { + Renderer::DrawText(WEITER, TXTTEXTFELD, 2); - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTABLEGEN].rcDes)) && - (Bmp[BUTTABLEGEN].Phase != -1)) - { - Renderer::DrawText(BEGINNABLEGEN, TXTTEXTFELD, 2); - Bmp[BUTTABLEGEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if (Scape[Guy.Pos.x][Guy.Pos.y].Art != 1) Guy.Aktion = Action::UNDOCK; - else Guy.Aktion = Action::DOCK; + Bmp[Tiles::BUTTON_CONTINUE].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Routing::MarkRoute(false); + RouteDestination.x = -1; + RouteDestination.y = -1; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + + switch (Landscape[Guy.Pos.x][Guy.Pos.y].Object) { + case Tiles::TENT: + Guy.CurrentAction = Action::TENT; + break; + + case Tiles::FIELD: + Guy.CurrentAction = Action::FIELD; + break; + + case Tiles::BOAT: + Guy.CurrentAction = Action::BOAT; + break; + + case Tiles::PIPE: + Guy.CurrentAction = Action::PIPE; + break; + + case Tiles::SOS: + Guy.CurrentAction = Action::SOS_SIGN; + break; + + case Tiles::HOUSE_1: + Guy.CurrentAction = Action::HOUSE1; + break; + + case Tiles::HOUSE_2: + Guy.CurrentAction = Action::HOUSE2; + break; + + case Tiles::HOUSE_3: + Guy.CurrentAction = Action::HOUSE3; + break; + + case Tiles::BONFIRE: + Guy.CurrentAction = Action::FIREPLACE; + break; } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSUCHEN].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTSUCHEN].Phase != -1)) - { - Renderer::DrawText(BEGINNSUCHEN, TXTTEXTFELD, 2); - Bmp[BUTTSUCHEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - Guy.Aktion = Action::SEARCH; + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_STOP].targetRect)) && + (Bmp[Tiles::BUTTON_STOP].AnimationPhase != -1)) { + Renderer::DrawText(STOP, TXTTEXTFELD, 2); + + Bmp[Tiles::BUTTON_STOP].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + Guy.CurrentAction = Action::CANCEL; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + } + } + + else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_LAY_DOWN].targetRect)) && + (Bmp[Tiles::BUTTON_LAY_DOWN].AnimationPhase != -1)) { + Renderer::DrawText(BEGINNABLEGEN, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_LAY_DOWN].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain != 1) { + Guy.CurrentAction = Action::UNDOCK; + } else { + Guy.CurrentAction = Action::DOCK; } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTESSEN].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTESSEN].Phase != -1)) - { - Renderer::DrawText(BEGINNESSEN, TXTTEXTFELD, 2); - Bmp[BUTTESSEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if (((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BUSCH) || - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == FELD)) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase == Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl - 1)) - Guy.Aktion = Action::EAT; - else if (((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= FLUSS1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= SCHLEUSE6)) || - ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ROHR) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase == 1))) - Guy.Aktion = Action::DRINK; - else PapierText = Renderer::DrawText(KEINESSENTRINKEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_SEARCH].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_SEARCH].AnimationPhase != -1)) { + Renderer::DrawText(STRING_BEGIN_SEARCH, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_SEARCH].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + Guy.CurrentAction = Action::SEARCH; + } + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_EAT].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_EAT].AnimationPhase != -1)) { + Renderer::DrawText(BEGINNESSEN, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_EAT].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if (((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::BUSH) || + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::FIELD)) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase == Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount - 1)) { + Guy.CurrentAction = Action::EAT; + } else if (((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::RIVER_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::FLOODGATE_6)) || + ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::PIPE) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase == 1))) { + Guy.CurrentAction = Action::DRINK; + } else { + PapierText = Renderer::DrawText(STRING_NOTHING_EAT_DRINK, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSCHLAFEN].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTSCHLAFEN].Phase != -1)) - { - Renderer::DrawText(BEGINNSCHLAFEN, TXTTEXTFELD, 2); - Bmp[BUTTSCHLAFEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if (Scape[Guy.Pos.x][Guy.Pos.y].Art != 1) - { - Guy.AkNummer = 0; - Guy.Aktion = Action::SLEEP; - } - else PapierText = Renderer::DrawText(NICHTAUFWASSERSCHLAFEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_SLEEP].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_SLEEP].AnimationPhase != -1)) { + Renderer::DrawText(STRING_BEGIN_SLEEP, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_SLEEP].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain != 1) { + Guy.ActionStep = 0; + Guy.CurrentAction = Action::SLEEP; + } else { + PapierText = Renderer::DrawText(NICHTAUFWASSERSCHLAFEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTFAELLEN].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTFAELLEN].Phase != -1)) - { - Renderer::DrawText(BEGINNFAELLEN, TXTTEXTFELD, 2); - Bmp[BUTTFAELLEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if (Guy.Inventar[ROHSTAMM] <= 10) - { - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= BAUM1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= BAUM4)) - { - Guy.Aktion = Action::LOG; - } - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BAUMGROSS) || - ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= HAUS1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= HAUS3))) - PapierText = Renderer::DrawText(BAUMZUGROSS, TXTPAPIER, 1); - else PapierText = Renderer::DrawText(KEINBAUM, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_CHOP].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_CHOP].AnimationPhase != -1)) { + Renderer::DrawText(BEGINNFAELLEN, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_CHOP].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if (Guy.Inventory[Tiles::RAW_TREE_TRUNK] <= 10) { + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::TREE_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::TREE_4)) { + Guy.CurrentAction = Action::LOG; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TREE_BIG) || + ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::HOUSE_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::HOUSE_3))) { + PapierText = Renderer::DrawText(BAUMZUGROSS, TXTPAPIER, 1); + } else { + PapierText = Renderer::DrawText(KEINBAUM, TXTPAPIER, 1); } - else PapierText = Renderer::DrawText(ROHSTAMMZUVIEL, TXTPAPIER, 1); + } else { + PapierText = Renderer::DrawText(ROHSTAMMZUVIEL, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTANGELN].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTANGELN].Phase != -1)) - { - Renderer::DrawText(BEGINNANGELN, TXTTEXTFELD, 2); - Bmp[BUTTANGELN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if (((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= FLUSS1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= SCHLEUSE6)) || - (BootsFahrt)) - Guy.Aktion = Action::FISH; - else PapierText = Renderer::DrawText(KEINWASSER, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_FISH].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_FISH].AnimationPhase != -1)) { + Renderer::DrawText(STRING_BEGIN_FISHING, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_FISH].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if (((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::RIVER_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::FLOODGATE_6)) || + (IsInBoat)) { + Guy.CurrentAction = Action::FISH; + } else { + PapierText = Renderer::DrawText(STRING_NO_FISHINGWATER, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTANZUENDEN].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTANZUENDEN].Phase != -1)) - { - Renderer::DrawText(BEGINNANZUENDEN, TXTTEXTFELD, 2); - Bmp[BUTTANZUENDEN].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == FEUERSTELLE) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) - Guy.Aktion = Action::LIGHT; - else PapierText = Renderer::DrawText(KEINEFEUERST, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_IGNITE].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_IGNITE].AnimationPhase != -1)) { + Renderer::DrawText(STRING_LIGHT_BONFIRE, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_IGNITE].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::BONFIRE) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) { + Guy.CurrentAction = Action::LIGHT; + } else { + PapierText = Renderer::DrawText(STRING_ONLY_LIGHT_BONFIRE, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTAUSSCHAU].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTAUSSCHAU].Phase != -1)) - { - Renderer::DrawText(BEGINNAUSSCHAU, TXTTEXTFELD, 2); - Bmp[BUTTAUSSCHAU].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if (Scape[Guy.Pos.x][Guy.Pos.y].Art != 1) - { - Guy.AkNummer = 0; - Guy.Aktion = Action::LOOKOUT; - } - else PapierText = Renderer::DrawText(WELLENZUHOCH, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_LOOK_OUT].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_LOOK_OUT].AnimationPhase != -1)) { + Renderer::DrawText(STRING_BEGIN_LOOK_OUT, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_LOOK_OUT].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain != 1) { + Guy.ActionStep = 0; + Guy.CurrentAction = Action::LOOKOUT; + } else { + PapierText = Renderer::DrawText(WELLENZUHOCH, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSCHATZ].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTSCHATZ].Phase != -1)) - { - Renderer::DrawText(BEGINNSCHATZ, TXTTEXTFELD, 2); - Bmp[BUTTSCHATZ].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Art != 1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Typ == 0) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == -1)) - { - Guy.AkNummer = 0; - Guy.Aktion = Action::TREASURE; - } - else PapierText = Renderer::DrawText(GRABENBEDINGUNGEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_TREASURE].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_TREASURE].AnimationPhase != -1)) { + Renderer::DrawText(STRING_BEGIN_TREASUREDIG, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_TREASURE].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Terrain != 1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Type == 0) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1)) { + Guy.ActionStep = 0; + Guy.CurrentAction = Action::TREASURE; + } else { + PapierText = Renderer::DrawText(GRABENBEDINGUNGEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSCHLEUDER].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTSCHLEUDER].Phase != -1)) - { - Renderer::DrawText(BEGINNSCHLEUDER, TXTTEXTFELD, 2); - Bmp[BUTTSCHLEUDER].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Guy.AkNummer = 0; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= BAUM1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= BAUM4)) - { - Guy.AkNummer = 0; - Guy.Aktion = Action::SLINGSHOT; - } - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BAUMGROSS) || - ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= HAUS1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= HAUS3))) - PapierText = Renderer::DrawText(BAUMZUGROSS, TXTPAPIER, 1); - else PapierText = Renderer::DrawText(KEINVOGEL, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_SLINGSHOT].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_SLINGSHOT].AnimationPhase != -1)) { + Renderer::DrawText(BEGINNSCHLEUDER, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_SLINGSHOT].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Guy.ActionStep = 0; + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::TREE_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::TREE_4)) { + Guy.ActionStep = 0; + Guy.CurrentAction = Action::SLINGSHOT; + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TREE_BIG) || + ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::HOUSE_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::HOUSE_3))) { + PapierText = Renderer::DrawText(BAUMZUGROSS, TXTPAPIER, 1); + } else { + PapierText = Renderer::DrawText(KEINVOGEL, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSCHATZKARTE].rcDes)) && - (HauptMenue == Menu::ACTION) && (Bmp[BUTTSCHATZKARTE].Phase != -1)) - { - Renderer::DrawText(BEGINNSCHATZKARTE, TXTTEXTFELD, 2); - Bmp[BUTTSCHATZKARTE].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - Renderer::DrawSchatzkarte(); - } + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_TREASUREMAP].targetRect)) && + (HauptMenue == Menu::ACTION) && (Bmp[Tiles::BUTTON_TREASUREMAP].AnimationPhase != -1)) { + Renderer::DrawText(STRING_BEGIN_TREASUREMAP, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_TREASUREMAP].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + Renderer::DrawSchatzkarte(); } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTFELD].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTFELD].Phase != -1)) - { - LoadString(g_hInst, BEGINNFELD, StdString, 1024); - World::MakeRohString(-1, -1, FELD); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTFELD].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Typ == 0) && - (Scape[Guy.Pos.x][Guy.Pos.y].Art == 4)) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::FIELD; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == FELD)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::FIELD; - } - else PapierText = Renderer::DrawText(FELDBEDINGUNGEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_FARM].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_FARM].AnimationPhase != -1)) { + std::string text = GetLanguageString(BEGINNFELD); + World::RawMaterialsDescriptionString(-1, -1, Tiles::FIELD); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_FARM].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Type == 0) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain == 4)) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::FIELD; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::FIELD)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::FIELD; + } else { + PapierText = Renderer::DrawText(FELDBEDINGUNGEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTZELT].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTZELT].Phase != -1)) - { - LoadString(g_hInst, BEGINNZELT, StdString, 1024); - World::MakeRohString(-1, -1, ZELT); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTZELT].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Typ == 0) && - (Scape[Guy.Pos.x][Guy.Pos.y].Art != -1)) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::TENT; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ZELT)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::TENT; - } - else PapierText = Renderer::DrawText(ZELTBEDINGUNGEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_TENT].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_TENT].AnimationPhase != -1)) { + std::string text = GetLanguageString(BEGINNZELT); + World::RawMaterialsDescriptionString(-1, -1, Tiles::TENT); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_TENT].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Type == 0) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain != -1)) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::TENT; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TENT)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::TENT; + } else { + PapierText = Renderer::DrawText(ZELTBEDINGUNGEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTBOOT].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTBOOT].Phase != -1)) - { - LoadString(g_hInst, BEGINNBOOT, StdString, 1024); - World::MakeRohString(-1, -1, BOOT); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTBOOT].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Art == 2) && - ((Scape[Guy.Pos.x - 1][Guy.Pos.y].Art == 1) || - (Scape[Guy.Pos.x][Guy.Pos.y - 1].Art == 1) || - (Scape[Guy.Pos.x + 1][Guy.Pos.y].Art == 1) || - (Scape[Guy.Pos.x][Guy.Pos.y + 1].Art == 1))) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::BOAT; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BOOT)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::BOAT; - } - else PapierText = Renderer::DrawText(BOOTBEDINGUNGEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_BOAT].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_BOAT].AnimationPhase != -1)) { + std::string text = GetLanguageString(BEGINNBOOT); + World::RawMaterialsDescriptionString(-1, -1, Tiles::BOAT); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_BOAT].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Terrain == 2) && + ((Landscape[Guy.Pos.x - 1][Guy.Pos.y].Terrain == 1) || + (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Terrain == 1) || + (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Terrain == 1) || + (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Terrain == 1))) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::BOAT; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::BOAT)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::BOAT; + } else { + PapierText = Renderer::DrawText(BOOTBEDINGUNGEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTROHR].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTROHR].Phase != -1)) - { - LoadString(g_hInst, BEGINNROHR, StdString, 1024); - World::MakeRohString(-1, -1, ROHR); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTROHR].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Typ == 0)) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::PIPE; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == ROHR)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::PIPE; - } - else PapierText = Renderer::DrawText(ROHRBEDINGUNGEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_PIPE].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_PIPE].AnimationPhase != -1)) { + std::string text = GetLanguageString(BEGINNROHR); + World::RawMaterialsDescriptionString(-1, -1, Tiles::PIPE); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_PIPE].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Type == 0)) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::PIPE; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::PIPE)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::PIPE; + } else { + PapierText = Renderer::DrawText(ROHRBEDINGUNGEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTSOS].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTSOS].Phase != -1)) - { - LoadString(g_hInst, BEGINNSOS, StdString, 1024); - World::MakeRohString(-1, -1, SOS); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTSOS].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Typ == 0)) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::SOS_SIGN; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == SOS)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::SOS_SIGN; - } - else PapierText = Renderer::DrawText(SOSBEDINGUNGEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_SOS].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_SOS].AnimationPhase != -1)) { + std::string text = GetLanguageString(STRINGBEGIN_WRITE_SOS); + World::RawMaterialsDescriptionString(-1, -1, Tiles::SOS); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_SOS].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Type == 0)) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::SOS_SIGN; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::SOS)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::SOS_SIGN; + } else { + PapierText = Renderer::DrawText(SOSBEDINGUNGEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTHAUS1].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTHAUS1].Phase != -1)) - { - LoadString(g_hInst, BEGINNHAUS1, StdString, 1024); - World::MakeRohString(-1, -1, HAUS1); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTHAUS1].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= BAUM1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= BAUM4)) - PapierText = Renderer::DrawText(BAUMZUKLEIN, TXTPAPIER, 1); - else if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BAUMGROSS) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::HOUSE1; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS1)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::HOUSE1; - } - else PapierText = Renderer::DrawText(GEGENDNICHT, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_HOUSE_1].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_HOUSE_1].AnimationPhase != -1)) { + std::string text = GetLanguageString(BEGINNHAUS1); + World::RawMaterialsDescriptionString(-1, -1, Tiles::HOUSE_1); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_HOUSE_1].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::TREE_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::TREE_4)) { + PapierText = Renderer::DrawText(BAUMZUKLEIN, TXTPAPIER, 1); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TREE_BIG) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::HOUSE1; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_1)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::HOUSE1; + } else { + PapierText = Renderer::DrawText(GEGENDNICHT, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTHAUS2].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTHAUS2].Phase != -1)) - { - LoadString(g_hInst, BEGINNHAUS2, StdString, 1024); - World::MakeRohString(-1, -1, HAUS2); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTHAUS2].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= BAUM1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= BAUM4)) - PapierText = Renderer::DrawText(BAUMZUKLEIN, TXTPAPIER, 1); - else if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BAUMGROSS) - PapierText = Renderer::DrawText(NICHTOHNELEITER, TXTPAPIER, 1); - else if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS1) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::HOUSE2; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS2)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::HOUSE2; - } - else PapierText = Renderer::DrawText(GEGENDNICHT, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_HOUSE_2].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_HOUSE_2].AnimationPhase != -1)) { + std::string text = GetLanguageString(BEGINNHAUS2); + World::RawMaterialsDescriptionString(-1, -1, Tiles::HOUSE_2); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_HOUSE_2].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::TREE_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::TREE_4)) { + PapierText = Renderer::DrawText(BAUMZUKLEIN, TXTPAPIER, 1); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TREE_BIG) { + PapierText = Renderer::DrawText(NICHTOHNELEITER, TXTPAPIER, 1); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_1) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::HOUSE2; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_2)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::HOUSE2; + } else { + PapierText = Renderer::DrawText(GEGENDNICHT, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTHAUS3].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTHAUS3].Phase != -1)) - { - LoadString(g_hInst, BEGINNHAUS3, StdString, 1024); - World::MakeRohString(-1, -1, HAUS3); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTHAUS3].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= BAUM1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= BAUM4)) - PapierText = Renderer::DrawText(BAUMZUKLEIN, TXTPAPIER, 1); - else if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BAUMGROSS) || - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS1)) - PapierText = Renderer::DrawText(NICHTOHNEPLATTFORM, TXTPAPIER, 1); - else if (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS2) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::HOUSE3; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == HAUS3)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::HOUSE3; - } - else PapierText = Renderer::DrawText(GEGENDNICHT, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_HOUSE_3].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_HOUSE_3].AnimationPhase != -1)) { + std::string text = GetLanguageString(STRING_BUILD_TREEHOUSE); + World::RawMaterialsDescriptionString(-1, -1, Tiles::HOUSE_3); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_HOUSE_3].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::TREE_1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::TREE_4)) { + PapierText = Renderer::DrawText(BAUMZUKLEIN, TXTPAPIER, 1); + } else if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::TREE_BIG) || + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_1)) { + PapierText = Renderer::DrawText(NICHTOHNEPLATTFORM, TXTPAPIER, 1); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_2) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::HOUSE3; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::HOUSE_3)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::HOUSE3; + } else { + PapierText = Renderer::DrawText(GEGENDNICHT, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTFEUERST].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTFEUERST].Phase != -1)) - { - LoadString(g_hInst, BEGINNFEUERSTELLE, StdString, 1024); - World::MakeRohString(-1, -1, FEUERSTELLE); - strcat(StdString, RohString); - TextBereich[TXTTEXTFELD].Aktiv = true; - Renderer::DrawString(StdString, static_cast(TextBereich[TXTTEXTFELD].rcText.left), - static_cast(TextBereich[TXTTEXTFELD].rcText.top), 2); - - Bmp[BUTTFEUERST].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Typ == 0)) - { - Scape[Guy.Pos.x][Guy.Pos.y].AkNummer = 0; - Bmp[BUTTSTOP].Phase = 0; - Guy.Aktion = Action::FIREPLACE; - } - else if ((Bmp[BUTTWEITER].Phase != -1) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt == FEUERSTELLE)) - { - Bmp[BUTTSTOP].Phase = 0; - Guy.PosAlt = Guy.PosScreen; - Routing::ShortRoute(Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, - Scape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); - Guy.Aktion = Action::FIREPLACE; - } - else PapierText = Renderer::DrawText(FEUERSTELLENBEDINGUNGEN, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_FIRE].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_FIRE].AnimationPhase != -1)) { + std::string text = GetLanguageString(STRING_BEGIN_BONFIRE); + World::RawMaterialsDescriptionString(-1, -1, Tiles::BONFIRE); + text += RohString; + TextBereich[TXTTEXTFELD].HasText = true; + Renderer::DrawString(text.c_str(), static_cast(TextBereich[TXTTEXTFELD].textRect.left), + static_cast(TextBereich[TXTTEXTFELD].textRect.top), 2); + + Bmp[Tiles::BUTTON_FIRE].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Type == 0)) { + Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep = 0; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.CurrentAction = Action::FIREPLACE; + } else if ((Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::BONFIRE)) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = 0; + Guy.OriginalPosition = Guy.ScreenPosition; + Routing::ShortRoute(Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.x, + Landscape[Guy.Pos.x][Guy.Pos.y].GPosAlt.y); + Guy.CurrentAction = Action::FIREPLACE; + } else { + PapierText = Renderer::DrawText(FEUERSTELLENBEDINGUNGEN, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[BUTTDESTROY].rcDes)) && - (HauptMenue == Menu::BUILD) && (Bmp[BUTTDESTROY].Phase != -1)) - { - Renderer::DrawText(BEGINNDESTROY, TXTTEXTFELD, 2); - Bmp[BUTTDESTROY].Animation = true; - if ((Button == 0) && (Push == 1)) - { - PlaySound(Sound::CLICK2, 100); - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= FELD) && - (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= FEUERSTELLE)) - { - Guy.AkNummer = 0; - Guy.Aktion = Action::DESTROY; - } - else PapierText = Renderer::DrawText(KEINBAUWERK, TXTPAPIER, 1); + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::BUTTON_DESTROY].targetRect)) && + (HauptMenue == Menu::BUILD) && (Bmp[Tiles::BUTTON_DESTROY].AnimationPhase != -1)) { + Renderer::DrawText(STRING_BEGIN_DESTROY, TXTTEXTFELD, 2); + Bmp[Tiles::BUTTON_DESTROY].IsAnimationRunning = true; + + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK2, 100); + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::FIELD) && + (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::BONFIRE)) { + Guy.ActionStep = 0; + Guy.CurrentAction = Action::DESTROY; + } else { + PapierText = Renderer::DrawText(STRING_NOTHING_TO_DESTROY, TXTPAPIER, 1); } } - else if ((InRect(MousePosition.x, MousePosition.y, Bmp[INVPAPIER].rcDes)) && (HauptMenue == Menu::INVENTORY)) - { - for (short i = ROHAST; i <= ROHSCHLEUDER; i++) - { - if (InRect(MousePosition.x, MousePosition.y, Bmp[i].rcDes) && (Guy.Inventar[i] > 0)) - { - if ((Button == 0) && (Push == 1)) - { - if (TwoClicks == -1) - { - CursorTyp = i; - TwoClicks = i; - } - else World::CheckBenutze(i); - } - switch (i) - { - case ROHAST: Renderer::DrawText(AST, TXTTEXTFELD, 2); - break; - case ROHSTEIN: Renderer::DrawText(STEIN, TXTTEXTFELD, 2); - break; - case ROHAXT: Renderer::DrawText(AXT, TXTTEXTFELD, 2); - break; - case ROHBLATT: Renderer::DrawText(BLATT, TXTTEXTFELD, 2); - break; - case ROHSTAMM: Renderer::DrawText(STAMM, TXTTEXTFELD, 2); - break; - case ROHEGGE: Renderer::DrawText(EGGE, TXTTEXTFELD, 2); - break; - case ROHLIANE: Renderer::DrawText(LIANE, TXTTEXTFELD, 2); - break; - case ROHANGEL: Renderer::DrawText(ANGEL, TXTTEXTFELD, 2); - break; - case ROHHAMMER: Renderer::DrawText(HAMMERTEXT, TXTTEXTFELD, 2); - break; - case ROHFERNROHR: Renderer::DrawText(FERNROHR, TXTTEXTFELD, 2); - break; - case ROHSTREICHHOLZ: Renderer::DrawText(STREICHHOLZ, TXTTEXTFELD, 2); - break; - case ROHSCHAUFEL: Renderer::DrawText(SCHAUFEL, TXTTEXTFELD, 2); - break; - case ROHKARTE: Renderer::DrawText(KARTE, TXTTEXTFELD, 2); - break; - case ROHSCHLEUDER: Renderer::DrawText(SCHLEUDER, TXTTEXTFELD, 2); - break; + } else if ((InRect(MousePosition.x, MousePosition.y, Bmp[Tiles::INVENTORY_PAPER].targetRect)) && (HauptMenue == Menu::INVENTORY)) { + for (short i = Tiles::RAW_TREE_BRANCH; i <= Tiles::RAW_SLINGSHOT; i++) { + if (InRect(MousePosition.x, MousePosition.y, Bmp[i].targetRect) && (Guy.Inventory[i] > 0)) { + if ((Button == 0) && (Push == 1)) { + if (TwoClicks == -1) { + CursorTyp = i; + TwoClicks = i; + } else { + World::OnRawMaterialsUsed(i); } + } + + switch (i) { + case Tiles::RAW_TREE_BRANCH: + Renderer::DrawText(AST, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_STONE: + Renderer::DrawText(STEIN, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_AXE: + Renderer::DrawText(STRING_AXE, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_LEAF: + Renderer::DrawText(STRING_LEAF, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_TREE_TRUNK: + Renderer::DrawText(STAMM, TXTTEXTFELD, 2); + break; + case Tiles::RAW_HOE: + Renderer::DrawText(EGGE, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_LIANA: + Renderer::DrawText(STRING_LIANA, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_FISHING_POLE: + Renderer::DrawText(ANGEL, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_HAMMER: + Renderer::DrawText(HAMMERTEXT, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_TELESCOPE: + Renderer::DrawText(STRING_TELESCOPE, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_MATCH: + Renderer::DrawText(STRING_MATCHES, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_SHOVEL: + Renderer::DrawText(STRING_SHOVEL, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_MAP: + Renderer::DrawText(STRING_MAP, TXTTEXTFELD, 2); + break; + + case Tiles::RAW_SLINGSHOT: + Renderer::DrawText(STRING_SLINGSHOT, TXTTEXTFELD, 2); break; } + + break; } } - else if (InRect(MousePosition.x, MousePosition.y, TextBereich[TXTTAGESZEIT].rcText)) - Renderer::DrawText(SOSPAET, TXTTEXTFELD, 2); - else if (InRect(MousePosition.x, MousePosition.y, TextBereich[TXTCHANCE].rcText)) - Renderer::DrawText(CHANCETEXT, TXTTEXTFELD, 2); - else // TwoClicks löschen - { - if ((Button == 0) && (Push == 1)) PlaySound(Sound::CLICK, 100); - TwoClicks = -1; + } else if (InRect(MousePosition.x, MousePosition.y, TextBereich[TXTTAGESZEIT].textRect)) { + Renderer::DrawText(SOSPAET, TXTTEXTFELD, 2); + } else if (InRect(MousePosition.x, MousePosition.y, TextBereich[TXTCHANCE].textRect)) { + Renderer::DrawText(CHANCETEXT, TXTTEXTFELD, 2); + } else { // TwoClicks löschen + if ((Button == 0) && (Push == 1)) { + PlaySound(Sound::CLICK, 100); } + + TwoClicks = -1; } +} + +#define SIGN(p1x, p1y, p2x, p2y, p3x, p3y) (((p1x) - (p3x)) * ((p2y) - (p3y)) - ((p2x) - (p3x)) * ((p1y) - (p3y))) + +bool InTriangle(float x, float y, float x0, float y0, float x1, float y1, float x3, float y3) +{ + const float d1 = SIGN(x, y, x0, y0, x1, y1); + const float d2 = SIGN(x, y, x1, y1, x3, y3); + const float d3 = SIGN(x, y, x3, y3, x0, y0); - bool InDreieck(short X, short Y, short X0, short Y0, short X1, short Y1, short X3, short Y3) - { - float x = static_cast(X); - float y = static_cast(Y); - float x0 = static_cast(X0); - float y0 = static_cast(Y0); - float x1 = static_cast(X1); - float y1 = static_cast(Y1); - float x3 = static_cast(X3); - float y3 = static_cast(Y3); - - float c = (x - x1) / (x0 - x1); - if (c < 0) return false; - float d = ((y - y3) * (x0 - x1) - (x - x1) * (y0 - y3)) / ((y1 - y3) * (x0 - x1)); - if (d < 0) return false; - float b = ((y - y0) * (x1 - x0) - (x - x0) * (y1 - y0)) / ((x1 - x0) * (y3 - y1)); - if (b < 0) return false; - float a = (x - x0) / (x1 - x0) - b; - if (a < 0) return false; + return !( + (d1 < 0 || d2 < 0 || d3 < 0) && + (d1 > 0 || d2 > 0 || d3 > 0) + ); +} + +bool InRect(short x, short y, RECT rcRect) +{ + if ((x <= rcRect.right) && (x >= rcRect.left) && + (y <= rcRect.bottom) && (y >= rcRect.top)) { return true; } - bool InRect(short x, short y, RECT rcRect) - { - if ((x <= rcRect.right) && (x >= rcRect.left) && - (y <= rcRect.bottom) && (y >= rcRect.top)) - return true; - return false; - } + return false; +} - void CalcGuyKoor() - { - if (Step >= Steps) - { - RoutePunkt++; - - if ((RoutePunkt >= (RouteLaenge > 1 ? 2 * (RouteLaenge - 1) : 1) || - ((Guy.Aktion == Action::CANCEL) && (RouteLaenge > 1)))) - { - if (RouteLaenge > 1) Bmp[BUTTSTOP].Phase = -1; - Bmp[Guy.Zustand].Phase = 0; - Guy.Aktiv = false; - RouteZiel.x = -1; - RouteZiel.y = -1; - return; +void CalcGuyKoor() +{ + if (Step >= Steps) { + RoutePunkt++; + + if ((RoutePunkt >= (RouteLaenge > 1 ? 2 * (RouteLaenge - 1) : 1) || + ((Guy.CurrentAction == Action::CANCEL) && (RouteLaenge > 1)))) { + if (RouteLaenge > 1) { + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; } - Guy.Pos.x = Route[(RoutePunkt + 1) / 2].x; - Guy.Pos.y = Route[(RoutePunkt + 1) / 2].y; - World::Entdecken(); - - if (BootsFahrt) - World::AddTime(0, Scape[Route[(RoutePunkt + 1) / 2].x][Route[(RoutePunkt + 1) / 2].y].LaufZeit * 3); - else World::AddTime(0, Scape[Route[(RoutePunkt + 1) / 2].x][Route[(RoutePunkt + 1) / 2].y].LaufZeit * 5); - World::AddResource(NAHRUNG, -1); - World::AddResource(WASSER, -1); - - if ((Guy.Zustand == GUYSCHIFF) || (Guy.Zustand == GUYSCHWIMMEN)) Guy.Zustand -= 2; // nichts machen - else if (BootsFahrt) Guy.Zustand = GUYBOOTLINKS; - else Guy.Zustand = GUYLINKS; - - if (RouteLaenge > 1) // Bei normaler Routenabarbeitung die Richung Kachelmäßig rausfinden - { - if (Route[RoutePunkt / 2].x > Route[RoutePunkt / 2 + 1].x) Guy.Zustand += 0; - else if (Route[RoutePunkt / 2].x < Route[RoutePunkt / 2 + 1].x) Guy.Zustand += 2; - else if (Route[RoutePunkt / 2].y < Route[RoutePunkt / 2 + 1].y) Guy.Zustand += 3; - else if (Route[RoutePunkt / 2].y > Route[RoutePunkt / 2 + 1].y) Guy.Zustand += 1; + + Bmp[Guy.AnimationState].AnimationPhase = 0; + Guy.IsActive = false; + RouteDestination.x = -1; + RouteDestination.y = -1; + return; + } + + Guy.Pos.x = Route[(RoutePunkt + 1) / 2].x; + Guy.Pos.y = Route[(RoutePunkt + 1) / 2].y; + World::UpdateDiscovered(); + + if (IsInBoat) { + World::AddTime(0, Landscape[Route[(RoutePunkt + 1) / 2].x][Route[(RoutePunkt + 1) / 2].y].RunningTime * 3); + } else { + World::AddTime(0, Landscape[Route[(RoutePunkt + 1) / 2].x][Route[(RoutePunkt + 1) / 2].y].RunningTime * 5); + } + + World::AddResource(Resources::Food, -1); + World::AddResource(Resources::Water, -1); + + if ((Guy.AnimationState == Tiles::GUY_SHIP) || (Guy.AnimationState == Tiles::GUY_SWIM)) { + Guy.AnimationState -= 2; // nichts machen + } else if (IsInBoat) { + Guy.AnimationState = Tiles::GUY_BOAT_LEFT; + } else { + Guy.AnimationState = Tiles::GUY_LEFT; + } + + if (RouteLaenge > 1) { // Bei normaler Routenabarbeitung die Richung Kachelmäßig rausfinden + if (Route[RoutePunkt / 2].x > Route[RoutePunkt / 2 + 1].x) { + Guy.AnimationState += 0; + } else if (Route[RoutePunkt / 2].x < Route[RoutePunkt / 2 + 1].x) { + Guy.AnimationState += 2; + } else if (Route[RoutePunkt / 2].y < Route[RoutePunkt / 2 + 1].y) { + Guy.AnimationState += 3; + } else if (Route[RoutePunkt / 2].y > Route[RoutePunkt / 2 + 1].y) { + Guy.AnimationState += 1; } - else - { - if ((RouteKoor[RoutePunkt].x > RouteKoor[RoutePunkt + 1].x) && - (RouteKoor[RoutePunkt].y >= RouteKoor[RoutePunkt + 1].y)) - Guy.Zustand += 0; - else if ((RouteKoor[RoutePunkt].x <= RouteKoor[RoutePunkt + 1].x) && - (RouteKoor[RoutePunkt].y > RouteKoor[RoutePunkt + 1].y)) - Guy.Zustand += 1; - else if ((RouteKoor[RoutePunkt].x < RouteKoor[RoutePunkt + 1].x) && - (RouteKoor[RoutePunkt].y <= RouteKoor[RoutePunkt + 1].y)) - Guy.Zustand += 2; - else if ((RouteKoor[RoutePunkt].x >= RouteKoor[RoutePunkt + 1].x) && - (RouteKoor[RoutePunkt].y < RouteKoor[RoutePunkt + 1].y)) - Guy.Zustand += 3; + } else { + if ((RouteKoor[RoutePunkt].x > RouteKoor[RoutePunkt + 1].x) && + (RouteKoor[RoutePunkt].y >= RouteKoor[RoutePunkt + 1].y)) { + Guy.AnimationState += 0; + } else if ((RouteKoor[RoutePunkt].x <= RouteKoor[RoutePunkt + 1].x) && + (RouteKoor[RoutePunkt].y > RouteKoor[RoutePunkt + 1].y)) { + Guy.AnimationState += 1; + } else if ((RouteKoor[RoutePunkt].x < RouteKoor[RoutePunkt + 1].x) && + (RouteKoor[RoutePunkt].y <= RouteKoor[RoutePunkt + 1].y)) { + Guy.AnimationState += 2; + } else if ((RouteKoor[RoutePunkt].x >= RouteKoor[RoutePunkt + 1].x) && + (RouteKoor[RoutePunkt].y < RouteKoor[RoutePunkt + 1].y)) { + Guy.AnimationState += 3; } + } + + // Differenz zwischen Ziel und Start + short Dx = RouteKoor[RoutePunkt + 1].x - RouteKoor[RoutePunkt].x; + short Dy = RouteKoor[RoutePunkt + 1].y - RouteKoor[RoutePunkt].y; - // Differenz zwischen Ziel und Start - short Dx = RouteKoor[RoutePunkt + 1].x - RouteKoor[RoutePunkt].x; - short Dy = RouteKoor[RoutePunkt + 1].y - RouteKoor[RoutePunkt].y; - - GuyPosScreenStart.x = RouteKoor[RoutePunkt].x; - GuyPosScreenStart.y = RouteKoor[RoutePunkt].y; - Step = 0; - - if (abs(Dx) > abs(Dy)) - { - if (Dx > 0) Schrittx = 1; - else Schrittx = -1; - if (Dx == 0) Schritty = 0; - else Schritty = static_cast(Dy) / static_cast(Dx * Schrittx); - Steps = abs(Dx); + GuyPosScreenStart.x = RouteKoor[RoutePunkt].x; + GuyPosScreenStart.y = RouteKoor[RoutePunkt].y; + Step = 0; + + if (abs(Dx) > abs(Dy)) { + if (Dx > 0) { + Schrittx = 1; + } else { + Schrittx = -1; } - else - { - if (Dy > 0) Schritty = 1; - else Schritty = -1; - if (Dy == 0) Schrittx = 0; - else Schrittx = static_cast(Dx) / static_cast(Dy * Schritty); - Steps = abs(Dy); + + if (Dx == 0) { + Schritty = 0; + } else { + Schritty = static_cast(Dy) / static_cast(Dx * Schrittx); } - } - if (Bild % Scape[Guy.Pos.x][Guy.Pos.y].LaufZeit == 0) - { - Step++; - short i; - if (BootsFahrt) i = 4; - else i = 2; - if (Step % i == 0) - { - Bmp[Guy.Zustand].Phase++; - if (Bmp[Guy.Zustand].Phase >= Bmp[Guy.Zustand].Anzahl) Bmp[Guy.Zustand].Phase = 0; + Steps = abs(Dx); + } else { + if (Dy > 0) { + Schritty = 1; + } else { + Schritty = -1; } - Guy.PosScreen.x = GuyPosScreenStart.x + ROUND(Step*Schrittx); - Guy.PosScreen.y = GuyPosScreenStart.y + ROUND(Step*Schritty); - if ((Spielzustand == State::INTRO) || (Spielzustand == State::RESCUED)) // Beim Intro fährt die Kamera mit - { - Camera.x = Guy.PosScreen.x - static_cast(rcGesamt.right / 2); - Camera.y = Guy.PosScreen.y - static_cast(rcGesamt.bottom / 2); + + if (Dy == 0) { + Schrittx = 0; + } else { + Schrittx = static_cast(Dx) / static_cast(Dy * Schritty); } + + Steps = abs(Dy); } } - void CalcKoor() - { - // Bildschirmkoordinaten berechnen und speichern - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - Scape[x][y].xScreen = KXPIXEL / 2 * MAXXKACH + 32 + - x * KXPIXEL / 2 - y * KYPIXEL / 2 + - (-6 * y) + x; // seltsame Korrekturen - Scape[x][y].yScreen = - x * KXPIXEL / 2 + y * KYPIXEL / 2 - 16 * Scape[x][y].Hoehe + - (-13 * x) + (-8 * y); // seltsame Korrekturen - - if ((x == 0) && (y == 0)) - ScapeGrenze.top = Scape[x][y].yScreen; - if ((x == 0) && (y == MAXYKACH - 1)) - ScapeGrenze.left = Scape[x][y].xScreen; - if ((x == MAXXKACH - 1) && (y == MAXYKACH - 1)) - ScapeGrenze.bottom = Scape[x][y].yScreen + KYPIXEL; - if ((x == MAXXKACH - 1) && (y == 0)) - ScapeGrenze.right = Scape[x][y].xScreen + KXPIXEL; + if (CurrentFrame % Landscape[Guy.Pos.x][Guy.Pos.y].RunningTime == 0) { + Step++; + short i; + + if (IsInBoat) { + i = 4; + } else { + i = 2; + } + + if (Step % i == 0) { + Bmp[Guy.AnimationState].AnimationPhase++; + + if (Bmp[Guy.AnimationState].AnimationPhase >= Bmp[Guy.AnimationState].AnimationPhaseCount) { + Bmp[Guy.AnimationState].AnimationPhase = 0; } + } + + Guy.ScreenPosition.x = GuyPosScreenStart.x + ROUND(Step * Schrittx); + Guy.ScreenPosition.y = GuyPosScreenStart.y + ROUND(Step * Schritty); + + if ((s_GameState == State::INTRO) || (s_GameState == State::RESCUED)) { // Beim Intro fährt die Kamera mit + Camera.x = Guy.ScreenPosition.x - static_cast(rcGesamt.right / 2); + Camera.y = Guy.ScreenPosition.y - static_cast(rcGesamt.bottom / 2); + } } +} - bool LineIntersect(ZWEID LineStartPos, ZWEID Pos, bool store) - { - float Sx, Sy; - bool erg = false; +void CalcKoor() +{ + // Bildschirmkoordinaten berechnen und speichern + for (short y = 0; y < MAX_TILESY; y++) + for (short x = 0; x < MAX_TILES_X; x++) { + Landscape[x][y].xScreen = TILE_SIZE_X / 2 * MAX_TILES_X + 32 + + x * TILE_SIZE_X / 2 - y * TILE_SIZE_Y / 2 + + (-6 * y) + x; // seltsame Korrekturen + Landscape[x][y].yScreen = + x * TILE_SIZE_X / 2 + y * TILE_SIZE_Y / 2 - 16 * Landscape[x][y].Height + + (-13 * x) + (-8 * y); // seltsame Korrekturen - Steps = 0; + if ((x == 0) && (y == 0)) { + ScapeGrenze.top = Landscape[x][y].yScreen; + } - short Dx = LineStartPos.x - Pos.x; - short Dy = LineStartPos.y - Pos.y; - float x = LineStartPos.x; - float y = LineStartPos.y; + if ((x == 0) && (y == MAX_TILESY - 1)) { + ScapeGrenze.left = Landscape[x][y].xScreen; + } - if (abs(Dx) > abs(Dy)) - { - if (Dx > 0) Sx = -1; - else Sx = 1; - if (Dx == 0) Sy = 0; - else Sy = static_cast(Dy) / static_cast(Dx * Sx); - Steps = abs(Dx); + if ((x == MAX_TILES_X - 1) && (y == MAX_TILESY - 1)) { + ScapeGrenze.bottom = Landscape[x][y].yScreen + TILE_SIZE_Y; + } + + if ((x == MAX_TILES_X - 1) && (y == 0)) { + ScapeGrenze.right = Landscape[x][y].xScreen + TILE_SIZE_X; + } } - else - { - if (Dy > 0) Sy = -1; - else Sy = 1; - if (Dy == 0) Sx = 0; - else Sx = static_cast(Dx) / static_cast(Dy * Sy); - Steps = abs(Dy); +} + +bool LineIntersect(Coordinate LineStartPos, Coordinate Pos, bool store) +{ + float Sx, Sy; + bool erg = false; + + Steps = 0; + + short Dx = LineStartPos.x - Pos.x; + short Dy = LineStartPos.y - Pos.y; + float x = LineStartPos.x; + float y = LineStartPos.y; + + if (abs(Dx) > abs(Dy)) { + if (Dx > 0) { + Sx = -1; + } else { + Sx = 1; } - for (short i = 0; i < Steps; i++) - { - if (!Scape[ROUND(x)][ROUND(y)].Begehbar) erg = true; - if ((store)) - { - Route[RouteLaenge].x = ROUND(x); - Route[RouteLaenge].y = ROUND(y); - RouteLaenge++; - } - float Nextx = x + Sx; - float Nexty = y + Sy; - if ((ROUND(y) != ROUND(Nexty)) && (ROUND(x) != ROUND(Nextx))) - { - if (Scape[ROUND(x)][ROUND(Nexty)].Begehbar) - { - if ((store)) - { - Route[RouteLaenge].x = ROUND(x); - Route[RouteLaenge].y = ROUND(Nexty); - RouteLaenge++; - } + if (Dx == 0) { + Sy = 0; + } else { + Sy = static_cast(Dy) / static_cast(Dx * Sx); + } + + Steps = abs(Dx); + } else { + if (Dy > 0) { + Sy = -1; + } else { + Sy = 1; + } + + if (Dy == 0) { + Sx = 0; + } else { + Sx = static_cast(Dx) / static_cast(Dy * Sy); + } + + Steps = abs(Dy); + } + + for (short i = 0; i < Steps; i++) { + if (!Landscape[ROUND(x)][ROUND(y)].Walkable) { + erg = true; + } + + if ((store)) { + Route[RouteLaenge].x = ROUND(x); + Route[RouteLaenge].y = ROUND(y); + RouteLaenge++; + } + + float Nextx = x + Sx; + float Nexty = y + Sy; + + if ((ROUND(y) != ROUND(Nexty)) && (ROUND(x) != ROUND(Nextx))) { + if (Landscape[ROUND(x)][ROUND(Nexty)].Walkable) { + if ((store)) { + Route[RouteLaenge].x = ROUND(x); + Route[RouteLaenge].y = ROUND(Nexty); + RouteLaenge++; } - else - { - if (Scape[ROUND(Nextx)][ROUND(y)].Begehbar) - { - if ((store)) - { - Route[RouteLaenge].x = ROUND(Nextx); - Route[RouteLaenge].y = ROUND(y); - RouteLaenge++; - } - } - else - { - erg = true; + } else { + if (Landscape[ROUND(Nextx)][ROUND(y)].Walkable) { + if ((store)) { + Route[RouteLaenge].x = ROUND(Nextx); + Route[RouteLaenge].y = ROUND(y); + RouteLaenge++; } + } else { + erg = true; } } - y = Nexty; - x = Nextx; } - // MessageBeep(MB_OK); - return erg; + + y = Nexty; + x = Nextx; } - void CalcRect(RECT rcBereich) - { - if (rcRectdes.left < rcBereich.left) - { - rcRectsrc.left = rcRectsrc.left + rcBereich.left - rcRectdes.left; - rcRectdes.left = rcBereich.left; - } - if (rcRectdes.top < rcBereich.top) - { - rcRectsrc.top = rcRectsrc.top + rcBereich.top - rcRectdes.top; - rcRectdes.top = rcBereich.top; - } - if (rcRectdes.right > rcBereich.right) - { - rcRectsrc.right = rcRectsrc.right + rcBereich.right - rcRectdes.right; - rcRectdes.right = rcBereich.right; - } - if (rcRectdes.bottom > rcBereich.bottom) - { - rcRectsrc.bottom = rcRectsrc.bottom + rcBereich.bottom - rcRectdes.bottom; - rcRectdes.bottom = rcBereich.bottom; - } + // MessageBeep(MB_OK); + return erg; +} + +void CalcRect(RECT rcBereich) +{ + if (rcRectdes.left < rcBereich.left) { + rcRectsrc.left = rcRectsrc.left + rcBereich.left - rcRectdes.left; + rcRectdes.left = rcBereich.left; } - void ButtAniAus() - { - for (short i = BUTTGITTER; i <= BUTTDESTROY; i++) - { - Bmp[i].Animation = false; - } + if (rcRectdes.top < rcBereich.top) { + rcRectsrc.top = rcRectsrc.top + rcBereich.top - rcRectdes.top; + rcRectdes.top = rcBereich.top; } - void AbspannCalc() - { - short i; + if (rcRectdes.right > rcBereich.right) { + rcRectsrc.right = rcRectsrc.right + rcBereich.right - rcRectdes.right; + rcRectdes.right = rcBereich.right; + } + + if (rcRectdes.bottom > rcBereich.bottom) { + rcRectsrc.bottom = rcRectsrc.bottom + rcBereich.bottom - rcRectdes.bottom; + rcRectdes.bottom = rcBereich.bottom; + } +} + +void ButtAniAus() +{ + for (short i = Tiles::BUTTON_GRID; i <= Tiles::BUTTON_DESTROY; i++) { + Bmp[i].IsAnimationRunning = false; + } +} + +void AbspannCalc() +{ + short i; + + if (CreditsState == 0) { + for (short k = 1; k < 10; k++) { + if (CreditsList[CreditsNum][k].Picture == -1) { + break; + } + + if (!CreditsList[CreditsNum][k].IsRunning) { + continue; + } + + i = 150 / FPS; + Bmp[CreditsList[CreditsNum][k].Picture].targetRect.top -= i; - if (AbspannZustand == 0) - { - for (short k = 1; k < 10; k++) - { - if (AbspannListe[AbspannNr][k].Bild == -1) break; - if (!AbspannListe[AbspannNr][k].Aktiv) continue; - i = 150 / LastBild; - Bmp[AbspannListe[AbspannNr][k].Bild].rcDes.top -= i; - - if (Bmp[AbspannListe[AbspannNr][k].Bild].rcDes.top < MAXY - 400) - { - if ((!AbspannListe[AbspannNr][k + 1].Aktiv) && - (AbspannListe[AbspannNr][k + 1].Bild != -1)) - AbspannListe[AbspannNr][k + 1].Aktiv = true; + if (Bmp[CreditsList[CreditsNum][k].Picture].targetRect.top < MAX_SCREEN_Y - 400) { + if ((!CreditsList[CreditsNum][k + 1].IsRunning) && + (CreditsList[CreditsNum][k + 1].Picture != -1)) { + CreditsList[CreditsNum][k + 1].IsRunning = true; } - if (Bmp[AbspannListe[AbspannNr][k].Bild].rcDes.top < 0) - { - AbspannListe[AbspannNr][k].Aktiv = false; - Bmp[AbspannListe[AbspannNr][k].Bild].rcDes.top = MAXY - Bmp[AbspannListe[AbspannNr][k].Bild].Hoehe / 2; - if (!AbspannListe[AbspannNr][k + 1].Aktiv) - { - if (AbspannListe[AbspannNr + 1][0].Bild != -1) - { - AbspannNr++; - AbspannListe[AbspannNr][1].Aktiv = true; - } - else - { - AbspannNr = GUYLINKS; - AbspannZustand = 1; - } + } + + if (Bmp[CreditsList[CreditsNum][k].Picture].targetRect.top < 0) { + CreditsList[CreditsNum][k].IsRunning = false; + Bmp[CreditsList[CreditsNum][k].Picture].targetRect.top = MAX_SCREEN_Y - Bmp[CreditsList[CreditsNum][k].Picture].Height / 2; + + if (!CreditsList[CreditsNum][k + 1].IsRunning) { + if (CreditsList[CreditsNum + 1][0].Picture != -1) { + CreditsNum++; + CreditsList[CreditsNum][1].IsRunning = true; + } else { + CreditsNum = Tiles::GUY_LEFT; + CreditsState = 1; } } } } - else if (AbspannZustand == 1) - { - i = LastBild / Bmp[AbspannNr].Geschwindigkeit; - if (i < 1) i = 1; - if (Bild % i == 0) - { - Bmp[AbspannNr].Phase++; - if (Bmp[AbspannNr].Phase >= Bmp[AbspannNr].Anzahl) - { - Bmp[AbspannNr].Phase = 0; - AbspannNr++; - if (AbspannNr > GUYSCHLEUDER) AbspannNr = GUYLINKS; + } else if (CreditsState == 1) { + i = FPS / Bmp[CreditsNum].Speed; + + if (i < 1) { + i = 1; + } + + if (CurrentFrame % i == 0) { + Bmp[CreditsNum].AnimationPhase++; + + if (Bmp[CreditsNum].AnimationPhase >= Bmp[CreditsNum].AnimationPhaseCount) { + Bmp[CreditsNum].AnimationPhase = 0; + CreditsNum++; + + if (CreditsNum > Tiles::GUY_SLINGSHOT) { + CreditsNum = Tiles::GUY_LEFT; } } } } +} + +void Animationen() +{ + short i, j, loop; // Zwischenspeicher + - void Animationen() - { - short i, j, loop; // Zwischenspeicher - - - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - j = Scape[x][y].Objekt; - if ((j == -1) || (!Bmp[j].Animation)) continue; - i = LastBild / Bmp[j].Geschwindigkeit; - if (i < 1) i = 1; - if (Bild % i == 0) - { - if ((j < BAUM1DOWN) || (j > BAUM4DOWN) || // Die Baumfällenanimation nur ein mal abspielen - (Scape[x][y].Phase != Bmp[j].Anzahl - 1)) - Scape[x][y].Phase++; - if (Scape[x][y].Phase >= Bmp[j].Anzahl) - Scape[x][y].Phase = 0; + for (short y = 0; y < MAX_TILESY; y++) + for (short x = 0; x < MAX_TILES_X; x++) { + j = Landscape[x][y].Object; + + if ((j == -1) || (!Bmp[j].IsAnimationRunning)) { + continue; + } + + i = FPS / Bmp[j].Speed; + + if (i < 1) { + i = 1; + } + + if (CurrentFrame % i == 0) { + if ((j < Tiles::TREE_DOWN_1) || (j > Tiles::TREE_DOWN_4) || // Die Baumfällenanimation nur ein mal abspielen + (Landscape[x][y].AnimationPhase != Bmp[j].AnimationPhaseCount - 1)) { + Landscape[x][y].AnimationPhase++; + } + + if (Landscape[x][y].AnimationPhase >= Bmp[j].AnimationPhaseCount) { + Landscape[x][y].AnimationPhase = 0; } } + } + + for (j = Tiles::BUTTON_GRID; j <= Tiles::BUTTON_DESTROY; j++) { + if (!Bmp[j].IsAnimationRunning) { + continue; + } - for (j = BUTTGITTER; j <= BUTTDESTROY; j++) - { - if (!Bmp[j].Animation) continue; - i = LastBild / Bmp[j].Geschwindigkeit; - if (i < 1) i = 1; - if (Bild % i == 0) - { - Bmp[j].Phase++; - if (Bmp[j].Phase >= Bmp[j].Anzahl) Bmp[j].Phase = 0; + i = FPS / Bmp[j].Speed; + + if (i < 1) { + i = 1; + } + + if (CurrentFrame % i == 0) { + Bmp[j].AnimationPhase++; + + if (Bmp[j].AnimationPhase >= Bmp[j].AnimationPhaseCount) { + Bmp[j].AnimationPhase = 0; } } + } - // Spielfigur + // Spielfigur - // laufen - if (((Guy.Zustand >= GUYLINKS) && (Guy.Zustand <= GUYUNTEN)) || - ((Guy.Zustand >= GUYBOOTLINKS) && (Guy.Zustand <= GUYBOOTUNTEN)) || - (Guy.Zustand == GUYSCHIFF) || (Guy.Zustand == GUYSCHWIMMEN)) - { - i = LastBild / Bmp[Guy.Zustand].Geschwindigkeit; - if (i < 1) i = 1; - if (LastBild - Bmp[Guy.Zustand].Geschwindigkeit < 0) loop = 2; - else loop = 1; - if (BootsFahrt) loop = loop * 2; - for (short k = 0; k < loop; k++) if ((Bild % i == 0) && (Guy.Aktiv)) CalcGuyKoor(); - return; + // laufen + if (((Guy.AnimationState >= Tiles::GUY_LEFT) && (Guy.AnimationState <= Tiles::GUY_BELOW)) || + ((Guy.AnimationState >= Tiles::GUY_BOAT_LEFT) && (Guy.AnimationState <= Tiles::GUY_BOAT_BELOW)) || + (Guy.AnimationState == Tiles::GUY_SHIP) || (Guy.AnimationState == Tiles::GUY_SWIM)) { + i = FPS / Bmp[Guy.AnimationState].Speed; + + if (i < 1) { + i = 1; + } + + if (FPS - Bmp[Guy.AnimationState].Speed < 0) { + loop = 2; + } else { + loop = 1; + } + + if (IsInBoat) { + loop = loop * 2; } - // sonstige Aktionen - if ((Guy.Zustand >= GUYSUCHEN) && (Guy.Zustand <= GUYSCHLEUDER) && - (Bmp[Guy.Zustand].Phase != Bmp[Guy.Zustand].Anzahl)) - { - i = LastBild / Bmp[Guy.Zustand].Geschwindigkeit; - if (i < 1) i = 1; - if (Bild % i == 0) - { - Bmp[Guy.Zustand].Phase++; - if (Bmp[Guy.Zustand].Phase >= Bmp[Guy.Zustand].Anzahl) - { - Bmp[Guy.Zustand].Phase = 0; - if (PapierText == -1) Guy.Aktiv = false; + + for (short k = 0; k < loop; k++) if ((CurrentFrame % i == 0) && (Guy.IsActive)) { + CalcGuyKoor(); + } + + return; + } + + // sonstige Aktionen + if ((Guy.AnimationState >= Tiles::GUY_SEARCH) && (Guy.AnimationState <= Tiles::GUY_SLINGSHOT) && + (Bmp[Guy.AnimationState].AnimationPhase != Bmp[Guy.AnimationState].AnimationPhaseCount)) { + i = FPS / Bmp[Guy.AnimationState].Speed; + + if (i < 1) { + i = 1; + } + + if (CurrentFrame % i == 0) { + Bmp[Guy.AnimationState].AnimationPhase++; + + if (Bmp[Guy.AnimationState].AnimationPhase >= Bmp[Guy.AnimationState].AnimationPhaseCount) { + Bmp[Guy.AnimationState].AnimationPhase = 0; + + if (PapierText == -1) { + Guy.IsActive = false; } } } } +} } // namespace Math diff --git a/src/Math.hpp b/src/Math.hpp index 30bc124..2f23d9d 100644 --- a/src/Math.hpp +++ b/src/Math.hpp @@ -4,17 +4,16 @@ #include "types.hpp" #include "extern.hpp" -namespace Math -{ - void AbspannCalc(); // Kalkuliert die Koordinaten für den Abspann - void CalcGuyKoor(); // Berechnet die neuen Koordinaten der Spielfigur - void CalcKoor(); // Bildschirmkoordinaten der Kacheln berechnnen; - void MouseInSpielflaeche(short Button, short Push, short xDiff, short yDiff); // Falls die Maus in der Spielfäche ist - void MouseInPanel(short Button, short Push); // Falls die Maus im Panel ist - bool InDreieck(short X, short Y, short X0, short Y0, short X1, short Y1, short X3, short Y3); - bool InRect(short x, short y, RECT rcRect); // Ist ein Punkt in einem Rechteck - void CalcRect(RECT rcBereich); // Beschneidet das BlitRechteck so, daß es nur innerhalb des Bereiches gemalt wird - bool LineIntersect(ZWEID LineStartPos, ZWEID Pos, bool store); // Für Pathfinding (Ist eine Gerade unterbrochen?) - void Animationen(); // Startet die einzelnen Animationen - void ButtAniAus(); // Schaltet alle Knopfanimationien aus (für MouseInPanel) +namespace Math { +void AbspannCalc(); // Kalkuliert die Koordinaten für den Abspann +void CalcGuyKoor(); // Berechnet die neuen Koordinaten der Spielfigur +void CalcKoor(); // Bildschirmkoordinaten der Kacheln berechnnen; +void UpdateMousePosition(short Button, short Push, short xDiff, short yDiff); // Falls die Maus in der Spielfäche ist +void MouseInPanel(short Button, short Push); // Falls die Maus im Panel ist +bool InTriangle(float X, float Y, float X0, float Y0, float X1, float Y1, float X3, float Y3); +bool InRect(short x, short y, RECT rcRect); // Ist ein Punkt in einem Rechteck +void CalcRect(RECT rcBereich); // Beschneidet das BlitRechteck so, daß es nur innerhalb des Bereiches gemalt wird +bool LineIntersect(Coordinate LineStartPos, Coordinate Pos, bool store); // Für Pathfinding (Ist eine Gerade unterbrochen?) +void Animationen(); // Startet die einzelnen Animationen +void ButtAniAus(); // Schaltet alle Knopfanimationien aus (für MouseInPanel) } // namespace Math diff --git a/src/Menu.hpp b/src/Menu.hpp index 2ba2204..2136e6d 100644 --- a/src/Menu.hpp +++ b/src/Menu.hpp @@ -1,12 +1,10 @@ #pragma once -namespace Menu -{ - enum Type : short - { - NONE = 0, - ACTION = 1, - BUILD = 2, - INVENTORY = 3, - }; +namespace Menu { +enum Type : short { + NONE = 0, + ACTION = 1, + BUILD = 2, + INVENTORY = 3, +}; } diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 54050de..31759d2 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -8,1146 +8,1197 @@ #include "Sound.hpp" #include "Routing.hpp" #include "World.hpp" +#include "Application.hpp" #include #include #include +#include -namespace Renderer +#include + +#define MB_LEFT sf::Mouse::Left; + +constexpr auto PI = 3.14159265358979323846; + +namespace Renderer { + +sf::Texture *createEmptyTexture(const size_t width, const size_t height, const sf::Color &color) { - double pi = 3.1415926535; // pi, was sonst - - void Fade(short RP, short GP, short BP) - { - for (short blackloop = 0; blackloop < 256; blackloop++) - { - DDGammaRamp.red[blackloop] = DDGammaOld.red[blackloop] * RP / 100; - DDGammaRamp.green[blackloop] = DDGammaOld.green[blackloop] * GP / 100; - DDGammaRamp.blue[blackloop] = DDGammaOld.blue[blackloop] * BP / 100; - } - lpDDGammaControl->SetGammaRamp(0, &DDGammaRamp); - } + printf("create empty: %lu %lu\n", width, height); + assert(width > 0 && height > 0); - void LimitScroll() - { - if (Camera.x < ScapeGrenze.left) - Camera.x = static_cast(ScapeGrenze.left); - if (Camera.x + rcSpielflaeche.right > ScapeGrenze.right) - Camera.x = static_cast(ScapeGrenze.right) - static_cast(rcSpielflaeche.right); - if (Camera.y < ScapeGrenze.top) - Camera.y = static_cast(ScapeGrenze.top); - if (Camera.y + rcSpielflaeche.bottom > ScapeGrenze.bottom) - Camera.y = static_cast(ScapeGrenze.bottom) - static_cast(rcSpielflaeche.bottom); + sf::Image image; + image.create(width, height, color); + printf("loda empty image: %d %d\n", image.getSize().x, image.getSize().y); + + sf::Texture *texture = new sf::Texture; + if (!texture->loadFromImage(image)) { + fprintf(stderr, "Failed to load texture from empty image width size %dx%d\n", image.getSize().x, image.getSize().y); + assert(false); } + return texture; - ZWEID GetKachel(short PosX, short PosY) - { - ZWEID Erg; - - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - // Die in Betracht kommenden Kacheln rausfinden - if ((PosX > Scape[x][y].xScreen) && (PosX < Scape[x][y].xScreen + KXPIXEL) && - (PosY > Scape[x][y].yScreen) && (PosY < Scape[x][y].yScreen + KYPIXEL)) - { - if ((Math::InDreieck(PosX, PosY, - Scape[x][y].xScreen + EckKoor[Scape[x][y].Typ][0].x, - Scape[x][y].yScreen + EckKoor[Scape[x][y].Typ][0].y, - Scape[x][y].xScreen + EckKoor[Scape[x][y].Typ][1].x, - Scape[x][y].yScreen + EckKoor[Scape[x][y].Typ][1].y, - Scape[x][y].xScreen + EckKoor[Scape[x][y].Typ][3].x, - Scape[x][y].yScreen + EckKoor[Scape[x][y].Typ][3].y)) || - (Math::InDreieck(PosX, PosY, - Scape[x][y].xScreen + EckKoor[Scape[x][y].Typ][2].x, - Scape[x][y].yScreen + EckKoor[Scape[x][y].Typ][2].y, - Scape[x][y].xScreen + EckKoor[Scape[x][y].Typ][1].x, - Scape[x][y].yScreen + EckKoor[Scape[x][y].Typ][1].y, - Scape[x][y].xScreen + EckKoor[Scape[x][y].Typ][3].x, - Scape[x][y].yScreen + EckKoor[Scape[x][y].Typ][3].y))) - { - Erg.x = x; - Erg.y = y; - return Erg; - } - } - } - Erg.x = -1; - Erg.y = -1; - return Erg; +} + +sf::Texture *loadTexture(const void *data, const size_t size, const sf::Color &mask) +{ + printf("Loading %lu bytes from %p...\n", size, data); + sf::Image image; + if (!image.loadFromMemory(data, size) || ! image.getSize().x) { + fprintf(stderr, "Failed to load bmp\n"); + return nullptr; } + printf("loda image: %d %d\n", image.getSize().x, image.getSize().y); - inline DWORD RGB2DWORD(BYTE r, BYTE g, BYTE b) - { - DWORD Erg; - - if (ddpf.dwRBitMask == 63488) - { - Erg = static_cast((r & 0xF8) >> 3); - Erg = Erg << 6; - Erg = Erg | static_cast((g & 0xFC) >> 2); - Erg = Erg << 5; - Erg = Erg | static_cast((b & 0xF8) >> 3); - } - else if (ddpf.dwRBitMask == 31744) - { - Erg = static_cast((r & 0xF8) >> 3); - Erg = Erg << 5; - Erg = Erg | static_cast((g & 0xF8) >> 3); - Erg = Erg << 5; - Erg = Erg | static_cast((b & 0xF8) >> 3); - } - else if (ddpf.dwRBitMask == 16711680) - { - Erg = static_cast(r & 0xFF); - Erg = Erg << 8; - Erg = Erg | static_cast(g & 0xFF); - Erg = Erg << 8; - Erg = Erg | static_cast(b & 0xFF); - } - else - { - Erg = 0; - MessageBeep(MB_OK); - } - return Erg; + image.createMaskFromColor(mask); + + sf::Texture *texture = new sf::Texture; + texture->loadFromImage(image); + if (!texture->loadFromImage(image)) { + fprintf(stderr, "Failed to load texture from image width size %dx%d\n", image.getSize().x, image.getSize().y); + assert(false); } + assert(texture->getSize().x > 0 && texture->getSize().y > 0); + return texture; +} - inline void DWORD2RGB(DWORD color) - { - if (ddpf.dwRBitMask == 63488) - { - rgbStruct.r = static_cast((color & 0xF800) >> 8); - rgbStruct.g = static_cast((color & 0x07E0) >> 3); - rgbStruct.b = static_cast((color & 0x001F) << 3); - } - else if (ddpf.dwRBitMask == 31744) - { - rgbStruct.r = static_cast((color & 0x7C00) >> 7); - rgbStruct.g = static_cast((color & 0x03E0) >> 2); - rgbStruct.b = static_cast((color & 0x001F) << 3); - } - else if (ddpf.dwRBitMask == 16711680) - { - rgbStruct.r = static_cast((color & 0xFF0000) >> 10); - rgbStruct.g = static_cast((color & 0x00FF00) >> 8); - rgbStruct.b = static_cast((color & 0x0000FF)); - } +void Fade(short RP, short GP, short BP) +{ + s_darknessColor.r = 255 * RP / 100; + s_darknessColor.g = 255 * GP / 100; + s_darknessColor.b = 255 * BP / 100; +} + +void LimitScroll() +{ + if (Camera.x < ScapeGrenze.left) { + Camera.x = static_cast(ScapeGrenze.left); } - void Blitten(LPDIRECTDRAWSURFACE4 lpDDSVon, LPDIRECTDRAWSURFACE4 lpDDSNach, bool Transp) - { - HRESULT hr; - short z = 0; + if (Camera.x + rcPlayingSurface.right > ScapeGrenze.right) { + Camera.x = static_cast(ScapeGrenze.right) - static_cast(rcPlayingSurface.right); + } - while (true) - { - z++; - hr = lpDDSNach->GetBltStatus(/*DDGBS_ISBLTDONE |*/ DDGBS_CANBLT); + if (Camera.y < ScapeGrenze.top) { + Camera.y = static_cast(ScapeGrenze.top); + } - if (hr == DD_OK) break; - Sleep(1); + if (Camera.y + rcPlayingSurface.bottom > ScapeGrenze.bottom) { + Camera.y = static_cast(ScapeGrenze.bottom) - static_cast(rcPlayingSurface.bottom); + } +} - if (z == 1000) - { - MessageBeep(MB_OK); - break; +Coordinate GetTile(short PosX, short PosY) +{ + for (short y = 0; y < MAX_TILESY; y++) { + for (short x = 0; x < MAX_TILES_X; x++) { + // Die in Betracht kommenden Kacheln rausfinden + if ((PosX > Landscape[x][y].xScreen) && (PosX < Landscape[x][y].xScreen + TILE_SIZE_X) && + (PosY > Landscape[x][y].yScreen) && (PosY < Landscape[x][y].yScreen + TILE_SIZE_Y)) { + if ((Math::InTriangle(PosX, PosY, + Landscape[x][y].xScreen + CornerCoord[Landscape[x][y].Type][0].x, + Landscape[x][y].yScreen + CornerCoord[Landscape[x][y].Type][0].y, + Landscape[x][y].xScreen + CornerCoord[Landscape[x][y].Type][1].x, + Landscape[x][y].yScreen + CornerCoord[Landscape[x][y].Type][1].y, + Landscape[x][y].xScreen + CornerCoord[Landscape[x][y].Type][3].x, + Landscape[x][y].yScreen + CornerCoord[Landscape[x][y].Type][3].y)) || + (Math::InTriangle(PosX, PosY, + Landscape[x][y].xScreen + CornerCoord[Landscape[x][y].Type][2].x, + Landscape[x][y].yScreen + CornerCoord[Landscape[x][y].Type][2].y, + Landscape[x][y].xScreen + CornerCoord[Landscape[x][y].Type][1].x, + Landscape[x][y].yScreen + CornerCoord[Landscape[x][y].Type][1].y, + Landscape[x][y].xScreen + CornerCoord[Landscape[x][y].Type][3].x, + Landscape[x][y].yScreen + CornerCoord[Landscape[x][y].Type][3].y))) { + return {x, y}; + } } } + } + return {-1, -1}; +} - while (true) - { - z++; - if (Transp) hr = lpDDSNach->Blt(&rcRectdes, lpDDSVon, &rcRectsrc, DDBLT_KEYSRC | DDBLT_WAIT, nullptr); - else hr = lpDDSNach->Blt(&rcRectdes, lpDDSVon, &rcRectsrc, DDBLT_WAIT, nullptr); - if (hr != DDERR_WASSTILLDRAWING) - break; - if (z == 1000) - { - MessageBeep(MB_OK); - break; - } - } +void BlitToText(sf::Texture *from) +{ + sf::IntRect srcrect; + srcrect.left = rcRectsrc.left; + srcrect.top = rcRectsrc.top; + srcrect.width = rcRectsrc.right - rcRectsrc.left; + srcrect.height = rcRectsrc.bottom - rcRectsrc.top; + + int dstWidth = rcRectdes.right - rcRectdes.left; + int dstHeight = rcRectdes.bottom - rcRectdes.top; + srcrect.width = std::min(dstWidth, srcrect.width); + srcrect.height = std::min(dstHeight, srcrect.height); + + assert(srcrect.width > 0 && srcrect.height > 0); + if (srcrect.width <= 0 || srcrect.height <= 0) { + return; + } + sf::Sprite sprite; + sprite.setTexture(*from); + sprite.setPosition(rcRectdes.left, rcRectdes.top); + sprite.setTextureRect(srcrect); + Application::drawToText(sprite); +} + +void BlitToScreen(sf::Texture *from) +{ + sf::IntRect srcrect; + srcrect.left = rcRectsrc.left; + srcrect.top = rcRectsrc.top; + srcrect.width = rcRectsrc.right - rcRectsrc.left; + srcrect.height = rcRectsrc.bottom - rcRectsrc.top; + + int dstWidth = rcRectdes.right - rcRectdes.left; + int dstHeight = rcRectdes.bottom - rcRectdes.top; + + if (dstWidth > 0 && dstHeight > 0) { + srcrect.width = std::min(dstWidth, srcrect.width); + srcrect.height = std::min(dstHeight, srcrect.height); } - void PutPixel(short x, short y, DWORD color, LPDDSURFACEDESC2 ddsd) - { - WORD* pixels = static_cast(ddsd->lpSurface); - // DWORD pitch = ddsd->dwWidth+2; - DWORD pitch = ddsd->lPitch >> 1; - pixels[y * pitch + x * 2] = static_cast(color); + if (srcrect.width <= 0 || srcrect.height <= 0) { + return; + } + sf::Sprite sprite; + sprite.setTexture(*from); + sprite.setPosition(rcRectdes.left, rcRectdes.top); + sprite.setTextureRect(srcrect); + Application::drawSprite(sprite); +} + +void BlitToLandscape(sf::Texture *from) +{ + sf::IntRect srcrect(rcRectsrc.left, rcRectsrc.top, rcRectsrc.right - rcRectsrc.left, rcRectsrc.bottom - rcRectsrc.top); + assert(srcrect.width > 0 && srcrect.height > 0); + if (srcrect.width <= 0 || srcrect.height <= 0) { + return; + } + sf::Sprite sprite; + sprite.setTexture(*from); + sprite.setPosition(rcRectdes.left, rcRectdes.top); + sprite.setTextureRect(srcrect); + Application::drawToLandscape(sprite); +} + +void PutPixel(short x, short y, uint8_t r, uint8_t g, uint8_t b, sf::Image *img) +{ + if (x < 0 || y < 0 || x >= int(img->getSize().x) || y >= int(img->getSize().y)) { + return; + } + if (!img) { + return; } + img->setPixel(x, y, {r, g, b}); +// WORD *pixels = static_cast(ddsd->lpSurface); +// // DWORD pitch = ddsd->dwWidth+2; +// DWORD pitch = ddsd->lPitch >> 1; +// pixels[y * pitch + x * 2] = static_cast(color); +} + +RGBSTRUCT GetPixel(short x, short y, sf::Image *img) +{ +// WORD *pixels = static_cast(ddsd->lpSurface); +// // DWORD pitch = ddsd->dwWidth; +// DWORD pitch = ddsd->lPitch >> 1; +// DWORD color = pixels[y * pitch + x * 2]; - void GetPixel(short x, short y, LPDDSURFACEDESC2 ddsd) - { - WORD* pixels = static_cast(ddsd->lpSurface); - // DWORD pitch = ddsd->dwWidth; - DWORD pitch = ddsd->lPitch >> 1; - DWORD color = pixels[y * pitch + x * 2]; + RGBSTRUCT rgbStruct; - DWORD2RGB(color); + // TODO: more efficient + if (x < 0 || y < 0 || x >= int(img->getSize().x) || y >= int(img->getSize().y)) { + rgbStruct.r = 0; + return{}; + } + if (!img) { + return{}; } - void ZeichneBilder(short x, short y, short i, RECT Ziel, bool Reverse, short Frucht) - { - short Phase; + sf::Color c = img->getPixel(x, y); + rgbStruct.r = c.r; + rgbStruct.g = c.g; + rgbStruct.b = c.b; - if (Frucht == -1) Phase = Bmp[i].Phase; - else Phase = Frucht; - rcRectsrc = Bmp[i].rcSrc; - if (!Reverse) - { - rcRectsrc.top += Phase * (Bmp[i].Hoehe); - } - else - { - rcRectsrc.top = Bmp[i].rcSrc.top + (Bmp[i].Anzahl - 1) * Bmp[i].Hoehe - Phase * Bmp[i].Hoehe; - } - rcRectsrc.bottom = rcRectsrc.top + (Bmp[i].Hoehe); - rcRectdes.left = x; - rcRectdes.top = y; - rcRectdes.right = x + (Bmp[i].Breite); - rcRectdes.bottom = y + (Bmp[i].Hoehe); - Math::CalcRect(Ziel); - Blitten(Bmp[i].Surface, lpDDSBack, true); + return rgbStruct; +} + +void DrawPicture(short x, short y, short i, RECT target, bool Reverse, short Fruit) +{ + short Phase; + + if (Fruit == -1) { + Phase = Bmp[i].AnimationPhase; + } else { + Phase = Fruit; } - void ZeichneObjekte() - { - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - bool Guyzeichnen = false; - if ((Guy.Pos.x == x) && (Guy.Pos.y == y)) Guyzeichnen = true; - // Die nichtsichbaren Kacheln (oder nicht betroffenen) ausfiltern - - if (!((Scape[x][y].xScreen > Camera.x + rcSpielflaeche.left - KXPIXEL) && - (Scape[x][y].xScreen < Camera.x + rcSpielflaeche.right + KXPIXEL) && - (Scape[x][y].yScreen > Camera.y + rcSpielflaeche.top - KYPIXEL) && - (Scape[x][y].yScreen < Camera.y + rcSpielflaeche.bottom + KYPIXEL) && - (Scape[x][y].Entdeckt) && - ((Scape[x][y].Markiert) || (Scape[x][y].Objekt != -1) || (Guyzeichnen)))) - continue; - - if (Scape[x][y].Markiert) // Die Rahmen um die markierten Kacheln malen - { - rcRectsrc.left = KXPIXEL * Scape[x][y].Typ; - rcRectsrc.right = KXPIXEL * Scape[x][y].Typ + KXPIXEL; - rcRectsrc.top = 2 * KYPIXEL; - rcRectsrc.bottom = 3 * KYPIXEL; - rcRectdes.left = Scape[x][y].xScreen - Camera.x; - rcRectdes.right = rcRectdes.left + KXPIXEL; - rcRectdes.top = Scape[x][y].yScreen - Camera.y; - rcRectdes.bottom = rcRectdes.top + KYPIXEL; - Math::CalcRect(rcSpielflaeche); - Blitten(lpDDSMisc, lpDDSBack, true); - } - // Landschaftsanimationen malen (und Feld) - if ((Scape[x][y].Objekt != -1) && (LAnimation) && - ((Scape[x][y].Objekt <= SCHLEUSE6)) - || (Scape[x][y].Objekt == FELD) // Der Guy ist immer vor diesen Objekten - || (Scape[x][y].Objekt == ROHR) - || (Scape[x][y].Objekt == SOS)) - { - // Sound abspielen - if (Scape[x][y].Objekt != -1 && + rcRectsrc = Bmp[i].sourceRect; + if (i == Tiles::TENT) { + printf("tent: %d, phase: %d, tent: %d\n", i, Phase, Tiles::TENT); + } + + + if (!Reverse) { + rcRectsrc.top += Phase * (Bmp[i].Height); + } else { + rcRectsrc.top = Bmp[i].sourceRect.top + (Bmp[i].AnimationPhaseCount - 1) * Bmp[i].Height - Phase * Bmp[i].Height; + } + + rcRectsrc.bottom = rcRectsrc.top + (Bmp[i].Height); + rcRectdes.left = x; + rcRectdes.top = y; + rcRectdes.right = x + (Bmp[i].Width); + rcRectdes.bottom = y + (Bmp[i].Height); + Math::CalcRect(target); + BlitToScreen(Bmp[i].Surface); +} + +void DrawObjects() +{ + for (short y = 0; y < MAX_TILESY; y++) { + for (short x = 0; x < MAX_TILES_X; x++) { + bool drawGuy = false; + + if ((Guy.Pos.x == x) && (Guy.Pos.y == y)) { + drawGuy = true; + } + + // Filter out the invisible tiles (or unaffected) + + if (!((Landscape[x][y].xScreen > Camera.x + rcPlayingSurface.left - TILE_SIZE_X) && + (Landscape[x][y].xScreen < Camera.x + rcPlayingSurface.right + TILE_SIZE_X) && + (Landscape[x][y].yScreen > Camera.y + rcPlayingSurface.top - TILE_SIZE_Y) && + (Landscape[x][y].yScreen < Camera.y + rcPlayingSurface.bottom + TILE_SIZE_Y) && + (Landscape[x][y].Discovered) && + ((Landscape[x][y].Marked) || (Landscape[x][y].Object != -1) || (drawGuy)))) { + continue; + } + + if (Landscape[x][y].Marked) { // Paint the frames around the marked tiles + rcRectsrc.left = TILE_SIZE_X * Landscape[x][y].Type; + rcRectsrc.right = TILE_SIZE_X * Landscape[x][y].Type + TILE_SIZE_X; + rcRectsrc.top = 2 * TILE_SIZE_Y; + rcRectsrc.bottom = 3 * TILE_SIZE_Y; + rcRectdes.left = Landscape[x][y].xScreen - Camera.x; + rcRectdes.right = rcRectdes.left + TILE_SIZE_X; + rcRectdes.top = Landscape[x][y].yScreen - Camera.y; + rcRectdes.bottom = rcRectdes.top + TILE_SIZE_Y; + Math::CalcRect(rcPlayingSurface); + BlitToScreen(lpDDSMisc); + } + + // paint landscape animations (and field) + if ((Landscape[x][y].Object != -1) && (LAnimation) && + (((Landscape[x][y].Object <= Tiles::FLOODGATE_6)) + || (Landscape[x][y].Object == Tiles::FIELD) // Der Guy ist immer vor diesen Objecten + || (Landscape[x][y].Object == Tiles::PIPE) + || (Landscape[x][y].Object == Tiles::SOS))) { + // Sound abspielen + if ( ((Guy.Pos.x - 1 <= x) && (x <= Guy.Pos.x + 1)) && - ((Guy.Pos.y - 1 <= y) && (y <= Guy.Pos.y + 1))) - { - if ((x == Guy.Pos.x) && (y == Guy.Pos.y)) - Sound::PlaySound(Bmp[Scape[x][y].Objekt].Sound, 100); - else if (Bmp[Scape[x][y].Objekt].Sound != Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Sound) - Sound::PlaySound(Bmp[Scape[x][y].Objekt].Sound, 90); + ((Guy.Pos.y - 1 <= y) && (y <= Guy.Pos.y + 1))) { + if ((x == Guy.Pos.x) && (y == Guy.Pos.y)) { + Sound::PlaySound(Bmp[Landscape[x][y].Object].Sound, 100); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1 || Bmp[Landscape[x][y].Object].Sound != Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Sound) { + Sound::PlaySound(Bmp[Landscape[x][y].Object].Sound, 90); } - - ZeichneBilder(Scape[x][y].xScreen + Scape[x][y].ObPos.x - Camera.x, - Scape[x][y].yScreen + Scape[x][y].ObPos.y - Camera.y, - Scape[x][y].Objekt, rcSpielflaeche, Scape[x][y].Reverse, - static_cast(Scape[x][y].Phase)); } - else - { - if (((Scape[x][y].Objekt >= BAUM1) && (Scape[x][y].Objekt <= BAUM4DOWN)) || - (Scape[x][y].Objekt == BAUMGROSS) || (Scape[x][y].Objekt == FEUER) || - (Scape[x][y].Objekt == WRACK) || (Scape[x][y].Objekt == WRACK2) || - (Scape[x][y].Objekt >= ZELT)) // Bäume und Früchte (und alle anderen Objekte) malen - { - // Sound abspielen - if (Scape[x][y].Objekt != -1 && + + DrawPicture(Landscape[x][y].xScreen + Landscape[x][y].ObjectPosOffset.x - Camera.x, + Landscape[x][y].yScreen + Landscape[x][y].ObjectPosOffset.y - Camera.y, + Landscape[x][y].Object, rcPlayingSurface, Landscape[x][y].ReverseAnimation, + static_cast(Landscape[x][y].AnimationPhase)); + } else { + if ((((Landscape[x][y].Object >= Tiles::TREE_1) && (Landscape[x][y].Object <= Tiles::TREE_DOWN_4))) || + (Landscape[x][y].Object == Tiles::TREE_BIG) || (Landscape[x][y].Object == Tiles::FIRE) || + (Landscape[x][y].Object == Tiles::WRECK_1) || (Landscape[x][y].Object == Tiles::WRECK_2) || + (Landscape[x][y].Object >= Tiles::TENT)) { // Bäume und Früchte (und alle anderen Objecte) malen + // Sound abspielen + if (Landscape[x][y].Object != -1 && ((Guy.Pos.x - 1 <= x) && (x <= Guy.Pos.x + 1)) && - ((Guy.Pos.y - 1 <= y) && (y <= Guy.Pos.y + 1))) - { - if ((x == Guy.Pos.x) && (y == Guy.Pos.y)) - Sound::PlaySound(Bmp[Scape[x][y].Objekt].Sound, 100); - else if (Bmp[Scape[x][y].Objekt].Sound != Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Sound) - Sound::PlaySound(Bmp[Scape[x][y].Objekt].Sound, 90); - } - if (Guyzeichnen) - { - if ((Guy.PosScreen.y) < (Scape[x][y].yScreen + Scape[x][y].ObPos.y - + Bmp[Scape[x][y].Objekt].Hoehe)) - { - ZeichneGuy(); - Guyzeichnen = false; - } + ((Guy.Pos.y - 1 <= y) && (y <= Guy.Pos.y + 1))) { + if ((x == Guy.Pos.x) && (y == Guy.Pos.y)) { + Sound::PlaySound(Bmp[Landscape[x][y].Object].Sound, 100); + } else if (Landscape[Guy.Pos.x][Guy.Pos.y].Object == -1 || Bmp[Landscape[x][y].Object].Sound != Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].Sound) { + Sound::PlaySound(Bmp[Landscape[x][y].Object].Sound, 90); } + } - ZeichneBilder(Scape[x][y].xScreen + Scape[x][y].ObPos.x - Camera.x, - Scape[x][y].yScreen + Scape[x][y].ObPos.y - Camera.y, - Scape[x][y].Objekt, rcSpielflaeche, false, - static_cast(Scape[x][y].Phase)); + if (drawGuy) { + if ((Guy.ScreenPosition.y) < (Landscape[x][y].yScreen + Landscape[x][y].ObjectPosOffset.y + + Bmp[Landscape[x][y].Object].Height)) { + DrawGuy(); + drawGuy = false; + } } + + DrawPicture(Landscape[x][y].xScreen + Landscape[x][y].ObjectPosOffset.x - Camera.x, + Landscape[x][y].yScreen + Landscape[x][y].ObjectPosOffset.y - Camera.y, + Landscape[x][y].Object, rcPlayingSurface, false, + static_cast(Landscape[x][y].AnimationPhase)); } - if (Guyzeichnen) ZeichneGuy(); } - } - void ZeichneGuy() - { - if (BootsFahrt) - { - if (Guy.Zustand == GUYSCHIFF) - { - ZeichneBilder(Guy.PosScreen.x - 30 - Camera.x, - Guy.PosScreen.y - 28 - Camera.y, - Guy.Zustand, rcSpielflaeche, false, -1); - } - else - { - ZeichneBilder(Guy.PosScreen.x - (Bmp[Guy.Zustand].Breite) / 2 - Camera.x, - Guy.PosScreen.y - (Bmp[Guy.Zustand].Hoehe) / 2 - Camera.y, - Guy.Zustand, rcSpielflaeche, false, -1); + if (drawGuy) { + DrawGuy(); } } - else - ZeichneBilder(Guy.PosScreen.x - (Bmp[Guy.Zustand].Breite) / 2 - Camera.x, - Guy.PosScreen.y - (Bmp[Guy.Zustand].Hoehe) - Camera.y, - Guy.Zustand, rcSpielflaeche, false, -1); - // Sound abspielen - if (Guy.Aktiv) Sound::PlaySound(Bmp[Guy.Zustand].Sound, 100); } +} - void ZeichnePapier() - { - rcRectsrc.left = 0; - rcRectsrc.top = 0; - rcRectsrc.right = 464; - rcRectsrc.bottom = 77; - rcRectdes.left = TextBereich[TXTPAPIER].rcText.left - 60; - rcRectdes.top = TextBereich[TXTPAPIER].rcText.top - 30; - rcRectdes.right = rcRectdes.left + 464; - rcRectdes.bottom = rcRectdes.top + 77; - Blitten(lpDDSPapier, lpDDSBack, true); - rcRectdes.left = rcRectdes.left + 34; - rcRectdes.top = rcRectdes.top + 77; - rcRectdes.right = rcRectdes.right; - rcRectdes.bottom = TextBereich[TXTPAPIER].rcText.top + PapierText; - ddbltfx.dwFillColor = RGB2DWORD(236, 215, 179); - lpDDSBack->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - rcRectsrc.left = 0; - rcRectsrc.top = 77; - rcRectsrc.right = 464; - rcRectsrc.bottom = 154; - rcRectdes.left = TextBereich[TXTPAPIER].rcText.left - 60; - rcRectdes.top = rcRectdes.bottom - 47; - rcRectdes.right = rcRectdes.left + 464; - rcRectdes.bottom = rcRectdes.top + 77; - Blitten(lpDDSPapier, lpDDSBack, true); +void DrawGuy() +{ + if (IsInBoat) { + if (Guy.AnimationState == Tiles::GUY_SHIP) { + DrawPicture(Guy.ScreenPosition.x - 30 - Camera.x, + Guy.ScreenPosition.y - 28 - Camera.y, + Guy.AnimationState, rcPlayingSurface, false, -1); + } else { + DrawPicture(Guy.ScreenPosition.x - (Bmp[Guy.AnimationState].Width) / 2 - Camera.x, + Guy.ScreenPosition.y - (Bmp[Guy.AnimationState].Height) / 2 - Camera.y, + Guy.AnimationState, rcPlayingSurface, false, -1); + } + } else + DrawPicture(Guy.ScreenPosition.x - (Bmp[Guy.AnimationState].Width) / 2 - Camera.x, + Guy.ScreenPosition.y - (Bmp[Guy.AnimationState].Height) - Camera.y, + Guy.AnimationState, rcPlayingSurface, false, -1); + + // Sound abspielen + if (Guy.IsActive) { + Sound::PlaySound(Bmp[Guy.AnimationState].Sound, 100); } +} - void ZeichnePanel() - { - // Karte - rcRectsrc.left = 0; - rcRectsrc.top = 0; - rcRectsrc.right = 2 * MAXXKACH; - rcRectsrc.bottom = 2 * MAXYKACH; - rcRectdes.left = rcKarte.left; - rcRectdes.top = rcKarte.top; - rcRectdes.right = rcKarte.right; - rcRectdes.bottom = rcKarte.bottom; - Blitten(lpDDSKarte, lpDDSBack, false); - - // Spielfigur - rcRectdes.left = rcKarte.left + 2 * Guy.Pos.x; - rcRectdes.top = rcKarte.top + 2 * Guy.Pos.y; - rcRectdes.right = rcRectdes.left + 2; - rcRectdes.bottom = rcRectdes.top + 2; - ddbltfx.dwFillColor = RGB2DWORD(255, 0, 0); - lpDDSBack->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - - // Position einmalen - rcRectsrc.left = 205; - rcRectsrc.top = 0; - rcRectsrc.right = 205 + 65; - rcRectsrc.bottom = 0 + 65; - rcRectdes.left = rcKarte.left + (Camera.x + 2 * Camera.y) / (KXPIXEL / 2) - MAXXKACH - 2; - rcRectdes.top = rcKarte.top + (2 * Camera.y - Camera.x) / (KXPIXEL / 2) + MAXYKACH - 21 - 2; - rcRectdes.right = rcRectdes.left + 65; - rcRectdes.bottom = rcRectdes.top + 65; - Math::CalcRect(rcKarte); - Blitten(lpDDSPanel, lpDDSBack, true); - - // Panel malen - rcRectsrc.left = 0; - rcRectsrc.top = 0; - rcRectsrc.right = 205; - rcRectsrc.bottom = 720; - rcRectdes.left = rcPanel.left; - rcRectdes.top = rcPanel.top; - rcRectdes.right = rcPanel.right; - rcRectdes.bottom = rcPanel.bottom; - Blitten(lpDDSPanel, lpDDSBack, true); - - // Gitternetzknopf - if (Gitter) Bmp[BUTTGITTER].Phase = 1; - else Bmp[BUTTGITTER].Phase = 0; - ZeichneBilder(static_cast(Bmp[BUTTGITTER].rcDes.left), - static_cast(Bmp[BUTTGITTER].rcDes.top), - BUTTGITTER, rcPanel, false, -1); - - // SOUNDknopf - if ((Soundzustand == 0) || (Soundzustand == -1)) Bmp[BUTTSOUND].Phase = 1; - else Bmp[BUTTSOUND].Phase = 0; - ZeichneBilder(static_cast(Bmp[BUTTSOUND].rcDes.left), - static_cast(Bmp[BUTTSOUND].rcDes.top), - BUTTSOUND, rcPanel, false, -1); - - // ANIMATIONknopf - if (!LAnimation) Bmp[BUTTANIMATION].Phase = 1; - else Bmp[BUTTANIMATION].Phase = 0; - ZeichneBilder(static_cast(Bmp[BUTTANIMATION].rcDes.left), - static_cast(Bmp[BUTTANIMATION].rcDes.top), - BUTTANIMATION, rcPanel, false, -1); - - // BEENDENknopf - ZeichneBilder(static_cast(Bmp[BUTTBEENDEN].rcDes.left), - static_cast(Bmp[BUTTBEENDEN].rcDes.top), - BUTTBEENDEN, rcPanel, false, -1); - - // NEUknopf - ZeichneBilder(static_cast(Bmp[BUTTNEU].rcDes.left), - static_cast(Bmp[BUTTNEU].rcDes.top), - BUTTNEU, rcPanel, false, -1); - - // TAGNEUknopf - ZeichneBilder(static_cast(Bmp[BUTTTAGNEU].rcDes.left), - static_cast(Bmp[BUTTTAGNEU].rcDes.top), - BUTTTAGNEU, rcPanel, false, -1); - - // Aktionsknopf - if (HauptMenue == Menu::ACTION) Bmp[BUTTAKTION].Phase = Bmp[BUTTAKTION].Anzahl; - else if (Bmp[BUTTAKTION].Phase == Bmp[BUTTAKTION].Anzahl) Bmp[BUTTAKTION].Phase = 0; - ZeichneBilder(static_cast(Bmp[BUTTAKTION].rcDes.left), - static_cast(Bmp[BUTTAKTION].rcDes.top), - BUTTAKTION, rcPanel, false, -1); - - // BauKnopf - if (HauptMenue == Menu::BUILD) Bmp[BUTTBAUEN].Phase = Bmp[BUTTBAUEN].Anzahl; - else if (Bmp[BUTTBAUEN].Phase == Bmp[BUTTBAUEN].Anzahl) Bmp[BUTTBAUEN].Phase = 0; - ZeichneBilder(static_cast(Bmp[BUTTBAUEN].rcDes.left), - static_cast(Bmp[BUTTBAUEN].rcDes.top), - BUTTBAUEN, rcPanel, false, -1); - - // Inventarknopf - if (HauptMenue == Menu::INVENTORY) Bmp[BUTTINVENTAR].Phase = Bmp[BUTTINVENTAR].Anzahl; - else if (Bmp[BUTTINVENTAR].Phase == Bmp[BUTTINVENTAR].Anzahl) Bmp[BUTTINVENTAR].Phase = 0; - ZeichneBilder(static_cast(Bmp[BUTTINVENTAR].rcDes.left), - static_cast(Bmp[BUTTINVENTAR].rcDes.top), - BUTTINVENTAR, rcPanel, false, -1); - - // WEITERknopf - if (Bmp[BUTTWEITER].Phase != -1) - ZeichneBilder(static_cast(Bmp[BUTTWEITER].rcDes.left), - static_cast(Bmp[BUTTWEITER].rcDes.top), - BUTTWEITER, rcPanel, false, -1); - - // STOPknopf - if (Bmp[BUTTSTOP].Phase != -1) - ZeichneBilder(static_cast(Bmp[BUTTSTOP].rcDes.left), - static_cast(Bmp[BUTTSTOP].rcDes.top), - BUTTSTOP, rcPanel, false, -1); - - // ABLEGENknopf - if (Bmp[BUTTABLEGEN].Phase != -1) - ZeichneBilder(static_cast(Bmp[BUTTABLEGEN].rcDes.left), - static_cast(Bmp[BUTTABLEGEN].rcDes.top), - BUTTABLEGEN, rcPanel, false, -1); - - // Welches Menü zeichnen? - switch (HauptMenue) - { - case Menu::ACTION: - for (short i = BUTTSUCHEN; i <= BUTTSCHLEUDER; i++) - { - if (Bmp[i].Phase == -1) - { - ZeichneBilder(static_cast(Bmp[i].rcDes.left), - static_cast(Bmp[i].rcDes.top), - BUTTFRAGEZ, rcPanel, false, -1); - continue; - } - ZeichneBilder(static_cast(Bmp[i].rcDes.left), - static_cast(Bmp[i].rcDes.top), - i, rcPanel, false, -1); - } - break; - case Menu::BUILD: - for (short i = BUTTZELT; i <= BUTTDESTROY; i++) - { - if (Bmp[i].Phase == -1) - { - ZeichneBilder(static_cast(Bmp[i].rcDes.left), - static_cast(Bmp[i].rcDes.top), - BUTTFRAGEZ, rcPanel, false, -1); - continue; - } - ZeichneBilder(static_cast(Bmp[i].rcDes.left), - static_cast(Bmp[i].rcDes.top), - i, rcPanel, false, -1); - } - break; - case Menu::INVENTORY: - ZeichneBilder(static_cast(Bmp[INVPAPIER].rcDes.left), - static_cast(Bmp[INVPAPIER].rcDes.top), - INVPAPIER, rcPanel, false, -1); - for (short i = ROHAST; i <= ROHSCHLEUDER; i++) - { - if (Guy.Inventar[i] <= 0) continue; - ZeichneBilder(static_cast(Bmp[i].rcDes.left), - static_cast(Bmp[i].rcDes.top), - i, rcPanel, false, -1); - Bmp[ROEMISCH1].rcDes.top = Bmp[i].rcDes.top; - Bmp[ROEMISCH2].rcDes.top = Bmp[i].rcDes.top; - for (short j = 1; j <= Guy.Inventar[i]; j++) - { - if (j < 5) - { - ZeichneBilder(static_cast(Bmp[i].rcDes.left) + 20 + j * 4, - static_cast(Bmp[ROEMISCH1].rcDes.top), - ROEMISCH1, rcPanel, false, -1); - } - else if (j == 5) - ZeichneBilder(static_cast(Bmp[i].rcDes.left) + 23, - static_cast(Bmp[ROEMISCH2].rcDes.top), - ROEMISCH2, rcPanel, false, -1); - else if ((j > 5) && (j < 10)) - { - ZeichneBilder(static_cast(Bmp[i].rcDes.left) + 20 + j * 4, - static_cast(Bmp[ROEMISCH1].rcDes.top), - ROEMISCH1, rcPanel, false, -1); - } - else if (j == 10) - ZeichneBilder(static_cast(Bmp[i].rcDes.left) + 43, - static_cast(Bmp[ROEMISCH2].rcDes.top), - ROEMISCH2, rcPanel, false, -1); - } - } - break; - } +void DrawPaper() +{ + rcRectsrc.left = 0; + rcRectsrc.top = 0; + rcRectsrc.right = 464; + rcRectsrc.bottom = 77; + rcRectdes.left = TextBereich[TXTPAPIER].textRect.left - 60; + rcRectdes.top = TextBereich[TXTPAPIER].textRect.top - 30; + rcRectdes.right = rcRectdes.left + 464; + rcRectdes.bottom = rcRectdes.top + 77; + BlitToScreen(lpDDSPaper); + + rcRectdes.left = rcRectdes.left + 34; + rcRectdes.top = rcRectdes.top + 77; + rcRectdes.right = rcRectdes.right + 0; + rcRectdes.bottom = TextBereich[TXTPAPIER].textRect.top + PapierText; + + // TODO: check that this works + sf::RectangleShape rect(sf::Vector2f(rcRectdes.right - rcRectdes.left, rcRectdes.bottom - rcRectdes.top)); + rect.setFillColor(sf::Color(236, 215, 179)); + rect.setPosition(rcRectdes.left, rcRectdes.top); + Application::drawToScreen(rect); + + rcRectsrc.left = 0; + rcRectsrc.top = 77; + rcRectsrc.right = 464; + rcRectsrc.bottom = 154; + rcRectdes.left = TextBereich[TXTPAPIER].textRect.left - 60; + rcRectdes.top = rcRectdes.bottom - 47; + rcRectdes.right = rcRectdes.left + 464; + rcRectdes.bottom = rcRectdes.top + 77; + BlitToScreen(lpDDSPaper); +} + +void DrawPanel() +{ + // Karte + rcRectsrc.left = 0; + rcRectsrc.top = 0; + rcRectsrc.right = 2 * MAX_TILES_X; + rcRectsrc.bottom = 2 * MAX_TILESY; + rcRectdes.left = rcKarte.left; + rcRectdes.top = rcKarte.top; + rcRectdes.right = rcKarte.right; + rcRectdes.bottom = rcKarte.bottom; + BlitToScreen(lpDDSKarte); +// Blit(lpDDSKarte, lpDDSBack, false); + + // Spielfigur + sf::RectangleShape rect(sf::Vector2f(2, 2)); + rect.setFillColor(sf::Color::Red); + rect.setPosition(rcKarte.left + 2 * Guy.Pos.x, rcKarte.top + 2 * Guy.Pos.y); + Application::drawToScreen(rect); + + // Position einmalen + rcRectsrc.left = 205; + rcRectsrc.top = 0; + rcRectsrc.right = 205 + 65; + rcRectsrc.bottom = 0 + 65; + rcRectdes.left = rcKarte.left + (Camera.x + 2 * Camera.y) / (TILE_SIZE_X / 2) - MAX_TILES_X - 2; + rcRectdes.top = rcKarte.top + (2 * Camera.y - Camera.x) / (TILE_SIZE_X / 2) + MAX_TILESY - 21 - 2; + rcRectdes.right = rcRectdes.left + 65; + rcRectdes.bottom = rcRectdes.top + 65; + Math::CalcRect(rcKarte); + BlitToScreen(lpDDSPanel); + + // Panel malen + rcRectsrc.left = 0; + rcRectsrc.top = 0; + rcRectsrc.right = 205; + rcRectsrc.bottom = 720; + rcRectdes.left = rcPanel.left; + rcRectdes.top = rcPanel.top; + rcRectdes.right = rcPanel.right; + rcRectdes.bottom = rcPanel.bottom; + BlitToScreen(lpDDSPanel); + + // Gitternetzknopf + if (Gitter) { + Bmp[Tiles::BUTTON_GRID].AnimationPhase = 1; + } else { + Bmp[Tiles::BUTTON_GRID].AnimationPhase = 0; + } - // Säule1 - short i = Bmp[SAEULE1].Hoehe - static_cast(Guy.Resource[WASSER]) * Bmp[SAEULE1].Hoehe / 100; - rcRectsrc = Bmp[SAEULE1].rcSrc; - rcRectsrc.top += i; - rcRectdes = Bmp[SAEULE1].rcDes; - rcRectdes.top += i; - Blitten(Bmp[SAEULE1].Surface, lpDDSBack, true); - - // Säule2 - i = Bmp[SAEULE2].Hoehe - static_cast(Guy.Resource[NAHRUNG]) * Bmp[SAEULE2].Hoehe / 100; - rcRectsrc = Bmp[SAEULE2].rcSrc; - rcRectsrc.top += i; - rcRectdes = Bmp[SAEULE2].rcDes; - rcRectdes.top += i; - Blitten(Bmp[SAEULE2].Surface, lpDDSBack, true); - - // Säule3 - i = Bmp[SAEULE3].Hoehe - static_cast(Guy.Resource[GESUNDHEIT]) * Bmp[SAEULE3].Hoehe / 100; - rcRectsrc = Bmp[SAEULE3].rcSrc; - rcRectsrc.top += i; - rcRectdes = Bmp[SAEULE3].rcDes; - rcRectdes.top += i; - Blitten(Bmp[SAEULE3].Surface, lpDDSBack, true); - - // Sonnenanzeige - short diffx = (static_cast(Bmp[SONNE].rcDes.right) - static_cast(Bmp[SONNE].rcDes.left) - Bmp[SONNE].Breite) / 2; - short diffy = static_cast(Bmp[SONNE].rcDes.bottom) - static_cast(Bmp[SONNE].rcDes.top) - Bmp[SONNE].Hoehe / 2; - short TagesZeit = (Stunden * 10 + Minuten * 10 / 60); - - ZeichneBilder(static_cast(Bmp[SONNE].rcDes.left + diffx * cos(pi - pi * TagesZeit / 120) + diffx), - static_cast(Bmp[SONNE].rcDes.top + (-diffy * sin(pi - pi * TagesZeit / 120) + diffy)), - SONNE, Bmp[SONNE].rcDes, false, -1); - - // Rettungsring - short Ringtmp; - if (Chance < 100) Ringtmp = static_cast(100 * sin(pi / 200 * Chance)); - else Ringtmp = 100; - if (Ringtmp > 100) Ringtmp = 100; - ZeichneBilder(static_cast(Bmp[RING].rcDes.left), - static_cast(Bmp[RING].rcDes.top + Ringtmp), - RING, rcPanel, false, -1); - - // Die ChanceZahl ausgeben - Textloeschen(TXTCHANCE); - TextBereich[TXTCHANCE].Aktiv = true; - TextBereich[TXTCHANCE].rcText.top = Bmp[RING].rcDes.top + Ringtmp + Bmp[RING].Hoehe; - TextBereich[TXTCHANCE].rcText.bottom = TextBereich[TXTCHANCE].rcText.top + S2YPIXEL; - std::sprintf(StdString, "%.1f", Chance); - DrawString(StdString, static_cast(TextBereich[TXTCHANCE].rcText.left), - static_cast(TextBereich[TXTCHANCE].rcText.top), 2); - - // TextFeld malen - rcRectsrc.left = 0; - rcRectsrc.top = 0; - rcRectsrc.right = 605; - rcRectsrc.bottom = 20; - rcRectdes = {0, MAXY - 20, MAXX - 195, MAXY}; - Blitten(lpDDSTextFeld, lpDDSBack, false); + DrawPicture(static_cast(Bmp[Tiles::BUTTON_GRID].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_GRID].targetRect.top), + Tiles::BUTTON_GRID, rcPanel, false, -1); + + // SOUNDknopf + if ((s_SoundState == 0) || (s_SoundState == -1)) { + Bmp[Tiles::BUTTON_SOUND].AnimationPhase = 1; + } else { + Bmp[Tiles::BUTTON_SOUND].AnimationPhase = 0; } - void DrawString(char* string, short x, short y, short Art) - { - short Breite = 0; - short Hoehe = 0; + DrawPicture(static_cast(Bmp[Tiles::BUTTON_SOUND].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_SOUND].targetRect.top), + Tiles::BUTTON_SOUND, rcPanel, false, -1); - if (Art == 1) - { - Breite = S1XPIXEL; - Hoehe = S1YPIXEL; - } - if (Art == 2) - { - Breite = S2XPIXEL; - Hoehe = S2YPIXEL; - } + // ANIMATIONknopf + if (!LAnimation) { + Bmp[Tiles::BUTTON_ANIMATION].AnimationPhase = 1; + } else { + Bmp[Tiles::BUTTON_ANIMATION].AnimationPhase = 0; + } - // Länge der Schrift ermitteln - std::size_t length = strlen(string); + DrawPicture(static_cast(Bmp[Tiles::BUTTON_ANIMATION].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_ANIMATION].targetRect.top), + Tiles::BUTTON_ANIMATION, rcPanel, false, -1); + + // BEENDENknopf + DrawPicture(static_cast(Bmp[Tiles::BUTTON_END].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_END].targetRect.top), + Tiles::BUTTON_END, rcPanel, false, -1); + + // NEUknopf + DrawPicture(static_cast(Bmp[Tiles::BUTTON_NEW].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_NEW].targetRect.top), + Tiles::BUTTON_NEW, rcPanel, false, -1); + + // TAGNEUknopf + DrawPicture(static_cast(Bmp[Tiles::BUTTON_NEW_DAY].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_NEW_DAY].targetRect.top), + Tiles::BUTTON_NEW_DAY, rcPanel, false, -1); + + // Aktionsknopf + if (HauptMenue == Menu::ACTION) { + Bmp[Tiles::BUTTON_ACTION].AnimationPhase = Bmp[Tiles::BUTTON_ACTION].AnimationPhaseCount; + } else if (Bmp[Tiles::BUTTON_ACTION].AnimationPhase == Bmp[Tiles::BUTTON_ACTION].AnimationPhaseCount) { + Bmp[Tiles::BUTTON_ACTION].AnimationPhase = 0; + } - // Alle Zeichen durchgehen - for (std::size_t index = 0; index < length; index++) - { - // Korrekte indexNummer ermitteln - short cindex = string[index] - ' '; + DrawPicture(static_cast(Bmp[Tiles::BUTTON_ACTION].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_ACTION].targetRect.top), + Tiles::BUTTON_ACTION, rcPanel, false, -1); - if ((string[index] >= ' ') && (string[index] <= '/')) - { - rcRectsrc.left = cindex * Breite; - rcRectsrc.top = 0; - } - if ((string[index] >= '0') && (string[index] <= '?')) - { - rcRectsrc.left = (cindex - 16) * Breite; - rcRectsrc.top = Hoehe; - } - if ((string[index] >= '@') && (string[index] <= 'O')) - { - rcRectsrc.left = (cindex - 16 * 2) * Breite; - rcRectsrc.top = 2 * Hoehe; - } - if ((string[index] >= 'P') && (string[index] <= '_')) - { - rcRectsrc.left = (cindex - 16 * 3) * Breite; - rcRectsrc.top = 3 * Hoehe; - } - if ((string[index] > '_') && (string[index] <= 'o')) - { - rcRectsrc.left = (cindex - 16 * 4) * Breite; - rcRectsrc.top = 4 * Hoehe; - } - if ((string[index] >= 'p') && (string[index] <= '~')) - { - rcRectsrc.left = (cindex - 16 * 5) * Breite; - rcRectsrc.top = 5 * Hoehe; - } + // BauKnopf + if (HauptMenue == Menu::BUILD) { + Bmp[Tiles::BUTTON_CONSTRUCT].AnimationPhase = Bmp[Tiles::BUTTON_CONSTRUCT].AnimationPhaseCount; + } else if (Bmp[Tiles::BUTTON_CONSTRUCT].AnimationPhase == Bmp[Tiles::BUTTON_CONSTRUCT].AnimationPhaseCount) { + Bmp[Tiles::BUTTON_CONSTRUCT].AnimationPhase = 0; + } - rcRectsrc.right = rcRectsrc.left + Breite; - rcRectsrc.bottom = rcRectsrc.top + Hoehe; - rcRectdes.left = x; - rcRectdes.top = y; - rcRectdes.right = x + Breite; - rcRectdes.bottom = y + Hoehe; - // Zeichen zeichnen - if (Art == 1) - { - Blitten(lpDDSSchrift1, lpDDSSchrift, true); - // x Position weiterschieben - x += S1ABSTAND; - } - if (Art == 2) - { - Blitten(lpDDSSchrift2, lpDDSSchrift, true); - // x Position weiterschieben - x += S2ABSTAND; - } - } + DrawPicture(static_cast(Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_CONSTRUCT].targetRect.top), + Tiles::BUTTON_CONSTRUCT, rcPanel, false, -1); + + // Inventoryknopf + if (HauptMenue == Menu::INVENTORY) { + Bmp[Tiles::BUTTON_INVENTORY].AnimationPhase = Bmp[Tiles::BUTTON_INVENTORY].AnimationPhaseCount; + } else if (Bmp[Tiles::BUTTON_INVENTORY].AnimationPhase == Bmp[Tiles::BUTTON_INVENTORY].AnimationPhaseCount) { + Bmp[Tiles::BUTTON_INVENTORY].AnimationPhase = 0; } - short DrawText(int TEXT, short Bereich, short Art) - { - short BBreite = 0; - short BHoehe = 0; - char Text[1024]; - int blank = ' '; - int slash = '/'; - int strend = 0x0; - char StdString2[10]; // Zur Variablenausgabe - short Anzahl; // Zur Variablenausgabe - - Textloeschen(Bereich); - TextBereich[Bereich].Aktiv = true; - - if (Art == 1) - { - BBreite = S1ABSTAND; - BHoehe = S1YPIXEL; + DrawPicture(static_cast(Bmp[Tiles::BUTTON_INVENTORY].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_INVENTORY].targetRect.top), + Tiles::BUTTON_INVENTORY, rcPanel, false, -1); + + // WEITERknopf + if (Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase != -1) + DrawPicture(static_cast(Bmp[Tiles::BUTTON_CONTINUE].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_CONTINUE].targetRect.top), + Tiles::BUTTON_CONTINUE, rcPanel, false, -1); + + // STOPknopf + if (Bmp[Tiles::BUTTON_STOP].AnimationPhase != -1) + DrawPicture(static_cast(Bmp[Tiles::BUTTON_STOP].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_STOP].targetRect.top), + Tiles::BUTTON_STOP, rcPanel, false, -1); + + // ABLEGENknopf + if (Bmp[Tiles::BUTTON_LAY_DOWN].AnimationPhase != -1) + DrawPicture(static_cast(Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.left), + static_cast(Bmp[Tiles::BUTTON_LAY_DOWN].targetRect.top), + Tiles::BUTTON_LAY_DOWN, rcPanel, false, -1); + + // Welches Menü zeichnen? + switch (HauptMenue) { + case Menu::ACTION: + for (short i = Tiles::BUTTON_SEARCH; i <= Tiles::BUTTON_SLINGSHOT; i++) { + if (Bmp[i].AnimationPhase == -1) { + DrawPicture(static_cast(Bmp[i].targetRect.left), + static_cast(Bmp[i].targetRect.top), + Tiles::BUTTON_QUESTION, rcPanel, false, -1); + continue; + } + + DrawPicture(static_cast(Bmp[i].targetRect.left), + static_cast(Bmp[i].targetRect.top), + i, rcPanel, false, -1); } - if (Art == 2) - { - BBreite = S2ABSTAND; - BHoehe = S2YPIXEL; + + break; + + case Menu::BUILD: + for (short i = Tiles::BUTTON_TENT; i <= Tiles::BUTTON_DESTROY; i++) { + if (Bmp[i].AnimationPhase == -1) { + DrawPicture(static_cast(Bmp[i].targetRect.left), + static_cast(Bmp[i].targetRect.top), + Tiles::BUTTON_QUESTION, rcPanel, false, -1); + continue; + } + + DrawPicture(static_cast(Bmp[i].targetRect.left), + static_cast(Bmp[i].targetRect.top), + i, rcPanel, false, -1); } - LoadString(g_hInst, TEXT, Text, 1024); - short Posx = static_cast(TextBereich[Bereich].rcText.left); - short Posy = static_cast(TextBereich[Bereich].rcText.top); - char* Posnext = Text; - - while (true) - { - strcpy(StdString, ""); - short Pos = Posnext - Text; - Posnext = strchr(Text + Pos + 1, blank); - char* Posnext2 = strchr(Text + Pos + 1, slash); - if ((Posnext != nullptr) && (Posnext2 != nullptr) && (Posnext2 <= Posnext)) - { - char scratch = *(Posnext2 + 1); - switch (scratch) - { - case 'a': - Anzahl = std::sprintf(StdString2, " %d", Tag); - DrawString(StdString2, Posx, Posy, Art); - Posx += BBreite * (Anzahl); - break; - case 'b': - Anzahl = std::sprintf(StdString2, " %d", static_cast(Guy.Resource[GESUNDHEIT])); - DrawString(StdString2, Posx, Posy, Art); - Posx += BBreite * (Anzahl); - break; - case 'c': - Anzahl = std::sprintf(StdString2, " %.2f", Chance); - DrawString(StdString2, Posx, Posy, Art); - Posx += BBreite * (Anzahl); - break; - case 'd': - Frage = 0; - rcRectsrc = Bmp[JA].rcSrc; - rcRectdes.left = static_cast(TextBereich[Bereich].rcText.left) + 50; - rcRectdes.top = Posy + 50; - rcRectdes.right = rcRectdes.left + Bmp[JA].Breite; - rcRectdes.bottom = rcRectdes.top + Bmp[JA].Hoehe; - Bmp[JA].rcDes = rcRectdes; - Blitten(Bmp[JA].Surface, lpDDSSchrift, false); - - rcRectsrc = Bmp[NEIN].rcSrc; - rcRectdes.left = static_cast(TextBereich[Bereich].rcText.left) + 220; - rcRectdes.top = Posy + 50; - rcRectdes.right = rcRectdes.left + Bmp[NEIN].Breite; - rcRectdes.bottom = rcRectdes.top + Bmp[NEIN].Hoehe; - Bmp[NEIN].rcDes = rcRectdes; - Blitten(Bmp[NEIN].Surface, lpDDSSchrift, false); - Posy += 115; - break; - case 'z': - Posx = static_cast(TextBereich[Bereich].rcText.left) - BBreite; - Posy += BHoehe + 3; - break; - } - Pos = Pos + 3; - Posnext = Posnext2 + 2; + + break; + + case Menu::INVENTORY: + DrawPicture(static_cast(Bmp[Tiles::INVENTORY_PAPER].targetRect.left), + static_cast(Bmp[Tiles::INVENTORY_PAPER].targetRect.top), + Tiles::INVENTORY_PAPER, rcPanel, false, -1); + + for (short i = Tiles::RAW_TREE_BRANCH; i <= Tiles::RAW_SLINGSHOT; i++) { + if (Guy.Inventory[i] <= 0) { + continue; } - if (Posnext == nullptr) Posnext = strchr(Text + Pos + 1, strend); - strncpy(StdString, Text + Pos, (Posnext - Text) - Pos); - if (Posx + BBreite * ((Posnext - Text) - Pos) > TextBereich[Bereich].rcText.right) - { - Posx = static_cast(TextBereich[Bereich].rcText.left) - BBreite; - Posy += BHoehe + 3; + + DrawPicture(static_cast(Bmp[i].targetRect.left), + static_cast(Bmp[i].targetRect.top), + i, rcPanel, false, -1); + Bmp[Tiles::ROEMISCH1].targetRect.top = Bmp[i].targetRect.top; + Bmp[Tiles::ROEMISCH2].targetRect.top = Bmp[i].targetRect.top; + + for (short j = 1; j <= Guy.Inventory[i]; j++) { + if (j < 5) { + DrawPicture(static_cast(Bmp[i].targetRect.left) + 20 + j * 4, + static_cast(Bmp[Tiles::ROEMISCH1].targetRect.top), + Tiles::ROEMISCH1, rcPanel, false, -1); + } else if (j == 5) + DrawPicture(static_cast(Bmp[i].targetRect.left) + 23, + static_cast(Bmp[Tiles::ROEMISCH2].targetRect.top), + Tiles::ROEMISCH2, rcPanel, false, -1); + else if ((j > 5) && (j < 10)) { + DrawPicture(static_cast(Bmp[i].targetRect.left) + 20 + j * 4, + static_cast(Bmp[Tiles::ROEMISCH1].targetRect.top), + Tiles::ROEMISCH1, rcPanel, false, -1); + } else if (j == 10) + DrawPicture(static_cast(Bmp[i].targetRect.left) + 43, + static_cast(Bmp[Tiles::ROEMISCH2].targetRect.top), + Tiles::ROEMISCH2, rcPanel, false, -1); } - StdString[(Posnext - Text) - Pos] = static_cast(0); - DrawString(StdString, Posx, Posy, Art); - if (Posnext[0] == static_cast(0)) break; - Posx += BBreite * ((Posnext - Text) - Pos); } - short Erg = static_cast(Posy + BHoehe - TextBereich[Bereich].rcText.top); - if (Erg < 100) Erg = 100; - return Erg; + + break; } - void Textloeschen(short Bereich) - { - TextBereich[Bereich].Aktiv = false; - ddbltfx.dwFillColor = RGB2DWORD(255, 0, 255); - lpDDSSchrift->Blt(&TextBereich[Bereich].rcText, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); + // Säule1 + short i = Bmp[Tiles::COLUMN_1].Height - static_cast(Guy.ResourceAmount[Resources::Water]) * Bmp[Tiles::COLUMN_1].Height / 100; + rcRectsrc = Bmp[Tiles::COLUMN_1].sourceRect; + rcRectsrc.top += i; + rcRectdes = Bmp[Tiles::COLUMN_1].targetRect; + rcRectdes.top += i; + BlitToScreen(Bmp[Tiles::COLUMN_1].Surface); + + // Säule2 + i = Bmp[Tiles::COLUMN_2].Height - static_cast(Guy.ResourceAmount[Resources::Food]) * Bmp[Tiles::COLUMN_2].Height / 100; + rcRectsrc = Bmp[Tiles::COLUMN_2].sourceRect; + rcRectsrc.top += i; + rcRectdes = Bmp[Tiles::COLUMN_2].targetRect; + rcRectdes.top += i; + BlitToScreen(Bmp[Tiles::COLUMN_2].Surface); + + // Säule3 + i = Bmp[Tiles::COLUMN_3].Height - static_cast(Guy.ResourceAmount[Resources::Health]) * Bmp[Tiles::COLUMN_3].Height / 100; + rcRectsrc = Bmp[Tiles::COLUMN_3].sourceRect; + rcRectsrc.top += i; + rcRectdes = Bmp[Tiles::COLUMN_3].targetRect; + rcRectdes.top += i; + BlitToScreen(Bmp[Tiles::COLUMN_3].Surface); + + // Sonnenanzeige + short diffx = (static_cast(Bmp[Tiles::SUN].targetRect.right) - static_cast(Bmp[Tiles::SUN].targetRect.left) - Bmp[Tiles::SUN].Width) / 2; + short diffy = static_cast(Bmp[Tiles::SUN].targetRect.bottom) - static_cast(Bmp[Tiles::SUN].targetRect.top) - Bmp[Tiles::SUN].Height / 2; + short TagesZeit = (Hours * 10 + Minutes * 10 / 60); + + DrawPicture(static_cast(Bmp[Tiles::SUN].targetRect.left + diffx * cos(PI - PI * TagesZeit / 120) + diffx), + static_cast(Bmp[Tiles::SUN].targetRect.top + (-diffy * sin(PI - PI * TagesZeit / 120) + diffy)), + Tiles::SUN, Bmp[Tiles::SUN].targetRect, false, -1); + + // Rettungsring + short Ringtmp; + + if (Chance < 100) { + Ringtmp = static_cast(100 * sin(PI / 200 * Chance)); + } else { + Ringtmp = 100; } - void DrawSchatzkarte() - { - Textloeschen(TXTPAPIER); - TextBereich[TXTPAPIER].Aktiv = true; - PapierText = SKARTEY; + if (Ringtmp > 100) { + Ringtmp = 100; + } - rcRectsrc.left = 0; - rcRectsrc.right = SKARTEX; - rcRectsrc.top = 0; - rcRectsrc.bottom = SKARTEY; - rcRectdes.left = TextBereich[TXTPAPIER].rcText.left; - rcRectdes.top = TextBereich[TXTPAPIER].rcText.top; - rcRectdes.right = rcRectdes.left + SKARTEX; - rcRectdes.bottom = rcRectdes.top + SKARTEY; + DrawPicture(static_cast(Bmp[Tiles::RING].targetRect.left), + static_cast(Bmp[Tiles::RING].targetRect.top + Ringtmp), + Tiles::RING, rcPanel, false, -1); + + // Die ChanceZahl ausgeben + HideText(TXTCHANCE); + TextBereich[TXTCHANCE].HasText = true; + TextBereich[TXTCHANCE].textRect.top = Bmp[Tiles::RING].targetRect.top + Ringtmp + Bmp[Tiles::RING].Height; + TextBereich[TXTCHANCE].textRect.bottom = TextBereich[TXTCHANCE].textRect.top + FONT2_LETTER_HEIGHT; + std::sprintf(StdString, "%.1f", Chance); + DrawString(StdString, static_cast(TextBereich[TXTCHANCE].textRect.left), + static_cast(TextBereich[TXTCHANCE].textRect.top), 2); + + // TextFeld malen + rcRectsrc.left = 0; + rcRectsrc.top = 0; + rcRectsrc.right = 605; + rcRectsrc.bottom = 20; + rcRectdes = {0, MAX_SCREEN_Y - 20, MAX_SCREEN_X - 195, MAX_SCREEN_Y}; + BlitToScreen(lpDDSTextFeld); +} + +void DrawString(const std::string &string, short x, short y, short Art) +{ + short Width = 0; + short Height = 0; - Blitten(lpDDSSchatzkarte, lpDDSSchrift, false); + if (Art == 1) { + Width = FONT1_LETTER_WIDTH; + Height = FONT1_LETTER_HEIGHT; } - void Zeige() - { - char Stringsave1[128], Stringsave2[128]; // Für die Zeitausgabe + if (Art == 2) { + Width = FONT2_LETTER_WIDTH; + Height = FONT2_LETTER_HEIGHT; + } - rcRectsrc.left = Camera.x + rcSpielflaeche.left; - rcRectsrc.top = Camera.y + rcSpielflaeche.top; - rcRectsrc.right = Camera.x + rcSpielflaeche.right; - rcRectsrc.bottom = Camera.y + rcSpielflaeche.bottom; - rcRectdes.left = rcSpielflaeche.left; - rcRectdes.top = rcSpielflaeche.top; - rcRectdes.right = rcSpielflaeche.right; - rcRectdes.bottom = rcSpielflaeche.bottom; + // Alle Zeichen durchgehen + for (std::size_t index = 0; index < string.size(); index++) { + // Korrekte indexNummer ermitteln + short cindex = string[index] - ' '; - Blitten(lpDDSScape, lpDDSBack, false); // Landschaft zeichnen + if ((string[index] >= ' ') && (string[index] <= '/')) { + rcRectsrc.left = cindex * Width; + rcRectsrc.top = 0; + } - ZeichneObjekte(); + if ((string[index] >= '0') && (string[index] <= '?')) { + rcRectsrc.left = (cindex - 16) * Width; + rcRectsrc.top = Height; + } - ZeichnePanel(); + if ((string[index] >= '@') && (string[index] <= 'O')) { + rcRectsrc.left = (cindex - 16 * 2) * Width; + rcRectsrc.top = 2 * Height; + } - // Die TagesZeit ausgeben - Textloeschen(TXTTAGESZEIT); - TextBereich[TXTTAGESZEIT].Aktiv = true; - std::sprintf(Stringsave1, "%d", Stunden + 6); - std::sprintf(Stringsave2, "%d", Minuten); - strcpy(StdString, ""); - if (Stunden + 6 < 10) strcat(StdString, "0"); - strcat(StdString, Stringsave1); - strcat(StdString, ":"); - if (Minuten < 10) strcat(StdString, "0"); - strcat(StdString, Stringsave2); - DrawString(StdString, static_cast(TextBereich[TXTTAGESZEIT].rcText.left), - static_cast(TextBereich[TXTTAGESZEIT].rcText.top), 2); - - if (PapierText != -1) ZeichnePapier(); - - // Die Textsurface blitten - for (short i = 0; i < TEXTANZ; i++) - { - if (!TextBereich[i].Aktiv) continue; // Die nicht aktiven Felder auslassen - rcRectsrc = TextBereich[i].rcText; - rcRectdes = TextBereich[i].rcText; - Blitten(lpDDSSchrift, lpDDSBack, true); + if ((string[index] >= 'P') && (string[index] <= '_')) { + rcRectsrc.left = (cindex - 16 * 3) * Width; + rcRectsrc.top = 3 * Height; } - // Alles schwarz übermalen und nur das Papier mit Text anzeigen - if (Nacht) - { - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - ddbltfx.dwFillColor = RGB2DWORD(0, 0, 0); - lpDDSBack->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - - if (PapierText != -1) - { - ZeichnePapier(); - rcRectsrc = TextBereich[TXTPAPIER].rcText; - rcRectdes = TextBereich[TXTPAPIER].rcText; - Blitten(lpDDSSchrift, lpDDSBack, true); - } - Fade(100, 100, 100); + + if ((string[index] > '_') && (string[index] <= 'o')) { + rcRectsrc.left = (cindex - 16 * 4) * Width; + rcRectsrc.top = 4 * Height; + } + + if ((string[index] >= 'p') && (string[index] <= '~')) { + rcRectsrc.left = (cindex - 16 * 5) * Width; + rcRectsrc.top = 5 * Height; + } + + rcRectsrc.right = rcRectsrc.left + Width; + rcRectsrc.bottom = rcRectsrc.top + Height; + rcRectdes.left = x; + rcRectdes.top = y; + rcRectdes.right = x + Width; + rcRectdes.bottom = y + Height; + + // Zeichen zeichnen + if (Art == 1) { + BlitToText(lpDDSSchrift1); +// Blit(lpDDSSchrift1, lpDDSSchrift, true); + // x Position weiterschieben + x += FONT1_LETTER_SPACING; } - // Cursor - if (CursorTyp == CUPFEIL) - ZeichneBilder(MousePosition.x, MousePosition.y, - CursorTyp, rcGesamt, false, -1); - else - ZeichneBilder(MousePosition.x - Bmp[CursorTyp].Breite / 2, - MousePosition.y - Bmp[CursorTyp].Hoehe / 2, - CursorTyp, rcGesamt, false, -1); - // Flippen - while (true) - { - HRESULT ddrval = lpDDSPrimary->Flip(nullptr, 0); - if (ddrval == DD_OK) - { + if (Art == 2) { + BlitToText(lpDDSSchrift2); + // x Position weiterschieben + x += FONT2_LETTER_SPACING; + } + } +} + +short DrawText(const int TEXT, short Bereich, short Art) +{ + short BWidth = 0; + short BLastCharWidth = 0; + short BHeight = 0; + const char *Text; + int blank = ' '; + int slash = '/'; + int strend = 0x0; + char StdString2[10]; // Zur Variablenausgabe + short Anzahl; // Zur Variablenausgabe + + HideText(Bereich); + TextBereich[Bereich].HasText = true; + + if (Art == 1) { + BWidth = FONT1_LETTER_SPACING; + BLastCharWidth = FONT1_LETTER_WIDTH; + BHeight = FONT1_LETTER_HEIGHT; + } + + if (Art == 2) { + BWidth = FONT2_LETTER_SPACING; + BLastCharWidth = FONT2_LETTER_WIDTH; + BHeight = FONT2_LETTER_HEIGHT; + } + + Text = GetLanguageString(TEXT); + short Posx = static_cast(TextBereich[Bereich].textRect.left); + short Posy = static_cast(TextBereich[Bereich].textRect.top); + const char *Posnext = Text; + + while (true) { + strcpy(StdString, ""); + short Pos = Posnext - Text; + Posnext = strchr(Text + Pos + 1, blank); + const char *Posnext2 = strchr(Text + Pos + 1, slash); + + if ((Posnext != nullptr) && (Posnext2 != nullptr) && (Posnext2 <= Posnext)) { + char scratch = *(Posnext2 + 1); + + switch (scratch) { + case 'a': + Anzahl = std::sprintf(StdString2, " %d", Tag); + // While the spacing of characters equals BWidth, the last char can be wider (=BLastCharWidth). + if (Posx + BWidth * (Anzahl - 1) + BLastCharWidth > TextBereich[Bereich].textRect.right) { + Posx = static_cast(TextBereich[Bereich].textRect.left) - BWidth; + Posy += BHeight + 3; + } + DrawString(StdString2, Posx, Posy, Art); + Posx += BWidth * (Anzahl); break; - } - if (ddrval == DDERR_SURFACELOST) - { - ddrval = lpDDSPrimary->Restore(); - if (ddrval != DD_OK) - { - break; + + case 'b': + Anzahl = std::sprintf(StdString2, " %d", static_cast(Guy.ResourceAmount[Resources::Health])); + // While the spacing of characters equals BWidth, the last char can be wider (=BLastCharWidth). + if (Posx + BWidth * (Anzahl - 1) + BLastCharWidth > TextBereich[Bereich].textRect.right) { + Posx = static_cast(TextBereich[Bereich].textRect.left) - BWidth; + Posy += BHeight + 3; } - } - if (ddrval != DDERR_WASSTILLDRAWING) - { + DrawString(StdString2, Posx, Posy, Art); + Posx += BWidth * (Anzahl); break; - } - } + case 'c': + Anzahl = std::sprintf(StdString2, " %.2f", Chance); + // While the spacing of characters equals BWidth, the last char can be wider (=BLastCharWidth). + if (Posx + BWidth * (Anzahl - 1) + BLastCharWidth > TextBereich[Bereich].textRect.right) { + Posx = static_cast(TextBereich[Bereich].textRect.left) - BWidth; + Posy += BHeight + 3; + } + DrawString(StdString2, Posx, Posy, Art); + Posx += BWidth * (Anzahl); + break; - if (Nacht) Fade(100, 100, 100); // Das muß hier stehen, damit man die Textnachricht in der Nacht lesen kann - } + case 'd': + Frage = 0; + rcRectsrc = Bmp[Tiles::YES].sourceRect; + rcRectdes.left = static_cast(TextBereich[Bereich].textRect.left) + 50; + rcRectdes.top = Posy + 50; + rcRectdes.right = rcRectdes.left + Bmp[Tiles::YES].Width; + rcRectdes.bottom = rcRectdes.top + Bmp[Tiles::YES].Height; + Bmp[Tiles::YES].targetRect = rcRectdes; + BlitToText(Bmp[Tiles::YES].Surface); + + rcRectsrc = Bmp[Tiles::NO].sourceRect; + rcRectdes.left = static_cast(TextBereich[Bereich].textRect.left) + 220; + rcRectdes.top = Posy + 50; + rcRectdes.right = rcRectdes.left + Bmp[Tiles::NO].Width; + rcRectdes.bottom = rcRectdes.top + Bmp[Tiles::NO].Height; + Bmp[Tiles::NO].targetRect = rcRectdes; + BlitToText(Bmp[Tiles::NO].Surface); + Posy += 115; + break; - void ZeigeIntro() - { - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - ddbltfx.dwFillColor = RGB2DWORD(0, 0, 0); - short z = 0; - while (true) - { - z++; - HRESULT ddrval = lpDDSBack->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); - if (ddrval != DDERR_WASSTILLDRAWING) break; - if (z == 1000) - { - MessageBeep(MB_OK); + case 'z': + Posx = static_cast(TextBereich[Bereich].textRect.left) - BWidth; + Posy += BHeight + 3; break; } + + Pos = Pos + 3; + Posnext = Posnext2 + 2; } - rcRectsrc.left = Camera.x + rcSpielflaeche.left; - rcRectsrc.top = Camera.y + rcSpielflaeche.top; - rcRectsrc.right = Camera.x + rcSpielflaeche.right; - rcRectsrc.bottom = Camera.y + rcSpielflaeche.bottom; - rcRectdes.left = rcSpielflaeche.left; - rcRectdes.top = rcSpielflaeche.top; - rcRectdes.right = rcSpielflaeche.right; - rcRectdes.bottom = rcSpielflaeche.bottom; + if (Posnext == nullptr) { + Posnext = strchr(Text + Pos + 1, strend); + } - Blitten(lpDDSScape, lpDDSBack, false); // Landschaft zeichnen + strncpy(StdString, Text + Pos, (Posnext - Text) - Pos); - ZeichneObjekte(); + // While the spacing of characters equals BWidth, the last char can be wider (=BLastCharWidth). + if (Posx + BWidth * ((Posnext - Text) - Pos - 1) + BLastCharWidth > TextBereich[Bereich].textRect.right) { + Posx = static_cast(TextBereich[Bereich].textRect.left) - BWidth; + Posy += BHeight + 3; + } - if (PapierText != -1) ZeichnePapier(); + StdString[(Posnext - Text) - Pos] = static_cast(0); + DrawString(StdString, Posx, Posy, Art); - // Die Textsurface blitten - for (short i = 0; i < TEXTANZ; i++) - { - if (!TextBereich[i].Aktiv) continue; // Die nicht aktiven Felder auslassen - rcRectsrc = TextBereich[i].rcText; - rcRectdes = TextBereich[i].rcText; - Blitten(lpDDSSchrift, lpDDSBack, true); + if (Posnext[0] == static_cast(0)) { + break; } - // Flippen - while (true) - { - HRESULT ddrval = lpDDSPrimary->Flip(nullptr, 0); - if (ddrval == DD_OK) - { - break; - } - if (ddrval == DDERR_SURFACELOST) - { - ddrval = lpDDSPrimary->Restore(); - if (ddrval != DD_OK) - { - break; - } - } - if (ddrval != DDERR_WASSTILLDRAWING) - { - break; - } - } + Posx += BWidth * ((Posnext - Text) - Pos); + } + + short Erg = static_cast(Posy + BHeight - TextBereich[Bereich].textRect.top); + + if (Erg < 100) { + Erg = 100; } - void ZeigeAbspann() - { - PlaySound(Sound::OUTRO, 100); + return Erg; +} +void HideText(short Area) +{ + TextBereich[Area].HasText = false; + Application::clearText(TextBereich[Area].textRect.left, + TextBereich[Area].textRect.top, + TextBereich[Area].textRect.right - TextBereich[Area].textRect.left, + TextBereich[Area].textRect.bottom - TextBereich[Area].textRect.top + ); +} + +void DrawSchatzkarte() +{ + HideText(TXTPAPIER); + TextBereich[TXTPAPIER].HasText = true; + PapierText = TREASUREMAP_HEIGHT; + + rcRectsrc.left = 0; + rcRectsrc.right = TREASUREMAP_WIDTH; + rcRectsrc.top = 0; + rcRectsrc.bottom = TREASUREMAP_HEIGHT; + rcRectdes.left = TextBereich[TXTPAPIER].textRect.left; + rcRectdes.top = TextBereich[TXTPAPIER].textRect.top; + rcRectdes.right = rcRectdes.left + TREASUREMAP_WIDTH; + rcRectdes.bottom = rcRectdes.top + TREASUREMAP_HEIGHT; + + BlitToText(lpDDSSchatzkarte); +} + +void Show() +{ + char Stringsave1[128], Stringsave2[128]; // Für die Zeitausgabe + + rcRectsrc.left = Camera.x + rcPlayingSurface.left; + rcRectsrc.top = Camera.y + rcPlayingSurface.top; + rcRectsrc.right = Camera.x + rcPlayingSurface.right; + rcRectsrc.bottom = Camera.y + rcPlayingSurface.bottom; + rcRectdes.left = rcPlayingSurface.left; + rcRectdes.top = rcPlayingSurface.top; + rcRectdes.right = rcPlayingSurface.right; + rcRectdes.bottom = rcPlayingSurface.bottom; + Application::setLandscapeOffset(rcRectsrc.left, rcRectsrc.top); + + DrawObjects(); + + DrawPanel(); + + // Die TagesZeit ausgeben + HideText(TXTTAGESZEIT); + TextBereich[TXTTAGESZEIT].HasText = true; + std::sprintf(Stringsave1, "%d", Hours + 6); + std::sprintf(Stringsave2, "%d", Minutes); + strcpy(StdString, ""); + + if (Hours + 6 < 10) { + strncat(StdString, "0", TXTTAGESZEIT); + } + + strncat(StdString, Stringsave1, TXTTAGESZEIT); + strncat(StdString, ":", TXTTAGESZEIT); + + if (Minutes < 10) { + strncat(StdString, "0", TXTTAGESZEIT); + } + + strncat(StdString, Stringsave2, TXTTAGESZEIT); + DrawString(StdString, static_cast(TextBereich[TXTTAGESZEIT].textRect.left), + static_cast(TextBereich[TXTTAGESZEIT].textRect.top), 2); + + if (PapierText != -1) { + DrawPaper(); + } + + // Paint over everything black and only show the paper with text + if (Night) { rcRectdes.left = 0; rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - ddbltfx.dwFillColor = RGB2DWORD(0, 0, 0); - short z = 0; - while (true) - { - z++; - HRESULT ddrval = lpDDSBack->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); - if (ddrval != DDERR_WASSTILLDRAWING) break; - if (z == 1000) - { - MessageBeep(MB_OK); - break; - } - } - if (AbspannZustand == 0) - { - ZeichneBilder(static_cast(MAXX) / 2 - Bmp[AbspannListe[AbspannNr][0].Bild].Breite / 2, 100, - AbspannListe[AbspannNr][0].Bild, rcGesamt, false, -1); - for (z = 1; z < 10; z++) - { - if (AbspannListe[AbspannNr][z].Aktiv) - AbspannBlt(AbspannListe[AbspannNr][z].Bild, - static_cast(100 * sin(pi / MAXY * (Bmp[AbspannListe[AbspannNr][z].Bild].rcDes.top + - Bmp[AbspannListe[AbspannNr][z].Aktiv].Hoehe / 2)))); - } + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; +// s_gameScreenVisible = false; +// lpDDSBack->create(lpDDSBack->getSize().x, lpDDSBack->getSize().y, sf::Color(0, 0, 0)); + + if (PapierText != -1) { + DrawPaper(); + rcRectsrc = TextBereich[TXTPAPIER].textRect; + rcRectdes = TextBereich[TXTPAPIER].textRect; +// Blit(lpDDSSchrift, lpDDSBack, true); } - else if (AbspannZustand == 1) - { - rcRectsrc = Bmp[AbspannNr].rcSrc; - rcRectsrc.top += Bmp[AbspannNr].Phase * Bmp[AbspannNr].Hoehe; - rcRectsrc.bottom = rcRectsrc.top + Bmp[AbspannNr].Hoehe; - rcRectdes.left = 2; - rcRectdes.top = 2; - rcRectdes.right = Bmp[AbspannNr].Breite + 2; - rcRectdes.bottom = Bmp[AbspannNr].Hoehe + 2; + Fade(100, 100, 100); + } - Blitten(Bmp[AbspannNr].Surface, lpDDSBack, true); + // Cursor + if (CursorTyp == Tiles::CURSOR_ARROW) + DrawPicture(MousePosition.x, MousePosition.y, + CursorTyp, rcGesamt, false, -1); + else + DrawPicture(MousePosition.x - Bmp[CursorTyp].Width / 2, + MousePosition.y - Bmp[CursorTyp].Height / 2, + CursorTyp, rcGesamt, false, -1); - rcRectsrc.left = 0; - rcRectsrc.top = 0; - rcRectsrc.right = Bmp[AbspannNr].Breite + 4; - rcRectsrc.bottom = Bmp[AbspannNr].Hoehe + 4; + // Flippen + // TODO: look up the directx api, see if this is still relevant +// while (true) { +// HRESULT ddrval = lpDDSPrimary->Flip(nullptr, 0); - rcRectdes.left = static_cast(MAXX) / 2 - rcRectsrc.right * 10 / 2; - rcRectdes.top = static_cast(MAXY) / 2 - rcRectsrc.bottom * 10 / 2; - rcRectdes.right = rcRectdes.left + rcRectsrc.right * 10; - rcRectdes.bottom = rcRectdes.top + rcRectsrc.bottom * 10; +// if (ddrval == DD_OK) { +// break; +// } - Blitten(lpDDSBack, lpDDSBack, false); +// if (ddrval == DDERR_SURFACELOST) { +// ddrval = lpDDSPrimary->Restore(); - rcRectsrc.left = 100; - rcRectsrc.top = 2; - rcRectsrc.right = 100 + Bmp[AbspannNr].Breite + 2; - rcRectsrc.bottom = Bmp[AbspannNr].Hoehe + 2; +// if (ddrval != DD_OK) { +// break; +// } +// } - rcRectdes.left = 2; - rcRectdes.top = 2; - rcRectdes.right = Bmp[AbspannNr].Breite + 2; - rcRectdes.bottom = Bmp[AbspannNr].Hoehe + 2; +// if (ddrval != DDERR_WASSTILLDRAWING) { +// break; +// } +// } - Blitten(lpDDSBack, lpDDSBack, false); - } - // Flippen - while (true) - { - HRESULT ddrval = lpDDSPrimary->Flip(nullptr, 0); - if (ddrval == DD_OK) - { - break; - } - if (ddrval == DDERR_SURFACELOST) - { - ddrval = lpDDSPrimary->Restore(); - if (ddrval != DD_OK) - { - break; - } - } - if (ddrval != DDERR_WASSTILLDRAWING) - { - break; - } - } + + if (Night) { + Fade(100, 100, 100); // Das muß hier stehen, damit man die Textnachricht in der Nacht lesen kann } +} - void ZeigeLogo() - { - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXX; - rcRectdes.bottom = MAXY; - ddbltfx.dwFillColor = RGB2DWORD(0, 0, 0); - short z = 0; - while (true) - { - z++; - HRESULT ddrval = lpDDSBack->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); - if (ddrval != DDERR_WASSTILLDRAWING) break; - if (z == 1000) - { - MessageBeep(MB_OK); - break; +void ShowIntro() +{ + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + + // TODO: more efficient way of filling with black + Application::clearScreenContent(); + + rcRectsrc.left = Camera.x + rcPlayingSurface.left; + rcRectsrc.top = Camera.y + rcPlayingSurface.top; + rcRectsrc.right = Camera.x + rcPlayingSurface.right; + rcRectsrc.bottom = Camera.y + rcPlayingSurface.bottom; + rcRectdes.left = rcPlayingSurface.left; + rcRectdes.top = rcPlayingSurface.top; + rcRectdes.right = rcPlayingSurface.right; + rcRectdes.bottom = rcPlayingSurface.bottom; + Application::setLandscapeOffset(rcRectsrc.left, rcRectsrc.top); + + DrawObjects(); + + if (PapierText != -1) { + DrawPaper(); + } +} + +void ShowCredits() +{ + PlaySound(Sound::OUTRO, 100); + + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + + Application::clearScreenContent(sf::Color(0, 0, 0, 200)); + + if (CreditsState == 0) { + DrawPicture(MAX_SCREEN_X / 2 - Bmp[CreditsList[CreditsNum][0].Picture].Width / 2, 100, + CreditsList[CreditsNum][0].Picture, rcGesamt, false, -1); + + for (int z = 1; z < 10; z++) { + if (CreditsList[CreditsNum][z].IsRunning) { + CreditsBlt(CreditsList[CreditsNum][z].Picture, + static_cast(100 * sin(PI / MAX_SCREEN_Y * (Bmp[CreditsList[CreditsNum][z].Picture].targetRect.top + + Bmp[CreditsList[CreditsNum][z].IsRunning].Height / 2)))); } } + } else if (CreditsState == 1) { + puts("State 2"); + rcRectsrc = Bmp[CreditsNum].sourceRect; + rcRectsrc.top += Bmp[CreditsNum].AnimationPhase * Bmp[CreditsNum].Height; + rcRectsrc.bottom = rcRectsrc.top + Bmp[CreditsNum].Height; + + rcRectdes.left = 2; + rcRectdes.top = 2; + rcRectdes.right = Bmp[CreditsNum].Width + 2; + rcRectdes.bottom = Bmp[CreditsNum].Height + 2; + + BlitToScreen(Bmp[CreditsNum].Surface); rcRectsrc.left = 0; - rcRectsrc.right = 500; rcRectsrc.top = 0; - rcRectsrc.bottom = 500; - rcRectdes.left = MAXX / 2 - 250; - rcRectdes.right = MAXX / 2 + 250; - rcRectdes.top = MAXY / 2 - 250; - rcRectdes.bottom = MAXY / 2 + 250; + rcRectsrc.right = Bmp[CreditsNum].Width + 4; + rcRectsrc.bottom = Bmp[CreditsNum].Height + 4; + rcRectdes.left = static_cast(MAX_SCREEN_X) / 2 - rcRectsrc.right * 10 / 2; + rcRectdes.top = static_cast(MAX_SCREEN_Y) / 2 - rcRectsrc.bottom * 10 / 2; + rcRectdes.right = rcRectdes.left + rcRectsrc.right * 10; + rcRectdes.bottom = rcRectdes.top + rcRectsrc.bottom * 10; - Blitten(lpDDSLogo, lpDDSBack, false); + BlitToScreen(lpDDSBack); - PlaySound(Sound::LOGO, 100); + rcRectsrc.left = 100; + rcRectsrc.top = 2; + rcRectsrc.right = 100 + Bmp[CreditsNum].Width + 2; + rcRectsrc.bottom = Bmp[CreditsNum].Height + 2; - // Flippen - while (true) - { - HRESULT ddrval = lpDDSPrimary->Flip(nullptr, 0); - if (ddrval == DD_OK) - { - break; - } - if (ddrval == DDERR_SURFACELOST) - { - ddrval = lpDDSPrimary->Restore(); - if (ddrval != DD_OK) - { - break; - } - } - if (ddrval != DDERR_WASSTILLDRAWING) - { - break; - } - } + rcRectdes.left = 2; + rcRectdes.top = 2; + rcRectdes.right = Bmp[CreditsNum].Width + 2; + rcRectdes.bottom = Bmp[CreditsNum].Height + 2; + + BlitToScreen(lpDDSBack); } - void AbspannBlt(short Bild, short Prozent) - { - Bmp[Bild].Surface->Lock(nullptr, &ddsd, DDLOCK_WAIT, nullptr); - lpDDSBack->Lock(nullptr, &ddsd2, DDLOCK_WAIT, nullptr); - - for (short x = 0; x < Bmp[Bild].Breite; x++) - for (short y = 0; y < Bmp[Bild].Hoehe; y++) - { - if ((x + Bmp[Bild].rcDes.left >= MAXX) || (x + Bmp[Bild].rcDes.left <= 0) || - (y + Bmp[Bild].rcDes.top >= MAXY) || (y + Bmp[Bild].rcDes.top <= 0)) - continue; - Renderer::GetPixel(static_cast(x + Bmp[Bild].rcDes.left), - static_cast(y + Bmp[Bild].rcDes.top), &ddsd2); - RGBSTRUCT rgbalt = rgbStruct; - Renderer::GetPixel(static_cast(x + Bmp[Bild].rcSrc.left), - static_cast(y + Bmp[Bild].rcSrc.top), &ddsd); - if ((rgbStruct.r == 0) && (rgbStruct.g == 0) && (rgbStruct.b == 0)) continue; - PutPixel(static_cast(x + Bmp[Bild].rcDes.left), - static_cast(y + Bmp[Bild].rcDes.top), - RGB2DWORD(rgbalt.r + (rgbStruct.r - rgbalt.r) * Prozent / 100, - rgbalt.g + (rgbStruct.g - rgbalt.g) * Prozent / 100, - rgbalt.b + (rgbStruct.b - rgbalt.b) * Prozent / 100), - &ddsd2); - } + // Flippen + // TODO: look up the directdraw API +// while (true) { +// HRESULT ddrval = lpDDSPrimary->Flip(nullptr, 0); + +// if (ddrval == DD_OK) { +// break; +// } + +// if (ddrval == DDERR_SURFACELOST) { +// ddrval = lpDDSPrimary->Restore(); + +// if (ddrval != DD_OK) { +// break; +// } +// } + +// if (ddrval != DDERR_WASSTILLDRAWING) { +// break; +// } +// } +} + +void ShowLogo() +{ + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SCREEN_X; + rcRectdes.bottom = MAX_SCREEN_Y; + + // TODO: more efficient way of filling with black +// lpDDSBack->create(MAX_SCREEN_X, MAX_SCREEN_Y, sf::Color(0, 0, 0)); + Application::clearScreenContent(); +// s_gameScreenVisible = false; + + rcRectsrc.left = 0; + rcRectsrc.right = 500; + rcRectsrc.top = 0; + rcRectsrc.bottom = 500; + rcRectdes.left = MAX_SCREEN_X / 2 - 250; + rcRectdes.right = MAX_SCREEN_X / 2 + 250; + rcRectdes.top = MAX_SCREEN_Y / 2 - 250; + rcRectdes.bottom = MAX_SCREEN_Y / 2 + 250; + + + BlitToScreen(lpDDSLogo); + + PlaySound(Sound::LOGO, 100); +} + +void CreditsBlt(short Bild, short Prozent) +{ + sf::IntRect srcrect; + srcrect.left = Bmp[Bild].sourceRect.left; + srcrect.top = Bmp[Bild].sourceRect.top; + srcrect.width = Bmp[Bild].sourceRect.right - Bmp[Bild].sourceRect.left; + srcrect.height = Bmp[Bild].sourceRect.bottom - Bmp[Bild].sourceRect.top; + +// RECT rcRectdes = Bmp[Bild].targetRect; +// int dstWidth = rcRectdes.right - rcRectdes.left; +// int dstHeight = rcRectdes.bottom - rcRectdes.top; +// srcrect.width = std::min(dstWidth, srcrect.width); +// srcrect.height = std::min(dstHeight, srcrect.height); + +// assert(srcrect.width > 0 && srcrect.height > 0); +// if (srcrect.width <= 0 || srcrect.height <= 0) { +// return; +// } + sf::Sprite sprite; + sprite.setTexture(*Bmp[Bild].Surface); + sprite.setPosition(sf::Vector2f(Bmp[Bild].targetRect.left, Bmp[Bild].targetRect.top)); + sprite.setColor(sf::Color(255, 255, 255, 255 * Prozent/100)); + sprite.setTextureRect(srcrect); + Application::drawSprite(sprite); +} + +sf::Image landscapeImage() +{ + // TODO: get rid of + return Application::landscapeImage(); +} + +void drawRect(const int x, const int y, const int width, const int height, const sf::Color &color) +{ + sf::RectangleShape rect(sf::Vector2f(width, height)); + rect.setPosition(x, y); + rect.setFillColor(color); + Application::drawToScreen(rect); +} - Bmp[Bild].Surface->Unlock(nullptr); - lpDDSBack->Unlock(nullptr); - } } // namespace Renderer diff --git a/src/Renderer.hpp b/src/Renderer.hpp index fcfd310..6407b2a 100644 --- a/src/Renderer.hpp +++ b/src/Renderer.hpp @@ -4,27 +4,37 @@ #include "types.hpp" #include "extern.hpp" -namespace Renderer -{ - inline DWORD RGB2DWORD(BYTE r, BYTE g, BYTE b); // Rechnet 24Bit RGB in 16 Bit um (Für ddbltfx.dwFillColor) - void ZeichneObjekte(); // Alles Landschaftsdetails zeichnen, die nicht im Speicher sind - void ZeichneGuy(); // Zeichnet die Spielfigur - void ZeichnePanel(); // Zeichnet die Karte - void ZeichneBilder(short x, short y, short i, RECT Ziel, bool Reverse, short Frucht); // Zeichnet die Bmp-Bilder - void ZeichnePapier(); // Zeichnet das Papier für den Text - void Textloeschen(short Bereich); // Löscht einen Breich in der Textsurface - void DrawString(char* string, short x, short y, short Art); // Schreibt einen String an eine gewünschte Stelle - short DrawText(int TEXT, short Bereich, short Art); // Schreibt einen Text in ein Rechteck - void DrawSchatzkarte(); // Schatzkarte malen - void LimitScroll(); // Verhindert das Scrollen aus dem Bild - void Blitten(LPDIRECTDRAWSURFACE4 lpDDSVon, LPDIRECTDRAWSURFACE4 lpDDSNach, bool Transp); - void PutPixel(short x, short y, DWORD color, LPDDSURFACEDESC2 ddsd); // Schreibt Pixel in eine Surface (davor lock()) - void GetPixel(short x, short y, LPDDSURFACEDESC2 ddsd); // Das Ergebnis wird in rgbStruct gespeichert - void Fade(short RP, short GP, short BP); // Bild abdunkeln mittels Gamma-Werten (in Prozent pro Farbwert) - ZWEID GetKachel(short x, short y); // Welche Kachel ist unter den angegebenen Koordinaten - void Zeige(); // Landschaft anzeigen - void ZeigeIntro(); // Für das Intro zuständig - void ZeigeAbspann(); // Für den Abspann - void ZeigeLogo(); // Zeigt das Logo - void AbspannBlt(short Bild, short Prozent); // Zeichnet die Bilder im Abspann +namespace Renderer { +//DWORD RGB2DWORD(BYTE r, BYTE g, BYTE b); // Rechnet 24Bit RGB in 16 Bit um (Für ddbltfx.dwFillColor) +void DrawObjects(); // Alles Landschaftsdetails zeichnen, die nicht im Speicher sind +void DrawGuy(); // Zeichnet die Spielfigur +void DrawPanel(); // Zeichnet die Karte +void DrawPicture(short x, short y, short i, RECT target, bool Reverse, short Fruit); // Zeichnet die Bmp-Bilder +void DrawPaper(); // Zeichnet das Papier für den Text +void HideText(short Bereich); // Löscht einen Breich in der Textsurface +void DrawString(const std::string &string, short x, short y, short Art); // Schreibt einen String an eine gewünschte Stelle +short DrawText(const int TEXT, short Bereich, short Art); // Schreibt einen Text in ein Rechteck +void DrawSchatzkarte(); // Schatzkarte malen +void LimitScroll(); // Verhindert das Scrollen aus dem Bild +//void Blit(sf::Texture *from, sf::Texture *to, bool Transp); +//void Blit(sf::Image *from, sf::Texture *to, bool Transp); +void BlitToScreen(sf::Texture *from); +void BlitToText(sf::Texture *from); +void BlitToLandscape(sf::Texture *from); +void PutPixel(short x, short y, uint8_t r, uint8_t g, uint8_t b, sf::Image *img); // Schreibt Pixel in eine Surface (davor lock()) +RGBSTRUCT GetPixel(short x, short y, sf::Image *img); // Das Ergebnis wird in rgbStruct gespeichert +void Fade(short RP, short GP, short BP); // Bild abdunkeln mittels Gamma-Werten (in Prozent pro Farbwert) +Coordinate GetTile(short x, short y); // Welche Kachel ist unter den angegebenen Koordinaten +void Show(); // Landschaft anzeigen +void ShowIntro(); // Für das Intro zuständig +void ShowCredits(); // Für den Abspann +void ShowLogo(); // Zeigt das Logo +void CreditsBlt(short Bild, short Prozent); // Zeichnet die Bilder im Abspann +sf::Image landscapeImage(); + + +void drawRect(const int x, const int y, const int width, const int height, const sf::Color &color); +void drawRectToMap(const int x, const int y, const int width, const int height, const sf::Color &color); +sf::Texture *createEmptyTexture(const size_t width, const size_t height, const sf::Color &color); +sf::Texture *loadTexture(const void *data, const size_t size, const sf::Color &mask = sf::Color(255, 0, 255)); } // namespace Renderer diff --git a/src/Routing.cpp b/src/Routing.cpp index 70b3c38..d76cc99 100644 --- a/src/Routing.cpp +++ b/src/Routing.cpp @@ -2,306 +2,315 @@ #include "Math.hpp" -namespace Routing +namespace Routing { +int LenMap[MAX_TILES_X][MAX_TILESY]; +Coordinate SaveRoute[MAX_TILES_X * MAX_TILESY]; // Zum zwischenspeichern der Route +Coordinate NewPos; // Nur innerhalb des Pathfindings benutzt + +void MarkRoute(bool Mark) { - int LenMap[MAXXKACH][MAXYKACH]; - ZWEID SaveRoute[MAXXKACH * MAXYKACH]; // Zum zwischenspeichern der Route - ZWEID NewPos; // Nur innerhalb des Pathfindings benutzt - - void MarkRoute(bool Mark) - { - for (short i = 0; i < RouteLaenge; i++) - { - Scape[Route[i].x][Route[i].y].Markiert = Mark; - } + for (short i = 0; i < RouteLaenge; i++) { + Landscape[Route[i].x][Route[i].y].Marked = Mark; } +} - short RotateRight(short Dir) // Richtungskoordinate rechtsrum umrechnen - { - switch (Dir) - { - case 2: - { - NewPos.x++; - NewPos.y++; - Dir = 4; - break; - } - case 4: - { - NewPos.x--; - NewPos.y++; - Dir = 8; - break; - } - case 8: - { - NewPos.x--; - NewPos.y--; - Dir = 1; - break; - } - case 1: - { - NewPos.x++; - NewPos.y--; - Dir = 2; - break; - } - } - return Dir; +short RotateRight(short Dir) // Richtungskoordinate rechtsrum umrechnen +{ + switch (Dir) { + case 2: { + NewPos.x++; + NewPos.y++; + Dir = 4; + break; + } + + case 4: { + NewPos.x--; + NewPos.y++; + Dir = 8; + break; + } + + case 8: { + NewPos.x--; + NewPos.y--; + Dir = 1; + break; } - bool FindTheWay() - { - short Dir; + case 1: { + NewPos.x++; + NewPos.y--; + Dir = 2; + break; + } + } + + return Dir; +} + +bool FindTheWay() +{ + short Dir; - ZWEID Plist[MAXXKACH * MAXYKACH]; // Besuchte Punkte merken - short Llist[MAXXKACH * MAXYKACH]; // Länge vom Punkt zum Ziel + Coordinate Plist[MAX_TILES_X * MAX_TILESY]; // Besuchte Punkte merken + short Llist[MAX_TILES_X * MAX_TILESY]; // Länge vom Punkt zum Ziel - ZWEID ShPos{0, 0}; - ZWEID BestLine{0, 0}; - ZWEID ShortKoor{0, 0}; + Coordinate ShPos{0, 0}; + Coordinate BestLine{0, 0}; + Coordinate ShortKoor{0, 0}; - for (short AI = 0; AI < MAXYKACH; AI++) - for (short BI = 0; BI < MAXXKACH; BI++) - { - LenMap[AI][BI] = 65535; - Llist[AI * BI] = 0; - Plist[AI * BI].x = 0; - Plist[AI * BI].y = 0; + for (short AI = 0; AI < MAX_TILESY; AI++) + for (short BI = 0; BI < MAX_TILES_X; BI++) { + LenMap[AI][BI] = 65535; + Llist[AI * BI] = 0; + Plist[AI * BI].x = 0; + Plist[AI * BI].y = 0; + } + + short ShortEntf = -1; + RouteLaenge = 0; + + short PCnt = 1; + Plist[0] = RouteStart; + short DiffX = (RouteStart.x - RouteDestination.x); + short DiffY = (RouteStart.y - RouteDestination.y); + Llist[0] = (DiffX * DiffX) + (DiffY * DiffY); + + LenMap[RouteStart.x][RouteStart.y] = 0; + Coordinate Pos = RouteStart; + NewPos = Pos; + bool GoalReached = false; + + while ((!GoalReached) && (PCnt > 0)) { + // den mit der kürzesten Entfernung zum Ziel finden (der in der Liste ist) + short Shortest = 0; + + for (short CI = 0; CI <= PCnt - 1; CI++) { + if (Llist[CI] < Llist[Shortest]) { + Shortest = CI; } - short ShortEntf = -1; - RouteLaenge = 0; + } - short PCnt = 1; - Plist[0] = RouteStart; - short DiffX = (RouteStart.x - RouteZiel.x); - short DiffY = (RouteStart.y - RouteZiel.y); - Llist[0] = (DiffX * DiffX) + (DiffY * DiffY); + // Mit dem Nächsten weitermachen + Pos = Plist[Shortest]; - LenMap[RouteStart.x][RouteStart.y] = 0; - ZWEID Pos = RouteStart; + // Den kürzesten merken + if ((ShortEntf > Llist[Shortest]) || (ShortEntf == -1)) { + ShortEntf = Llist[Shortest]; + ShortKoor = Plist[Shortest]; + } + + // Den Nächsten aus der Liste löschen + Plist[Shortest] = Plist[PCnt - 1]; + Llist[Shortest] = Llist[PCnt - 1]; + PCnt--; NewPos = Pos; - bool GoalReached = false; - while ((!GoalReached) && (PCnt > 0)) - { - // den mit der kürzesten Entfernung zum Ziel finden (der in der Liste ist) - short Shortest = 0; - for (short CI = 0; CI <= PCnt - 1; CI++) - { - if (Llist[CI] < Llist[Shortest]) - { - Shortest = CI; - } + Dir = 2; + NewPos.y--; // Oben nachschauen anfangen + + for (short BI = 0; BI <= 3; BI++) { // In jede Richtung schauen + // ist das Feld noch nicht besucht und frei? + if ((LenMap[NewPos.x][NewPos.y] == 65535) && + (Landscape[NewPos.x][NewPos.y].Walkable)) { + // Wieviele Schritte braucht man um zu diesem Feld zu kommen + short StepCnt = LenMap[Pos.x][Pos.y] + 1; + LenMap[NewPos.x][NewPos.y] = StepCnt; + Plist[PCnt] = NewPos; + // Die Entfernung in die Liste aufnehmen + DiffX = (NewPos.x - RouteDestination.x); + DiffY = (NewPos.y - RouteDestination.y); + Llist[PCnt] = (DiffX * DiffX) + (DiffY * DiffY); + PCnt++; } - // Mit dem Nächsten weitermachen - Pos = Plist[Shortest]; - // Den kürzesten merken - if ((ShortEntf > Llist[Shortest]) || (ShortEntf == -1)) - { - ShortEntf = Llist[Shortest]; - ShortKoor = Plist[Shortest]; + + // Ziel erreicht? + if ((NewPos.x == RouteDestination.x) && (NewPos.y == RouteDestination.y)) { + GoalReached = true; + BI = 3; } - // Den Nächsten aus der Liste löschen - Plist[Shortest] = Plist[PCnt - 1]; - Llist[Shortest] = Llist[PCnt - 1]; - PCnt--; + Dir = RotateRight(Dir); + } + } + + if ((PCnt == 0) || (!Landscape[RouteDestination.x][RouteDestination.y].Walkable)) { + RouteDestination.x = ShortKoor.x; + RouteDestination.y = ShortKoor.y; + + if (FindTheWay()) { + return true; + } + + return false; + } + + if (GoalReached) { // Punkt rückwärts durchgehen und Abkürzungen finden + Pos = RouteDestination; + Coordinate LineStartPos = Pos; + + while ((Pos.x != RouteStart.x) || (Pos.y != RouteStart.y)) { NewPos = Pos; + int ShStep = 65535; Dir = 2; - NewPos.y--; // Oben nachschauen anfangen - for (short BI = 0; BI <= 3; BI++) // In jede Richtung schauen - { - // ist das Feld noch nicht besucht und frei? - if ((LenMap[NewPos.x][NewPos.y] == 65535) && - (Scape[NewPos.x][NewPos.y].Begehbar)) - { - // Wieviele Schritte braucht man um zu diesem Feld zu kommen - short StepCnt = LenMap[Pos.x][Pos.y] + 1; - LenMap[NewPos.x][NewPos.y] = StepCnt; - Plist[PCnt] = NewPos; - // Die Entfernung in die Liste aufnehmen - DiffX = (NewPos.x - RouteZiel.x); - DiffY = (NewPos.y - RouteZiel.y); - Llist[PCnt] = (DiffX * DiffX) + (DiffY * DiffY); - PCnt++; - } - // Ziel erreicht? - if ((NewPos.x == RouteZiel.x) && (NewPos.y == RouteZiel.y)) - { - GoalReached = true; - BI = 3; + NewPos.y--; // Zuerst nach oben probieren + + for (short AI = 0; AI <= 3; AI++) { + if (LenMap[NewPos.x][NewPos.y] < ShStep) { + ShStep = LenMap[NewPos.x][NewPos.y]; + ShPos = NewPos; } + Dir = RotateRight(Dir); } - } - if ((PCnt == 0) || (!Scape[RouteZiel.x][RouteZiel.y].Begehbar)) - { - RouteZiel.x = ShortKoor.x; - RouteZiel.y = ShortKoor.y; - if (FindTheWay()) return true; - return false; - } - if (GoalReached) // Punkt rückwärts durchgehen und Abkürzungen finden - { - Pos = RouteZiel; - ZWEID LineStartPos = Pos; - while ((Pos.x != RouteStart.x) || (Pos.y != RouteStart.y)) - { - NewPos = Pos; - int ShStep = 65535; - Dir = 2; - NewPos.y--; // Zuerst nach oben probieren - for (short AI = 0; AI <= 3; AI++) - { - if (LenMap[NewPos.x][NewPos.y] < ShStep) - { - ShStep = LenMap[NewPos.x][NewPos.y]; - ShPos = NewPos; - } - Dir = RotateRight(Dir); - } - Pos = ShPos; + Pos = ShPos; - // Linie beste Linie ohne Unterbrechung finden - if (!Math::LineIntersect(LineStartPos, Pos, false)) - { - BestLine = Pos; - } - - if ((Pos.x == RouteStart.x) && (Pos.y == RouteStart.y)) - { - Pos = BestLine; - Math::LineIntersect(LineStartPos, Pos, true); - LineStartPos = Pos; - } + // Linie beste Linie ohne Unterbrechung finden + if (!Math::LineIntersect(LineStartPos, Pos, false)) { + BestLine = Pos; } - Route[RouteLaenge].x = RouteStart.x; - Route[RouteLaenge].y = RouteStart.y; - RouteLaenge++; - SortRoute(); // Sortieren + if ((Pos.x == RouteStart.x) && (Pos.y == RouteStart.y)) { + Pos = BestLine; + Math::LineIntersect(LineStartPos, Pos, true); + LineStartPos = Pos; + } } - return true; + + Route[RouteLaenge].x = RouteStart.x; + Route[RouteLaenge].y = RouteStart.y; + RouteLaenge++; + + SortRoute(); // Sortieren } - bool CheckRoute(short x, short y, bool save, short Laenge) // Nachprüfen ob auf aktuellem Teil in der Route ist - { - short i; + return true; +} + +bool CheckRoute(short x, short y, bool save, short Laenge) // Nachprüfen ob auf aktuellem Teil in der Route ist +{ + short i; - if (!save) - { - for (i = 0; i < RouteLaenge; i++) - { - if ((x == Route[i].x) && (y == Route[i].y)) return true; + if (!save) { + for (i = 0; i < RouteLaenge; i++) { + if ((x == Route[i].x) && (y == Route[i].y)) { + return true; } } - else - { - for (i = 0; i <= Laenge; i++) - { - if ((x == SaveRoute[i].x) && (y == SaveRoute[i].y)) return true; + } else { + for (i = 0; i <= Laenge; i++) { + if ((x == SaveRoute[i].x) && (y == SaveRoute[i].y)) { + return true; } } - return false; } - void SortRoute() - { - ZWEID Pos; - - Pos.x = RouteStart.x; - Pos.y = RouteStart.y; - for (short i = 0; i < RouteLaenge; i++) // Alle Teile vom Start durchgehen - { - SaveRoute[i].x = Pos.x; - SaveRoute[i].y = Pos.y; - - RouteKoor[2 * i].x = - (Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][0].x + - Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][2].x) / 2; - RouteKoor[2 * i].y = - (Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][1].y + - Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][3].y) / 2; - - NewPos.x = Pos.x; - NewPos.y = Pos.y - 1; // oben mit nachschauen anfangen - short Dir = 2; - for (short j = 0; j <= 3; j++) - { - if ((CheckRoute(NewPos.x, NewPos.y, false, RouteLaenge)) && - (!CheckRoute(NewPos.x, NewPos.y, true, i))) - { - switch (j) - { - case 0: - RouteKoor[2 * i + 1].x = - (Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][1].x + - Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][2].x) / 2; - RouteKoor[2 * i + 1].y = - (Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][1].y + - Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][2].y) / 2; - break; - case 1: - RouteKoor[2 * i + 1].x = - (Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][2].x + - Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][3].x) / 2; - RouteKoor[2 * i + 1].y = - (Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][2].y + - Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][3].y) / 2; - break; - case 2: - RouteKoor[2 * i + 1].x = - (Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][3].x + - Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][0].x) / 2; - RouteKoor[2 * i + 1].y = - (Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][3].y + - Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][0].y) / 2; - break; - case 3: - RouteKoor[2 * i + 1].x = - (Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][0].x + - Scape[Pos.x][Pos.y].xScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][1].x) / 2; - RouteKoor[2 * i + 1].y = - (Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][0].y + - Scape[Pos.x][Pos.y].yScreen + EckKoor[Scape[Pos.x][Pos.y].Typ][1].y) / 2; - break; - } + return false; +} + +void SortRoute() +{ + Coordinate Pos; + + Pos.x = RouteStart.x; + Pos.y = RouteStart.y; + + for (short i = 0; i < RouteLaenge; i++) { // Alle Teile vom Start durchgehen + SaveRoute[i].x = Pos.x; + SaveRoute[i].y = Pos.y; + + RouteKoor[2 * i].x = + (Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][0].x + + Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][2].x) / 2; + RouteKoor[2 * i].y = + (Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][1].y + + Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][3].y) / 2; + + NewPos.x = Pos.x; + NewPos.y = Pos.y - 1; // oben mit nachschauen anfangen + short Dir = 2; + + for (short j = 0; j <= 3; j++) { + if ((CheckRoute(NewPos.x, NewPos.y, false, RouteLaenge)) && + (!CheckRoute(NewPos.x, NewPos.y, true, i))) { + switch (j) { + case 0: + RouteKoor[2 * i + 1].x = + (Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][1].x + + Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][2].x) / 2; + RouteKoor[2 * i + 1].y = + (Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][1].y + + Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][2].y) / 2; + break; + + case 1: + RouteKoor[2 * i + 1].x = + (Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][2].x + + Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][3].x) / 2; + RouteKoor[2 * i + 1].y = + (Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][2].y + + Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][3].y) / 2; + break; + + case 2: + RouteKoor[2 * i + 1].x = + (Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][3].x + + Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][0].x) / 2; + RouteKoor[2 * i + 1].y = + (Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][3].y + + Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][0].y) / 2; + break; + + case 3: + RouteKoor[2 * i + 1].x = + (Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][0].x + + Landscape[Pos.x][Pos.y].xScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][1].x) / 2; + RouteKoor[2 * i + 1].y = + (Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][0].y + + Landscape[Pos.x][Pos.y].yScreen + CornerCoord[Landscape[Pos.x][Pos.y].Type][1].y) / 2; break; } - Dir = RotateRight(Dir); + break; } - Pos.x = NewPos.x; - Pos.y = NewPos.y; - } - for (short i = 0; i <= RouteLaenge; i++) // Wieder in die Originalroute speichern - { - Route[i].x = SaveRoute[i].x; - Route[i].y = SaveRoute[i].y; + + Dir = RotateRight(Dir); } + + Pos.x = NewPos.x; + Pos.y = NewPos.y; + } + + for (short i = 0; i <= RouteLaenge; i++) { // Wieder in die Originalroute speichern + Route[i].x = SaveRoute[i].x; + Route[i].y = SaveRoute[i].y; } +} + +void ShortRoute(short Zielx, short Ziely) +{ + RouteLaenge = 1; + Route[0].x = Guy.Pos.x; + Route[0].y = Guy.Pos.y; + RouteKoor[0].x = Guy.ScreenPosition.x; + RouteKoor[0].y = Guy.ScreenPosition.y; + Route[1].x = Guy.Pos.x; + Route[1].y = Guy.Pos.y; + RouteKoor[1].x = Zielx; + RouteKoor[1].y = Ziely; - void ShortRoute(short Zielx, short Ziely) - { - RouteLaenge = 1; - Route[0].x = Guy.Pos.x; - Route[0].y = Guy.Pos.y; - RouteKoor[0].x = Guy.PosScreen.x; - RouteKoor[0].y = Guy.PosScreen.y; - Route[1].x = Guy.Pos.x; - Route[1].y = Guy.Pos.y; - RouteKoor[1].x = Zielx; - RouteKoor[1].y = Ziely; - - // Die Animation gleich anschließend starten - Guy.Aktiv = true; - if ((BootsFahrt) && (Guy.Zustand != GUYSCHWIMMEN)) Guy.Zustand = GUYBOOTLINKS; - else if (Guy.Zustand != GUYSCHWIMMEN) Guy.Zustand = GUYLINKS; - RoutePunkt = -1; - Steps = 0; - Step = 0; + // Die Animation gleich anschließend starten + Guy.IsActive = true; + + if ((IsInBoat) && (Guy.AnimationState != Tiles::GUY_SWIM)) { + Guy.AnimationState = Tiles::GUY_BOAT_LEFT; + } else if (Guy.AnimationState != Tiles::GUY_SWIM) { + Guy.AnimationState = Tiles::GUY_LEFT; } + + RoutePunkt = -1; + Steps = 0; + Step = 0; +} } // namespace Route diff --git a/src/Routing.hpp b/src/Routing.hpp index 7273561..47d068d 100644 --- a/src/Routing.hpp +++ b/src/Routing.hpp @@ -3,12 +3,11 @@ #include "headers.hpp" #include "extern.hpp" -namespace Routing -{ - void MarkRoute(bool Mark); // Markiert die Route - bool FindTheWay(); // PathFinding - short RotateRight(short Dir); // Richtungskoordinate rechtsrum umrechnen - void SortRoute(); // Die Route in die richtige Reihenfolge bringen - bool CheckRoute(short x, short y, bool save, short Laenge); // Nachprüfen ob auf aktuellem Teil in der Route ist - void ShortRoute(short Zielx, short Ziely); // Macht eine Mini-Route von den Guy.Position zu den Zielk. +namespace Routing { +void MarkRoute(bool Mark); // Markiert die Route +bool FindTheWay(); // PathFinding +short RotateRight(short Dir); // Richtungskoordinate rechtsrum umrechnen +void SortRoute(); // Die Route in die richtige Reihenfolge bringen +bool CheckRoute(short x, short y, bool save, short Laenge); // Nachprüfen ob auf aktuellem Teil in der Route ist +void ShortRoute(short Zielx, short Ziely); // Macht eine Mini-Route von den Guy.Position zu den Zielk. } // namespace Route diff --git a/src/Sound.cpp b/src/Sound.cpp index d3944b3..f0ff4e5 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -1,42 +1,134 @@ #include "Sound.hpp" -namespace Sound +#include "bin/sounds/abspann.wav.hpp" +#include "bin/sounds/angel.wav.hpp" +#include "bin/sounds/baumfaellt.wav.hpp" +#include "bin/sounds/brandung.wav.hpp" +#include "bin/sounds/crash.wav.hpp" +#include "bin/sounds/erfindung.wav.hpp" +#include "bin/sounds/faellen.wav.hpp" +#include "bin/sounds/feuer.wav.hpp" +#include "bin/sounds/fluss.wav.hpp" +#include "bin/sounds/hammer.wav.hpp" +#include "bin/sounds/klick2.wav.hpp" +#include "bin/sounds/klick.wav.hpp" +#include "bin/sounds/knistern.wav.hpp" +#include "bin/sounds/logo.wav.hpp" +#include "bin/sounds/platsch.wav.hpp" +#include "bin/sounds/schaufeln.wav.hpp" +#include "bin/sounds/schlagen.wav.hpp" +#include "bin/sounds/schleuder.wav.hpp" +#include "bin/sounds/schnarchen.wav.hpp" +#include "bin/sounds/schwimmen.wav.hpp" +#include "bin/sounds/sturm.wav.hpp" +#include "bin/sounds/trinken.wav.hpp" +#include "bin/sounds/wald.wav.hpp" +#include "bin/sounds/wolf.wav.hpp" + +#include +#include + +namespace Sound { +static std::vector sound_buffers; // Sound::COUNT - Wavedateispeicher +static std::vector sound_players; // Sound::COUNT + +void Init() { - std::vector sound_buffers; // Sound::COUNT - Wavedateispeicher - std::vector sound_players; // Sound::COUNT + sound_buffers.resize(25); + sound_players.resize(25); +} - void Init() - { - sound_buffers.resize(25); - sound_players.resize(25); +void LoadSound(short Sound) +{ + if (s_SoundState == -1) { // Wenn keine Soundkarte vorhanden raus... + return; } - void LoadSound(short Sound) - { - if (Soundzustand == -1) // Wenn keine Soundkarte vorhanden raus... - return; + // TODO: cleaner, just set directly in the Game.cpp + std::unordered_map datas = { + { "sounds/abspann.wav", resource_abspann_wav_data }, + { "sounds/angel.wav", resource_angel_wav_data }, + { "sounds/baumfaellt.wav", resource_baumfaellt_wav_data }, + { "sounds/brandung.wav", resource_brandung_wav_data }, + { "sounds/crash.wav", resource_crash_wav_data }, + { "sounds/erfindung.wav", resource_erfindung_wav_data }, + { "sounds/faellen.wav", resource_faellen_wav_data }, + { "sounds/feuer.wav", resource_feuer_wav_data }, + { "sounds/fluss.wav", resource_fluss_wav_data }, + { "sounds/hammer.wav", resource_hammer_wav_data }, + { "sounds/klick2.wav", resource_klick2_wav_data }, + { "sounds/klick.wav", resource_klick_wav_data }, + { "sounds/knistern.wav", resource_knistern_wav_data }, + { "sounds/logo.wav", resource_logo_wav_data }, + { "sounds/platsch.wav", resource_platsch_wav_data }, + { "sounds/schaufeln.wav", resource_schaufeln_wav_data }, + { "sounds/schlagen.wav", resource_schlagen_wav_data }, + { "sounds/schleuder.wav", resource_schleuder_wav_data }, + { "sounds/schnarchen.wav", resource_schnarchen_wav_data }, + { "sounds/schwimmen.wav", resource_schwimmen_wav_data }, + { "sounds/sturm.wav", resource_sturm_wav_data }, + { "sounds/trinken.wav", resource_trinken_wav_data }, + { "sounds/wald.wav", resource_wald_wav_data }, + { "sounds/wolf.wav", resource_wolf_wav_data }, + }; + std::unordered_map sizes = { + { "sounds/abspann.wav", resource_abspann_wav_size }, + { "sounds/angel.wav", resource_angel_wav_size }, + { "sounds/baumfaellt.wav", resource_baumfaellt_wav_size }, + { "sounds/brandung.wav", resource_brandung_wav_size }, + { "sounds/crash.wav", resource_crash_wav_size }, + { "sounds/erfindung.wav", resource_erfindung_wav_size }, + { "sounds/faellen.wav", resource_faellen_wav_size }, + { "sounds/feuer.wav", resource_feuer_wav_size }, + { "sounds/fluss.wav", resource_fluss_wav_size }, + { "sounds/hammer.wav", resource_hammer_wav_size }, + { "sounds/klick2.wav", resource_klick2_wav_size }, + { "sounds/klick.wav", resource_klick_wav_size }, + { "sounds/knistern.wav", resource_knistern_wav_size }, + { "sounds/logo.wav", resource_logo_wav_size }, + { "sounds/platsch.wav", resource_platsch_wav_size }, + { "sounds/schaufeln.wav", resource_schaufeln_wav_size }, + { "sounds/schlagen.wav", resource_schlagen_wav_size }, + { "sounds/schleuder.wav", resource_schleuder_wav_size }, + { "sounds/schnarchen.wav", resource_schnarchen_wav_size }, + { "sounds/schwimmen.wav", resource_schwimmen_wav_size }, + { "sounds/sturm.wav", resource_sturm_wav_size }, + { "sounds/trinken.wav", resource_trinken_wav_size }, + { "sounds/wald.wav", resource_wald_wav_size }, + { "sounds/wolf.wav", resource_wolf_wav_size }, + }; - if (!sound_buffers[Sound].loadFromFile(Wav[Sound].Dateiname)) - sf::err() << "Couldn't load sound file '" << Wav[Sound].Dateiname << "'!" << std::endl; + std::unordered_map::const_iterator datait = datas.find(Wav[Sound].Filename); + std::unordered_map::const_iterator sizeit = sizes.find(Wav[Sound].Filename); + if (sizeit == sizes.end() || datait == datas.end()) { + sf::err() << "Couldn't find sound file '" << Wav[Sound].Filename << "'!" << std::endl; + return; + } - sound_players[Sound].setBuffer(sound_buffers[Sound]); - sound_players[Sound].setVolume(static_cast(Wav[Sound].Volume)); - sound_players[Sound].setLoop(Wav[Sound].Loop); + if (!sound_buffers[Sound].loadFromMemory(datait->second, sizeit->second)) { + sf::err() << "Couldn't load sound file '" << Wav[Sound].Filename << "'!" << std::endl; } - void PlaySound(short Sound, short Volume) - { - if ((Sound == 0) || (Soundzustand <= 0) || (sound_players[Sound].getStatus() == sf::Sound::Playing)) - return; + sound_players[Sound].setBuffer(sound_buffers[Sound]); + sound_players[Sound].setVolume(static_cast(Wav[Sound].Volume)); + sound_players[Sound].setLoop(Wav[Sound].Loop); +} - sound_players[Sound].play(); +void PlaySound(short Sound, short Volume) +{ + if ((Sound == 0) || (s_SoundState <= 0) || (sound_players[Sound].getStatus() == sf::Sound::Playing)) { + return; } - void StopSound(short Sound) - { - if ((Sound == 0) || (Soundzustand <= 0)) - return; + sound_players[Sound].play(); +} - sound_players[Sound].stop(); +void StopSound(short Sound) +{ + if ((Sound == 0) || (s_SoundState <= 0)) { + return; } + + sound_players[Sound].stop(); +} } // namespace Sound diff --git a/src/Sound.hpp b/src/Sound.hpp index 8083181..6ab01e3 100644 --- a/src/Sound.hpp +++ b/src/Sound.hpp @@ -3,40 +3,38 @@ #include "headers.hpp" #include "extern.hpp" -namespace Sound -{ - void Init(); - void LoadSound(short Sound); // Lädt einen Sound in den Speicher - void PlaySound(short Sound, short Volume); // Spiel eine Wavedatei mit Prozentualer Lautstärke - void StopSound(short Sound); // Stoppt ein Sound +namespace Sound { +void Init(); +void LoadSound(short Sound); // Lädt einen Sound in den Speicher +void PlaySound(short Sound, short Volume); // Spiel eine Wavedatei mit Prozentualer Lautstärke +void StopSound(short Sound); // Stoppt ein Sound - enum Type - { - NOTHING = 0, - STORM = 1, - SWIM = STORM + 1, - SPLAT = STORM + 2, - LOG = STORM + 3, - HIT = STORM + 4, - SLINGSHOT = STORM + 5, - DIG = STORM + 6, - HAMMER = STORM + 7, - CRASH = STORM + 8, - SNORE = STORM + 9, - DRINK = STORM + 10, - CRACKLE = STORM + 11, - FISH = STORM + 12, - FOREST = 14, - FIRE = FOREST + 1, - SURF = FOREST + 2, - TIMBER = FOREST + 3, - RIVER = FOREST + 4, - CLICK = 19, - CLICK2 = CLICK + 1, - LOGO = CLICK + 2, - OUTRO = CLICK + 3, - WOLF = CLICK + 4, - INVENTION = CLICK + 5, - COUNT = INVENTION + 1, // Number of sounds - }; +enum Type { + NOTHING = 0, + STORM = 1, + SWIM = STORM + 1, + SPLAT = STORM + 2, + LOG = STORM + 3, + HIT = STORM + 4, + SLINGSHOT = STORM + 5, + DIG = STORM + 6, + HAMMER = STORM + 7, + CRASH = STORM + 8, + SNORE = STORM + 9, + DRINK = STORM + 10, + CRACKLE = STORM + 11, + FISH = STORM + 12, + FOREST = 14, + FIRE = FOREST + 1, + SURF = FOREST + 2, + TIMBER = FOREST + 3, + RIVER = FOREST + 4, + CLICK = 19, + CLICK2 = CLICK + 1, + LOGO = CLICK + 2, + OUTRO = CLICK + 3, + WOLF = CLICK + 4, + INVENTION = CLICK + 5, + COUNT = INVENTION + 1, // Number of sounds +}; } // namespace Sound diff --git a/src/State.hpp b/src/State.hpp index 341ffb0..a6e5121 100644 --- a/src/State.hpp +++ b/src/State.hpp @@ -1,14 +1,12 @@ #pragma once -namespace State -{ - enum Type : short - { - NOTHING = 0, - INTRO = 1, - GAME = 2, - OUTRO = 3, - RESCUED = 4, - LOGO = 5, - }; +namespace State { +enum Type : short { + NOTHING = 0, + INTRO = 1, + GAME = 2, + OUTRO = 3, + RESCUED = 4, + LOGO = 5, +}; } diff --git a/src/World.cpp b/src/World.cpp index 78efc20..32ca4e6 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -5,1588 +5,1854 @@ #include "Renderer.hpp" #include "Sound.hpp" #include "State.hpp" +#include "Application.hpp" #include #include -namespace World +namespace World { +RiverRun Rivers[NUMBER_OF_RIVERS][MAX_RIVER_LENGTH]; + +void RawMaterialsDescriptionString(short x, short y, short Objekt) { - FLUSSLAUF Flusslauf[FLUSSANZAHL][MAXFLUSS]; - - void MakeRohString(short x, short y, short Objekt) - { - char TmpString[1024]; - - RohString[0] = char(0); - bool keinRohstoff = true; - if (Objekt == -1) - { - for (short i = 0; i < BILDANZ; i++) - { - if (Scape[x][y].Rohstoff[i] != 0) keinRohstoff = false; + char TmpString[1024]; + + RohString[0] = char(0); + bool keinRohstoff = true; + + if (Objekt == -1) { + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + if (Landscape[x][y].RequiredRawMaterials[i] != 0) { + keinRohstoff = false; } } - else - { - for (short i = 0; i < BILDANZ; i++) - { - if (Bmp[Objekt].Rohstoff[i] != 0) keinRohstoff = false; + } else { + for (short i = 0; i < Tiles::SPRITE_COUNT; i++) { + if (Bmp[Objekt].RequiredRawMaterials[i] != 0) { + keinRohstoff = false; } } - if (keinRohstoff) return; - strcat(RohString, " ->"); - for (short i = 0; i < BILDANZ; i++) - { - if (Objekt == -1) - { - if (Scape[x][y].Rohstoff[i] == 0) - continue; + } + + if (keinRohstoff) { + return; + } + + strcat(RohString, " ->"); + + for (short tile = 0; tile < SPRITE_COUNT; tile++) { + if (Objekt == -1) { + if (Landscape[x][y].RequiredRawMaterials[tile] == 0) { + continue; } - else - { - if (Bmp[Objekt].Rohstoff[i] == 0) - continue; + } else { + if (Bmp[Objekt].RequiredRawMaterials[tile] == 0) { + continue; } - strcat(RohString, " "); - switch (i) - { - case ROHAST: LoadString(g_hInst, AST, TmpString, 1024); - break; - case ROHSTEIN: LoadString(g_hInst, STEIN, TmpString, 1024); - break; - case ROHBLATT: LoadString(g_hInst, BLATT, TmpString, 1024); - break; - case ROHLIANE: LoadString(g_hInst, LIANE, TmpString, 1024); + } + + strcat(RohString, " "); + + const char *name = ""; + switch (tile) { + case Tiles::RAW_TREE_BRANCH: + name = GetLanguageString(AST); + break; + + case Tiles::RAW_STONE: + name = GetLanguageString(STEIN); + break; + + case Tiles::RAW_LEAF: + name = GetLanguageString(STRING_LEAF); + break; + + case Tiles::RAW_LIANA: + name = GetLanguageString(STRING_LIANA); + break; + + case Tiles::RAW_TREE_TRUNK: + name = GetLanguageString(STAMM); + break; + } + + strcat(RohString, name); + strcat(RohString, "="); + + if (Objekt == -1) { + std::sprintf(TmpString, "%d", Landscape[x][y].RequiredRawMaterials[tile]); + } else { + std::sprintf(TmpString, "%d", Bmp[Objekt].RequiredRawMaterials[tile]); + } + + strcat(RohString, TmpString); + } +} + +void AddTime(short h, short m) +{ + Hours += h; + Minutes += m; + + if (Minutes >= 60) { + Minutes -= 60; + Hours++; + } + + for (short y = 0; y < MAX_TILESY; y++) + for (short x = 0; x < MAX_TILES_X; x++) { + // Feuer nach einer bestimmten Zeit ausgehen lassen + if (Landscape[x][y].Object == Tiles::FIRE) { + Landscape[x][y].FireTimer += float((60 * h + m) * 0.0005); + + if (Landscape[x][y].FireTimer >= 1) { + Landscape[x][y].Object = Tiles::INVALID; + Landscape[x][y].FireTimer = 0; + Landscape[x][y].ObjectPosOffset.x = 0; + Landscape[x][y].ObjectPosOffset.y = 0; + Landscape[x][y].AnimationPhase = -1; + Chance -= 2 + 2 * Landscape[x][y].Height; + } + } + + if ((Landscape[x][y].AnimationPhase == -1) || + ((Landscape[x][y].Object != Tiles::FIELD) && + (Landscape[x][y].Object != Tiles::BUSH))) { + continue; // Wenn kein Fruchtobjekt weiter + } + + if (Landscape[x][y].AnimationPhase >= Bmp[Landscape[x][y].Object].AnimationPhaseCount) { + continue; + } + + if (Landscape[x][y].Object == Tiles::FIELD) { + Landscape[x][y].AnimationPhase += float((60 * h + m) * 0.005); + } else if (Landscape[x][y].Object == Tiles::BUSH) { + Landscape[x][y].AnimationPhase += float((60 * h + m) * 0.0005); // pro Minute Reifungsprozess fortführen + } + + if (Landscape[x][y].AnimationPhase > Bmp[Landscape[x][y].Object].AnimationPhaseCount - 1) { + Landscape[x][y].AnimationPhase = static_cast(Bmp[Landscape[x][y].Object].AnimationPhaseCount) - 1; + } + } + + AddResource(Resources::Health, (60 * h + m) * (Guy.ResourceAmount[Resources::Water] - 50 + Guy.ResourceAmount[Resources::Food] - 50) / 1000); + + if ((s_GameState == State::GAME) && (!IsInBoat)) { + for (short i = 0; i <= (60 * h + m); i++) { + if (Chance == 0) { break; - case ROHSTAMM: LoadString(g_hInst, STAMM, TmpString, 1024); + } + + if (rand() % static_cast(1 / (Chance / 72000)) == 1) { + Guy.IsActive = false; + Guy.ActionStep = 0; + Guy.CurrentAction = Action::RESCUED; break; } - strcat(RohString, TmpString); - strcat(RohString, "="); - if (Objekt == -1) std::sprintf(TmpString, "%d", Scape[x][y].Rohstoff[i]); - else std::sprintf(TmpString, "%d", Bmp[Objekt].Rohstoff[i]); - strcat(RohString, TmpString); } } +} - void AddTime(short h, short m) - { - Stunden += h; - Minuten += m; - if (Minuten >= 60) - { - Minuten -= 60; - Stunden++; - } - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - // Feuer nach einer bestimmten Zeit ausgehen lassen - if (Scape[x][y].Objekt == FEUER) - { - Scape[x][y].Timer += float((60 * h + m) * 0.0005); - if (Scape[x][y].Timer >= 1) - { - Scape[x][y].Objekt = -1; - Scape[x][y].Timer = 0; - Scape[x][y].ObPos.x = 0; - Scape[x][y].ObPos.y = 0; - Scape[x][y].Phase = -1; - Chance -= 2 + 2 * Scape[x][y].Hoehe; +void AddResource(short Art, float Anzahl) // Fügt wassser usw hinzu +{ + Guy.ResourceAmount[Art] += Anzahl; + + if (Guy.ResourceAmount[Art] > 100) { + Guy.ResourceAmount[Art] = 100; + } + + if (Guy.ResourceAmount[Art] < 0) { + Guy.ResourceAmount[Art] = 0; + } + + // Wann tod + if ((Guy.ResourceAmount[Resources::Health] <= 0) && (Guy.CurrentAction != Action::DEATH) && + (Guy.CurrentAction != Action::DAY_END) && (s_GameState == State::GAME)) { + Guy.IsActive = false; + Guy.ActionStep = 0; + Guy.CurrentAction = Action::DEATH; + } +} + +void Generate() +{ + // The map background color + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = 2 * MAX_TILES_X; + rcRectdes.bottom = 2 * MAX_TILESY; + sf::Image newContent; + newContent.create(MAX_TILES_X * 2, MAX_TILESY * 2, sf::Color(247, 222, 191)); +// ddbltfx.dwFillColor = Renderer::RGB2DWORD(247, 222, 191); +// lpDDSKarte->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); + + // Die Landschaftshintergrundfarbe + rcRectdes.left = 0; + rcRectdes.top = 0; + rcRectdes.right = MAX_SURFACE_X; + rcRectdes.bottom = MAX_SURFACE_Y; + + Application::clearLandscape(); +// lpDDSScape = Renderer::createEmptyTexture(MAX_SURFACE_X, MAX_SURFACE_Y, sf::Color::Black); +// ddbltfx.dwFillColor = Renderer::RGB2DWORD(0, 0, 0); +// lpDDSScape->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); + + for (short y = 0; y < MAX_TILESY; y++) { + for (short x = 0; x < MAX_TILES_X; x++) { + if (!Landscape[x][y].Discovered) { + continue; // Nicht entdeckte Felder nicht malen + } + + rcRectdes.left = Landscape[x][y].xScreen; + rcRectdes.top = Landscape[x][y].yScreen; + rcRectdes.right = rcRectdes.left + TILE_SIZE_X; + rcRectdes.bottom = rcRectdes.top + TILE_SIZE_Y; + + if (Landscape[x][y].Terrain == 4) { + rcRectsrc.left = TILE_SIZE_X * Landscape[x][y].Type; + rcRectsrc.right = TILE_SIZE_X * Landscape[x][y].Type + TILE_SIZE_X; + rcRectsrc.top = 0; + rcRectsrc.bottom = TILE_SIZE_Y; + } else if (Landscape[x][y].Terrain == 0) { // trockenes Land + rcRectsrc.left = TILE_SIZE_X * Landscape[x][y].Type; + rcRectsrc.right = TILE_SIZE_X * Landscape[x][y].Type + TILE_SIZE_X; + rcRectsrc.top = 4 * TILE_SIZE_Y; + rcRectsrc.bottom = 5 * TILE_SIZE_Y; + } else { + if ((Landscape[x][y].Type == 0) && (Landscape[x][y].Terrain == 1)) { + rcRectsrc.left = 0 * TILE_SIZE_X; + rcRectsrc.top = 3 * TILE_SIZE_Y; + rcRectsrc.right = 1 * TILE_SIZE_X; + rcRectsrc.bottom = 4 * TILE_SIZE_Y; + } + + if ((Landscape[x][y].Type == 0) && (Landscape[x][y].Terrain == 2)) { + rcRectsrc.left = 1 * TILE_SIZE_X; + rcRectsrc.top = 3 * TILE_SIZE_Y; + rcRectsrc.right = 2 * TILE_SIZE_X; + rcRectsrc.bottom = 4 * TILE_SIZE_Y; + } + + if ((Landscape[x][y].Type == 0) && (Landscape[x][y].Terrain == 3)) { + rcRectsrc.left = 2 * TILE_SIZE_X; + rcRectsrc.top = 3 * TILE_SIZE_Y; + rcRectsrc.right = 3 * TILE_SIZE_X; + rcRectsrc.bottom = 4 * TILE_SIZE_Y; + } + } + + // Landschaftskacheln zeichnen + Renderer::BlitToLandscape(lpDDSMisc); + + // Gitter drüberlegen + if (Gitter) { + rcRectsrc.left = TILE_SIZE_X * Landscape[x][y].Type; + rcRectsrc.right = TILE_SIZE_X * Landscape[x][y].Type + TILE_SIZE_X; + rcRectsrc.top = 1 * TILE_SIZE_Y; + rcRectsrc.bottom = 1 * TILE_SIZE_Y + TILE_SIZE_Y; + Renderer::BlitToLandscape(lpDDSMisc); + } + + // Draw landscape objects (if animations are switched off) + if ((!LAnimation) && (Landscape[x][y].Object != Tiles::INVALID)) { + if ((Landscape[x][y].Object >= Tiles::SEA_WAVES) && (Landscape[x][y].Object <= Tiles::FLOODGATE_6)) { + rcRectsrc.left = Bmp[Landscape[x][y].Object].sourceRect.left; + rcRectsrc.right = Bmp[Landscape[x][y].Object].sourceRect.right; + + if (Landscape[x][y].Object == Tiles::SEA_WAVES) { + short i = rand() % 6; + rcRectsrc.top = Bmp[Landscape[x][y].Object].sourceRect.top + i * Bmp[Landscape[x][y].Object].Height; + rcRectsrc.bottom = Bmp[Landscape[x][y].Object].sourceRect.bottom + i * Bmp[Landscape[x][y].Object].Height; + } else { + rcRectsrc.top = Bmp[Landscape[x][y].Object].sourceRect.top; + rcRectsrc.bottom = Bmp[Landscape[x][y].Object].sourceRect.bottom; } + + rcRectdes.left = Landscape[x][y].xScreen + Bmp[Landscape[x][y].Object].targetRect.left; + rcRectdes.right = Landscape[x][y].xScreen + Bmp[Landscape[x][y].Object].targetRect.right; + rcRectdes.top = Landscape[x][y].yScreen + Bmp[Landscape[x][y].Object].targetRect.top; + rcRectdes.bottom = Landscape[x][y].yScreen + Bmp[Landscape[x][y].Object].targetRect.bottom; + // Landschaftsobjekt zeichnen + Renderer::BlitToLandscape(lpDDSAnimation); } - if ((Scape[x][y].Phase == -1) || - ((Scape[x][y].Objekt != FELD) && - (Scape[x][y].Objekt != BUSCH))) - continue; // Wenn kein Fruchtobjekt weiter - if (Scape[x][y].Phase >= Bmp[Scape[x][y].Objekt].Anzahl) continue; - if (Scape[x][y].Objekt == FELD) Scape[x][y].Phase += float((60 * h + m) * 0.005); - else if (Scape[x][y].Objekt == BUSCH) Scape[x][y].Phase += float((60 * h + m) * 0.0005); // pro Minute Reifungsprozess fortführen - if (Scape[x][y].Phase > Bmp[Scape[x][y].Objekt].Anzahl - 1) - Scape[x][y].Phase = static_cast(Bmp[Scape[x][y].Objekt].Anzahl) - 1; } - AddResource(GESUNDHEIT, (60 * h + m) * (Guy.Resource[WASSER] - 50 + Guy.Resource[NAHRUNG] - 50) / 1000); - - if ((Spielzustand == State::GAME) && (!BootsFahrt)) - { - for (short i = 0; i <= (60 * h + m); i++) - { - if (Chance == 0) break; - if (rand() % static_cast(1 / (Chance / 72000)) == 1) + + // MiniMap zeichnen + rcRectdes.left = 2 * x; + rcRectdes.top = 2 * y; + rcRectdes.right = rcRectdes.left + 2; + rcRectdes.bottom = rcRectdes.top + 2; + + sf::Color c; + if ((Landscape[x][y].Terrain == 1) && (Landscape[x][y].Type == 0)) { // Meer + c = sf::Color(228, 207, 182); + } else { + if ((Landscape[x][y].Type == 0) && + ((Landscape[x][y].Terrain == 2) || + (Landscape[x][y].Terrain == 3))) { // Strand + c = sf::Color(112, 103, 93); + } else + // Land { - Guy.Aktiv = false; - Guy.AkNummer = 0; - Guy.Aktion = Action::RESCUED; - break; + c = sf::Color(139 + Landscape[x][y].Height * 20, 128 + Landscape[x][y].Height * 20, 115 + Landscape[x][y].Height * 20); + } + } + +// printf("minimap %d %d\n", rcRectdes.left, rcRectdes.top); + // TODO: more efficient + for (int ix=rcRectdes.left; ixBlt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); } } + lpDDSKarte->loadFromImage(newContent); +} - void AddResource(short Art, float Anzahl) // Fügt wassser usw hinzu - { - Guy.Resource[Art] += Anzahl; - if (Guy.Resource[Art] > 100) Guy.Resource[Art] = 100; - if (Guy.Resource[Art] < 0) Guy.Resource[Art] = 0; - // Wann tod - if ((Guy.Resource[GESUNDHEIT] <= 0) && (Guy.Aktion != Action::DEATH) && - (Guy.Aktion != Action::DAY_END) && (Spielzustand == State::GAME)) - { - Guy.Aktiv = false; - Guy.AkNummer = 0; - Guy.Aktion = Action::DEATH; +void UpdateButtons() +{ + if ((Landscape[Guy.Pos.x][Guy.Pos.y].Object >= Tiles::FIELD) && (Landscape[Guy.Pos.x][Guy.Pos.y].Object <= Tiles::BONFIRE) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase >= Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount) && + (Bmp[Tiles::BUTTON_STOP].AnimationPhase == -1)) { + if (Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase == -1) { + Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase = 0; } + } else { + Bmp[Tiles::BUTTON_CONTINUE].AnimationPhase = -1; } - void Generate() - { - // Die Kartehintergrundfarbe - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = 2 * MAXXKACH; - rcRectdes.bottom = 2 * MAXYKACH; - ddbltfx.dwFillColor = Renderer::RGB2DWORD(247, 222, 191); - lpDDSKarte->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - - // Die Landschaftshintergrundfarbe - rcRectdes.left = 0; - rcRectdes.top = 0; - rcRectdes.right = MAXSCAPEX; - rcRectdes.bottom = MAXSCAPEY; - ddbltfx.dwFillColor = Renderer::RGB2DWORD(0, 0, 0); - lpDDSScape->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); - - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - if (!Scape[x][y].Entdeckt) continue; // Nicht entdeckte Felder nicht malen - - rcRectdes.left = Scape[x][y].xScreen; - rcRectdes.top = Scape[x][y].yScreen; - rcRectdes.right = rcRectdes.left + KXPIXEL; - rcRectdes.bottom = rcRectdes.top + KYPIXEL; - if (Scape[x][y].Art == 4) - { - rcRectsrc.left = KXPIXEL * Scape[x][y].Typ; - rcRectsrc.right = KXPIXEL * Scape[x][y].Typ + KXPIXEL; - rcRectsrc.top = 0; - rcRectsrc.bottom = KYPIXEL; + if ((Bmp[Tiles::BUTTON_STOP].AnimationPhase == -1) && (((Landscape[Guy.Pos.x][Guy.Pos.y].Object == Tiles::BOAT) && + (Landscape[Guy.Pos.x][Guy.Pos.y].AnimationPhase < Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].AnimationPhaseCount)) || + ((IsInBoat) && + (((Landscape[Guy.Pos.x - 1][Guy.Pos.y].Terrain != 1) && (Landscape[Guy.Pos.x - 1][Guy.Pos.y].Object == Tiles::INVALID)) || + ((Landscape[Guy.Pos.x][Guy.Pos.y - 1].Terrain != 1) && (Landscape[Guy.Pos.x][Guy.Pos.y - 1].Object == Tiles::INVALID)) || + ((Landscape[Guy.Pos.x + 1][Guy.Pos.y].Terrain != 1) && (Landscape[Guy.Pos.x + 1][Guy.Pos.y].Object == Tiles::INVALID)) || + ((Landscape[Guy.Pos.x][Guy.Pos.y + 1].Terrain != 1) && (Landscape[Guy.Pos.x][Guy.Pos.y + 1].Object == Tiles::INVALID)))))) { + if (Bmp[Tiles::BUTTON_LAY_DOWN].AnimationPhase == -1) { + Bmp[Tiles::BUTTON_LAY_DOWN].AnimationPhase = 0; + } + } else { + Bmp[Tiles::BUTTON_LAY_DOWN].AnimationPhase = -1; + } +} + +bool CheckRawMaterials() +{ + short Benoetigt = 0; // Anzahl der Gesamtbenötigten Rohstoffe + + for (short i = 0; i < SPRITE_COUNT; i++) { + Benoetigt += Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].RequiredRawMaterials[i]; + } + + float GebrauchtTmp = Benoetigt / static_cast(Bmp[Landscape[Guy.Pos.x][Guy.Pos.y].Object].RequiredActionCases); // Soviel Rohstoffe werden für diesen Schritt benötigt + short Gebraucht = static_cast(GebrauchtTmp * Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep - + static_cast(GebrauchtTmp * (Landscape[Guy.Pos.x][Guy.Pos.y].ConstructionActionStep - 1))); // Soviel Rohstoffe werden für diesen Schritt benötigt + + + while (true) { + bool Check = false; // Wenn kein Rohstoff mehr vorhanden nur noch einmal die While-Schleife + + for (short i = 0; i < SPRITE_COUNT; i++) { + if (Gebraucht == 0) { + return true; + } + + if ((Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i] > 0) && + (Guy.Inventory[i] > 0)) { + Guy.Inventory[i]--; + Landscape[Guy.Pos.x][Guy.Pos.y].RequiredRawMaterials[i]--; + Gebraucht--; + + if (Gebraucht == 0) { + return true; } - else if (Scape[x][y].Art == 0) // trockenes Land - { - rcRectsrc.left = KXPIXEL * Scape[x][y].Typ; - rcRectsrc.right = KXPIXEL * Scape[x][y].Typ + KXPIXEL; - rcRectsrc.top = 4 * KYPIXEL; - rcRectsrc.bottom = 5 * KYPIXEL; + + Check = true; + } + } + + if (Check == false) { + break; + } + } + + PapierText = Renderer::DrawText(ROHSTOFFNICHT, TXTPAPIER, 1); + Guy.ActionStep = 0; + Guy.CurrentAction = Action::CANCEL; + Bmp[Tiles::BUTTON_STOP].AnimationPhase = -1; + return false; +} + +void Compute(short MinimumSize, short maximumSize)// Size of the island in number of land tiles +{ + short i, j; + bool hasFound; + + short Vierecke[13][4][13] = { //0=Passt nicht 1=1runter 2=gleiche Hoehe 3=1hoch + // 0 1 2 3 4 5 6 7 8 9 10 11 12 + { {2, 0, 1, 0, 2, 2, 0, 0, 2, 0, 0, 1, 1},//0 + {2, 1, 0, 2, 0, 0, 0, 2, 2, 0, 1, 1, 0},//1 + /*0*/{2, 0, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 0},//2 Kante + {2, 2, 0, 1, 0, 2, 2, 0, 0, 1, 0, 0, 1} //3 + }, + { {0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0}, + {2, 1, 0, 2, 0, 0, 0, 2, 2, 0, 1, 1, 0}, + /*1*/{0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0}, + {3, 3, 0, 2, 0, 3, 3, 0, 0, 2, 0, 0, 2} + }, + { {2, 0, 1, 0, 2, 2, 0, 0, 2, 0, 0, 1, 1}, + {0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2}, + /*2*/{3, 0, 3, 0, 2, 0, 3, 3, 0, 2, 2, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0} + }, + { {0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0}, + {3, 2, 0, 3, 0, 0, 0, 3, 3, 0, 2, 2, 0}, + /*3*/{0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2}, + {2, 2, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1} + }, + { {3, 0, 2, 0, 3, 3, 0, 0, 3, 0, 0, 2, 2}, + {0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0}, + /*4*/{2, 0, 2, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0}, + {0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0} + },// 0 3 4 5 8 9 10 11 12 + { {0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0}, + {2, 1, 0, 2, 0, 0, 0, 2, 2, 0, 1, 1, 0}, + /*5*/{2, 0, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 0}, + {0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0} + }, + { {2, 0, 1, 0, 2, 2, 0, 0, 2, 0, 0, 1, 1}, + {2, 1, 0, 2, 0, 0, 0, 2, 2, 0, 1, 1, 0}, + /*6*/{0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0}, + {0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0} + }, + { {2, 0, 1, 0, 2, 2, 0, 0, 2, 0, 0, 1, 1}, + {0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2}, + /*7*/{0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2}, + {2, 2, 0, 1, 0, 2, 2, 0, 0, 1, 0, 0, 1} + }, + { {0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0}, + {0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0}, + /*8*/{2, 0, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 0}, + {2, 2, 0, 1, 0, 2, 2, 0, 0, 1, 0, 0, 1} + }, + { {3, 0, 2, 0, 3, 3, 0, 0, 3, 0, 0, 2, 2}, + {3, 2, 0, 3, 0, 0, 0, 3, 3, 0, 2, 2, 0}, + /*9*/{0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2}, + {0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0} + },// 0 3 4 5 8 9 10 11 12 + { {3, 0, 2, 0, 3, 3, 0, 0, 3, 0, 0, 2, 2}, + {0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0}, + /*10*/{0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0}, + {3, 3, 0, 2, 0, 3, 3, 0, 0, 2, 0, 0, 2} + }, + { {0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0}, + {0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2}, + /*11*/{3, 0, 3, 0, 2, 0, 3, 3, 0, 2, 2, 0, 0}, + {3, 3, 0, 2, 0, 3, 3, 0, 0, 2, 0, 0, 2} + }, + { {0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0}, + {3, 2, 0, 3, 0, 0, 0, 3, 3, 0, 2, 2, 0}, + /*12*/{3, 0, 3, 0, 2, 0, 3, 3, 0, 2, 2, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0} + }, + }; + + short MidX = MAX_TILES_X / 2 - 1; + short MidY = MAX_TILESY / 2 - 1; + + for (short m = 0; m < 1000; m++) { // 100mal wiederholen, oder bis eine geeignete Insel gefunden ist + for (short y = 0; y < MAX_TILESY; y++) + for (short x = 0; x < MAX_TILES_X; x++) { + Landscape[x][y].Type = 0; + Landscape[x][y].Terrain = 0; + Landscape[x][y].Height = 0; + Landscape[x][y].Marked = false; + Landscape[x][y].Walkable = true; + Landscape[x][y].Discovered = false; + Landscape[x][y].RunningTime = 1; + Landscape[x][y].Object = Tiles::INVALID; + Landscape[x][y].ReverseAnimation = false; + Landscape[x][y].ObjectPosOffset.x = 0; + Landscape[x][y].ObjectPosOffset.y = 0; + Landscape[x][y].AnimationPhase = -1; + Landscape[x][y].ConstructionActionStep = 0; + Landscape[x][y].GPosAlt.x = 0; + Landscape[x][y].GPosAlt.y = 0; + + for (i = 0; i < SPRITE_COUNT; i++) { + Landscape[x][y].RequiredRawMaterials[i] = 0; } - else - { - if ((Scape[x][y].Typ == 0) && (Scape[x][y].Art == 1)) - { - rcRectsrc.left = 0 * KXPIXEL; - rcRectsrc.top = 3 * KYPIXEL; - rcRectsrc.right = 1 * KXPIXEL; - rcRectsrc.bottom = 4 * KYPIXEL; + + Landscape[x][y].FireTimer = 0; + } + + int x; // Startposition der Berechnung + int y; + Landscape[MidX][MidY].Type = 0; // Gipfel festlegen (Flach) + Landscape[MidX][MidY].Height = MOUNTAIN_HEIGHT; // und mit der Hoehe + + // Spiralring von Innen aus gezählt + for (short l = 0; l <= MidY - 1; l++) { + if (l >= MidX) { + break; + } + + y = MidY - l - 1; + + // Als erstes den oberen Bereich von links nach rechts durchgehen + for (x = MidX - l; x <= MidX + l; x++) { + hasFound = false; + i = 0; + + while (!hasFound) { // Passendes Teil finden und Hoehe festlegen + i += 1; + + if (i == 1000) { + hasFound = true; } - if ((Scape[x][y].Typ == 0) && (Scape[x][y].Art == 2)) - { - rcRectsrc.left = 1 * KXPIXEL; - rcRectsrc.top = 3 * KYPIXEL; - rcRectsrc.right = 2 * KXPIXEL; - rcRectsrc.bottom = 4 * KYPIXEL; + + Landscape[x][y].Type = rand() % 13; + + for (j = 0; j < 10; j++) { + if (!((Landscape[x][y].Type == 0) || (Landscape[x][y].Type == 1))) { + Landscape[x][y].Type = rand() % 13; + } } - if ((Scape[x][y].Typ == 0) && (Scape[x][y].Art == 3)) - { - rcRectsrc.left = 2 * KXPIXEL; - rcRectsrc.top = 3 * KYPIXEL; - rcRectsrc.right = 3 * KXPIXEL; - rcRectsrc.bottom = 4 * KYPIXEL; + + if ((x == MidX - l) || ((x != MidX - l) + && ((Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] != 0) + && (Vierecke[Landscape[x - 1][y].Type][2][Landscape[x][y].Type] != 0)))) { + if (Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] == 1) { + Landscape[x][y].Height = Landscape[x][y + 1].Height - 1; + + if (Landscape[x][y].Height < 0) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + + hasFound = true; + } + + if (Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] == 2) { + Landscape[x][y].Height = Landscape[x][y + 1].Height; + hasFound = true; + } + + if (Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] == 3) { + Landscape[x][y].Height = Landscape[x][y + 1].Height + 1; + hasFound = true; + } + } + + // Verzwickte Fälle ausfiltern + if (((Vierecke[Landscape[x][y].Type][2][3] == 2) && (Vierecke[Landscape[x + 1][y + 1].Type][1][4] == 2)) || + ((Vierecke[Landscape[x][y].Type][2][1] == 2) && (Vierecke[Landscape[x + 1][y + 1].Type][1][2] == 2))) { + hasFound = false; + } + + // Nebeninseln vermeiden + if (((Landscape[x - 1][y].Type == 0) && (Landscape[x - 1][y].Height == 0)) && + ((Landscape[x][y + 1].Type == 0) && (Landscape[x][y + 1].Height == 0))) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; } } - // Landschaftskacheln zeichnen - Renderer::Blitten(lpDDSMisc, lpDDSScape, true); + } - // Gitter drüberlegen - if (Gitter) - { - rcRectsrc.left = KXPIXEL * Scape[x][y].Typ; - rcRectsrc.right = KXPIXEL * Scape[x][y].Typ + KXPIXEL; - rcRectsrc.top = 1 * KYPIXEL; - rcRectsrc.bottom = 1 * KYPIXEL + KYPIXEL; - Renderer::Blitten(lpDDSMisc, lpDDSScape, true); + // Teil rechts-oben + x = MidX + l + 1; + y = MidY - l - 1; + hasFound = false; + i = 0; + + while (!hasFound) { // Passendes Teil finden und Hoehe festlegen + i += 1; + + if (i == 1000) { + hasFound = true; } - // Landschaftsobjekte zeichnen (falls Animationen ausgeschaltet sind) - if ((!LAnimation) && (Scape[x][y].Objekt != -1)) - { - if ((Scape[x][y].Objekt >= MEERWELLEN) && (Scape[x][y].Objekt <= SCHLEUSE6)) - { - rcRectsrc.left = Bmp[Scape[x][y].Objekt].rcSrc.left; - rcRectsrc.right = Bmp[Scape[x][y].Objekt].rcSrc.right; - if (Scape[x][y].Objekt == MEERWELLEN) - { - short i = rand() % 6; - rcRectsrc.top = Bmp[Scape[x][y].Objekt].rcSrc.top + i * Bmp[Scape[x][y].Objekt].Hoehe; - rcRectsrc.bottom = Bmp[Scape[x][y].Objekt].rcSrc.bottom + i * Bmp[Scape[x][y].Objekt].Hoehe; + Landscape[x][y].Type = rand() % 13; + + for (j = 0; j < 10; j++) { + if (!((Landscape[x][y].Type == 0) || (Landscape[x][y].Type == 5))) { + Landscape[x][y].Type = rand() % 13; + } + } + + if (Vierecke[Landscape[x - 1][y].Type][2][Landscape[x][y].Type] == 1) { + Landscape[x][y].Height = Landscape[x - 1][y].Height - 1; + + if (Landscape[x][y].Height < 0) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + + hasFound = true; + } + + if (Vierecke[Landscape[x - 1][y].Type][2][Landscape[x][y].Type] == 2) { + Landscape[x][y].Height = Landscape[x - 1][y].Height; + hasFound = true; + } + + if (Vierecke[Landscape[x - 1][y].Type][2][Landscape[x][y].Type] == 3) { + Landscape[x][y].Height = Landscape[x - 1][y].Height + 1; + hasFound = true; + } + + // Verzwickte Fälle ausfiltern + if (((Vierecke[Landscape[x][y].Type][3][2] == 2) && (Vierecke[Landscape[x - 1][y + 1].Type][2][3] == 2)) || + ((Vierecke[Landscape[x][y].Type][3][4] == 2) && (Vierecke[Landscape[x - 1][y + 1].Type][2][1] == 2))) { + hasFound = false; + } + + // Nebeninseln vermeiden + if ((Landscape[x - 1][y].Type == 0) && (Landscape[x - 1][y].Height == 0)) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + } + + // Den rechten Bereich von oben nach unten durchgehen + x = MidX + l + 1; + + for (y = MidY - l; y <= MidY + l; y++) { + hasFound = false; + i = 0; + + while (!hasFound) { // Passendes Teil finden und Hoehe festlegen + i += 1; + + if (i == 1000) { + hasFound = true; + } + + Landscape[x][y].Type = rand() % 13; + + for (j = 0; j < 10; j++) { + if (!((Landscape[x][y].Type == 0) || (Landscape[x][y].Type == 4))) { + Landscape[x][y].Type = rand() % 13; } - else - { - rcRectsrc.top = Bmp[Scape[x][y].Objekt].rcSrc.top; - rcRectsrc.bottom = Bmp[Scape[x][y].Objekt].rcSrc.bottom; + } + + if ((Vierecke[Landscape[x - 1][y].Type][2][Landscape[x][y].Type] != 0) + && (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] != 0)) { + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 1) { + Landscape[x][y].Height = Landscape[x][y - 1].Height - 1; + + if (Landscape[x][y].Height < 0) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + + hasFound = true; + } + + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 2) { + Landscape[x][y].Height = Landscape[x][y - 1].Height; + hasFound = true; + } + + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 3) { + Landscape[x][y].Height = Landscape[x][y - 1].Height + 1; + hasFound = true; } - rcRectdes.left = Scape[x][y].xScreen + Bmp[Scape[x][y].Objekt].rcDes.left; - rcRectdes.right = Scape[x][y].xScreen + Bmp[Scape[x][y].Objekt].rcDes.right; - rcRectdes.top = Scape[x][y].yScreen + Bmp[Scape[x][y].Objekt].rcDes.top; - rcRectdes.bottom = Scape[x][y].yScreen + Bmp[Scape[x][y].Objekt].rcDes.bottom; - // Landschaftsobjekt zeichnen - Renderer::Blitten(lpDDSAnimation, lpDDSScape, true); } - } - // MiniMap zeichnen - rcRectdes.left = 2 * x; - rcRectdes.top = 2 * y; - rcRectdes.right = rcRectdes.left + 2; - rcRectdes.bottom = rcRectdes.top + 2; + // Verzwickte Fälle ausfiltern + if (((Vierecke[Landscape[x][y].Type][3][2] == 2) && (Vierecke[Landscape[x - 1][y + 1].Type][2][3] == 2)) || + ((Vierecke[Landscape[x][y].Type][3][4] == 2) && (Vierecke[Landscape[x - 1][y + 1].Type][2][1] == 2))) { + hasFound = false; + } - if ((Scape[x][y].Art == 1) && (Scape[x][y].Typ == 0)) // Meer - ddbltfx.dwFillColor = Renderer::RGB2DWORD(228, 207, 182); - else - { - if ((Scape[x][y].Typ == 0) && - ((Scape[x][y].Art == 2) || - (Scape[x][y].Art == 3))) // Strand - ddbltfx.dwFillColor = Renderer::RGB2DWORD(112, 103, 93); - else - // Land - ddbltfx.dwFillColor = Renderer::RGB2DWORD(139 + Scape[x][y].Hoehe * 20, 128 + Scape[x][y].Hoehe * 20, 115 + Scape[x][y].Hoehe * 20); + // Nebeninseln vermeiden + if (((Landscape[x - 1][y].Type == 0) && (Landscape[x - 1][y].Height == 0)) && + ((Landscape[x][y - 1].Type == 0) && (Landscape[x][y - 1].Height == 0))) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } } - lpDDSKarte->Blt(&rcRectdes, nullptr, nullptr, DDBLT_COLORFILL, &ddbltfx); } - } - void CheckSpzButton() - { - if ((Scape[Guy.Pos.x][Guy.Pos.y].Objekt >= FELD) && (Scape[Guy.Pos.x][Guy.Pos.y].Objekt <= FEUERSTELLE) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase >= Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl) && - (Bmp[BUTTSTOP].Phase == -1)) - { - if (Bmp[BUTTWEITER].Phase == -1) Bmp[BUTTWEITER].Phase = 0; - } - else Bmp[BUTTWEITER].Phase = -1; - - if ((Bmp[BUTTSTOP].Phase == -1) && (((Scape[Guy.Pos.x][Guy.Pos.y].Objekt == BOOT) && - (Scape[Guy.Pos.x][Guy.Pos.y].Phase < Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Anzahl)) || - ((BootsFahrt) && - (((Scape[Guy.Pos.x - 1][Guy.Pos.y].Art != 1) && (Scape[Guy.Pos.x - 1][Guy.Pos.y].Objekt == -1)) || - ((Scape[Guy.Pos.x][Guy.Pos.y - 1].Art != 1) && (Scape[Guy.Pos.x][Guy.Pos.y - 1].Objekt == -1)) || - ((Scape[Guy.Pos.x + 1][Guy.Pos.y].Art != 1) && (Scape[Guy.Pos.x + 1][Guy.Pos.y].Objekt == -1)) || - ((Scape[Guy.Pos.x][Guy.Pos.y + 1].Art != 1) && (Scape[Guy.Pos.x][Guy.Pos.y + 1].Objekt == -1)))))) - { - if (Bmp[BUTTABLEGEN].Phase == -1) Bmp[BUTTABLEGEN].Phase = 0; - } - else Bmp[BUTTABLEGEN].Phase = -1; - } + // Teil rechts-unten + x = MidX + l + 1; + y = MidY + l + 1; + hasFound = false; + i = 0; - bool CheckRohstoff() - { - short Benoetigt = 0; // Anzahl der Gesamtbenötigten Rohstoffe - for (short i = 0; i < BILDANZ; i++) Benoetigt += Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].Rohstoff[i]; + while (!hasFound) { // Passendes Teil finden und Hoehe festlegen + i += 1; - float GebrauchtTmp = Benoetigt / static_cast(Bmp[Scape[Guy.Pos.x][Guy.Pos.y].Objekt].AkAnzahl); // Soviel Rohstoffe werden für diesen Schritt benötigt - short Gebraucht = static_cast(GebrauchtTmp * Scape[Guy.Pos.x][Guy.Pos.y].AkNummer - - static_cast(GebrauchtTmp * (Scape[Guy.Pos.x][Guy.Pos.y].AkNummer - 1))); // Soviel Rohstoffe werden für diesen Schritt benötigt + if (i == 1000) { + hasFound = true; + } + Landscape[x][y].Type = rand() % 13; - while (true) - { - bool Check = false; // Wenn kein Rohstoff mehr vorhanden nur noch einmal die While-Schleife - for (short i = 0; i < BILDANZ; i++) - { - if (Gebraucht == 0) return true; - if ((Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i] > 0) && - (Guy.Inventar[i] > 0)) - { - Guy.Inventar[i]--; - Scape[Guy.Pos.x][Guy.Pos.y].Rohstoff[i]--; - Gebraucht--; - if (Gebraucht == 0) return true; - Check = true; + for (j = 0; j < 10; j++) { + if (!((Landscape[x][y].Type == 0) || (Landscape[x][y].Type == 8))) { + Landscape[x][y].Type = rand() % 13; + } + } + + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 1) { + Landscape[x][y].Height = Landscape[x][y - 1].Height - 1; + + if (Landscape[x][y].Height < 0) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + + hasFound = true; + } + + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 2) { + Landscape[x][y].Height = Landscape[x][y - 1].Height; + hasFound = true; + } + + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 3) { + Landscape[x][y].Height = Landscape[x][y - 1].Height + 1; + hasFound = true; + } + + // Verzwickte Fälle ausfiltern + if (((Vierecke[Landscape[x][y].Type][0][1] == 2) && (Vierecke[Landscape[x - 1][y - 1].Type][3][2] == 2)) || + ((Vierecke[Landscape[x][y].Type][0][3] == 2) && (Vierecke[Landscape[x - 1][y - 1].Type][3][4] == 2))) { + hasFound = false; + } + + // Nebeninsel vermeiden + if ((Landscape[x][y - 1].Type == 0) && (Landscape[x][y - 1].Height == 0)) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; } } - if (Check == false) break; - } - PapierText = Renderer::DrawText(ROHSTOFFNICHT, TXTPAPIER, 1); - Guy.AkNummer = 0; - Guy.Aktion = Action::CANCEL; - Bmp[BUTTSTOP].Phase = -1; - return false; - } - void Compute(short MinGroesse, short MaxGroesse) // Groesse der Insel in Anzahl der Landkacheln - { - short i, j; - bool gefunden; - - short Vierecke[13][4][13] = //0=Passt nicht 1=1runter 2=gleiche Hoehe 3=1hoch - {// 0 1 2 3 4 5 6 7 8 9 10 11 12 - {{{2}, {0}, {1}, {0}, {2}, {2}, {0}, {0}, {2}, {0}, {0}, {1}, {1}},//0 - {{2}, {1}, {0}, {2}, {0}, {0}, {0}, {2}, {2}, {0}, {1}, {1}, {0}},//1 - /*0*/{{2}, {0}, {2}, {0}, {1}, {0}, {2}, {2}, {0}, {1}, {1}, {0}, {0}},//2 Kante - {{2}, {2}, {0}, {1}, {0}, {2}, {2}, {0}, {0}, {1}, {0}, {0}, {1}} //3 - }, - {{{0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}}, - {{2}, {1}, {0}, {2}, {0}, {0}, {0}, {2}, {2}, {0}, {1}, {1}, {0}}, - /*1*/{{0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {0}, {2}, {0}}, - {{3}, {3}, {0}, {2}, {0}, {3}, {3}, {0}, {0}, {2}, {0}, {0}, {2}} - }, - {{{2}, {0}, {1}, {0}, {2}, {2}, {0}, {0}, {2}, {0}, {0}, {1}, {1}}, - {{0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {0}, {2}}, - /*2*/{{3}, {0}, {3}, {0}, {2}, {0}, {3}, {3}, {0}, {2}, {2}, {0}, {0}}, - {{0}, {0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}} - }, - {{{0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {2}, {0}, {0}, {0}}, - {{3}, {2}, {0}, {3}, {0}, {0}, {0}, {3}, {3}, {0}, {2}, {2}, {0}}, - /*3*/{{0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}}, - {{2}, {2}, {0}, {1}, {0}, {0}, {2}, {0}, {0}, {1}, {0}, {0}, {1}} - }, - {{{3}, {0}, {2}, {0}, {3}, {3}, {0}, {0}, {3}, {0}, {0}, {2}, {2}}, - {{0}, {0}, {0}, {0}, {2}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}}, - /*4*/{{2}, {0}, {2}, {0}, {0}, {0}, {2}, {2}, {0}, {1}, {1}, {0}, {0}}, - {{0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {2}, {0}, {0}} - },// 0 1 2 3 4 5 6 7 8 9 10 11 12 - {{{0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}}, - {{2}, {1}, {0}, {2}, {0}, {0}, {0}, {2}, {2}, {0}, {1}, {1}, {0}}, - /*5*/{{2}, {0}, {2}, {0}, {1}, {0}, {2}, {2}, {0}, {1}, {1}, {0}, {0}}, - {{0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {2}, {0}, {0}} - }, - {{{2}, {0}, {1}, {0}, {2}, {2}, {0}, {0}, {2}, {0}, {0}, {1}, {1}}, - {{2}, {1}, {0}, {2}, {0}, {0}, {0}, {2}, {2}, {0}, {1}, {1}, {0}}, - /*6*/{{0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {0}, {2}, {0}}, - {{0}, {0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}} - }, - {{{2}, {0}, {1}, {0}, {2}, {2}, {0}, {0}, {2}, {0}, {0}, {1}, {1}}, - {{0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {0}, {2}}, - /*7*/{{0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}}, - {{2}, {2}, {0}, {1}, {0}, {2}, {2}, {0}, {0}, {1}, {0}, {0}, {1}} - }, - {{{0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {2}, {0}, {0}, {0}}, - {{0}, {0}, {0}, {0}, {2}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}}, - /*8*/{{2}, {0}, {2}, {0}, {1}, {0}, {2}, {2}, {0}, {1}, {1}, {0}, {0}}, - {{2}, {2}, {0}, {1}, {0}, {2}, {2}, {0}, {0}, {1}, {0}, {0}, {1}} - }, - {{{3}, {0}, {2}, {0}, {3}, {3}, {0}, {0}, {3}, {0}, {0}, {2}, {2}}, - {{3}, {2}, {0}, {3}, {0}, {0}, {0}, {3}, {3}, {0}, {2}, {2}, {0}}, - /*9*/{{0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}}, - {{0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {2}, {0}, {0}} - },// 0 1 2 3 4 5 6 7 8 9 10 11 12 - {{{3}, {0}, {2}, {0}, {3}, {3}, {0}, {0}, {3}, {0}, {0}, {2}, {2}}, - {{0}, {0}, {0}, {0}, {2}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}}, - /*10*/{{0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {0}, {2}, {0}}, - {{3}, {3}, {0}, {2}, {0}, {3}, {3}, {0}, {0}, {2}, {0}, {0}, {2}} - }, - {{{0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}}, - {{0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {0}, {0}, {2}}, - /*11*/{{3}, {0}, {3}, {0}, {2}, {0}, {3}, {3}, {0}, {2}, {2}, {0}, {0}}, - {{3}, {3}, {0}, {2}, {0}, {3}, {3}, {0}, {0}, {2}, {0}, {0}, {2}} - }, - {{{0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}, {2}, {0}, {0}, {0}}, - {{3}, {2}, {0}, {3}, {0}, {0}, {0}, {3}, {3}, {0}, {2}, {2}, {0}}, - /*12*/{{3}, {0}, {3}, {0}, {2}, {0}, {3}, {3}, {0}, {2}, {2}, {0}, {0}}, - {{0}, {0}, {2}, {0}, {0}, {0}, {0}, {2}, {0}, {0}, {0}, {2}, {0}} - }, - }; - - short Mittex = MAXXKACH / 2 - 1; - short Mittey = MAXYKACH / 2 - 1; - - for (short m = 0; m < 1000; m++) // 100mal wiederholen, oder bis eine geeignete Insel gefunden ist - { - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - Scape[x][y].Typ = 0; - Scape[x][y].Art = 0; - Scape[x][y].Hoehe = 0; - Scape[x][y].Markiert = false; - Scape[x][y].Begehbar = true; - Scape[x][y].Entdeckt = false; - Scape[x][y].LaufZeit = 1; - Scape[x][y].Objekt = -1; - Scape[x][y].Reverse = false; - Scape[x][y].ObPos.x = 0; - Scape[x][y].ObPos.y = 0; - Scape[x][y].Phase = -1; - Scape[x][y].AkNummer = 0; - Scape[x][y].GPosAlt.x = 0; - Scape[x][y].GPosAlt.y = 0; - for (i = 0; i < BILDANZ; i++) Scape[x][y].Rohstoff[i] = 0; - Scape[x][y].Timer = 0; - } - - short x; // Startposition der Berechnung - short y; - Scape[Mittex][Mittey].Typ = 0; // Gipfel festlegen (Flach) - Scape[Mittex][Mittey].Hoehe = GIPFEL; // und mit der Hoehe - - // Spiralring von Innen aus gezählt - for (short l = 0; l <= Mittey - 1; l++) - { - if (l >= Mittex) break; - y = Mittey - l - 1; - // Als erstes den oberen Bereich von links nach rechts durchgehen - for (x = Mittex - l; x <= Mittex + l; x++) - { - gefunden = false; - i = 0; - while (!gefunden) // Passendes Teil finden und Hoehe festlegen - { - i += 1; - if (i == 1000) { gefunden = true; } - - Scape[x][y].Typ = rand() % 13; - for (j = 0; j < 10; j++) - { - if (!((Scape[x][y].Typ == 0) || (Scape[x][y].Typ == 1))) - { - Scape[x][y].Typ = rand() % 13; - } + // Den unteren Bereich von rechts nach links durchgehen + y = MidY + l + 1; + + for (x = MidX + l; x >= MidX - l; x--) { + hasFound = false; + i = 0; + + while (!hasFound) { // Passendes Teil finden und Hoehe festlegen + i += 1; + + if (i == 1000) { + hasFound = true; + } + + Landscape[x][y].Type = rand() % 13; + + for (j = 0; j < 10; j++) { + if (!((Landscape[x][y].Type == 0) || (Landscape[x][y].Type == 3))) { + Landscape[x][y].Type = rand() % 13; } + } - if ((x == Mittex - l) || ((x != Mittex - l) - && ((Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] != 0) - && (Vierecke[Scape[x - 1][y].Typ][2][Scape[x][y].Typ] != 0)))) - { - if (Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] == 1) - { - Scape[x][y].Hoehe = Scape[x][y + 1].Hoehe - 1; - if (Scape[x][y].Hoehe < 0) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } - gefunden = true; - } - if (Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] == 2) - { - Scape[x][y].Hoehe = Scape[x][y + 1].Hoehe; - gefunden = true; + if ((Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] != 0) + && (Vierecke[Landscape[x + 1][y].Type][0][Landscape[x][y].Type] != 0)) { + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 1) { + Landscape[x][y].Height = Landscape[x][y - 1].Height - 1; + + if (Landscape[x][y].Height < 0) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; } - if (Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] == 3) - { - Scape[x][y].Hoehe = Scape[x][y + 1].Hoehe + 1; - gefunden = true; + + hasFound = true; + } + + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 2) { + Landscape[x][y].Height = Landscape[x][y - 1].Height; + hasFound = true; + } + + if (Vierecke[Landscape[x][y - 1].Type][3][Landscape[x][y].Type] == 3) { + Landscape[x][y].Height = Landscape[x][y - 1].Height + 1; + hasFound = true; + } + } + + // Verzwickte Fälle ausfiltern + if (((Vierecke[Landscape[x][y].Type][0][1] == 2) && (Vierecke[Landscape[x - 1][y - 1].Type][3][2] == 2)) || + ((Vierecke[Landscape[x][y].Type][0][3] == 2) && (Vierecke[Landscape[x - 1][y - 1].Type][3][4] == 2))) { + hasFound = false; + } + + // Nebeninseln vermeiden + if (((Landscape[x + 1][y].Type == 0) && (Landscape[x + 1][y].Height == 0)) && + ((Landscape[x][y - 1].Type == 0) && (Landscape[x][y - 1].Height == 0))) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + } + } + + //Teil links-unten + x = MidX - l - 1; + y = MidY + l + 1; + hasFound = false; + i = 0; + + while (!hasFound) { // Passendes Teil finden und Hoehe festlegen + i += 1; + + if (i == 1000) { + hasFound = true; + } + + Landscape[x][y].Type = rand() % 13; + + for (j = 0; j < 10; j++) { + if (!((Landscape[x][y].Type == 0) || (Landscape[x][y].Type == 7))) { + Landscape[x][y].Type = rand() % 13; + } + } + + if (Vierecke[Landscape[x + 1][y].Type][0][Landscape[x][y].Type] == 1) { + Landscape[x][y].Height = Landscape[x + 1][y].Height - 1; + + if (Landscape[x][y].Height < 0) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + + hasFound = true; + } + + if (Vierecke[Landscape[x + 1][y].Type][0][Landscape[x][y].Type] == 2) { + Landscape[x][y].Height = Landscape[x + 1][y].Height; + hasFound = true; + } + + if (Vierecke[Landscape[x + 1][y].Type][0][Landscape[x][y].Type] == 3) { + Landscape[x][y].Height = Landscape[x + 1][y].Height + 1; + hasFound = true; + } + + // Verzwickte Fälle ausfiltern + if (((Vierecke[Landscape[x][y].Type][1][2] == 2) && (Vierecke[Landscape[x + 1][y - 1].Type][0][3] == 2)) || + ((Vierecke[Landscape[x][y].Type][1][4] == 2) && (Vierecke[Landscape[x + 1][y - 1].Type][0][1] == 2))) { + hasFound = false; + } + + // Nebeninsel vermeiden + if ((Landscape[x + 1][y].Type == 0) && (Landscape[x + 1][y].Height == 0)) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + } + + // Den linken Bereich von unten nach oben durchgehen + x = MidX - l - 1; + + for (y = MidY + l; y >= MidY - l - 1; y--) { + hasFound = false; + i = 0; + + while (!hasFound) { // Passendes Teil finden und Hoehe festlegen + i += 1; + + if (i == 1000) { + hasFound = true; + } + + Landscape[x][y].Type = rand() % 13; + + for (j = 0; j < 10; j++) { + if (!((Landscape[x][y].Type == 0) || (Landscape[x][y].Type == 2))) { + Landscape[x][y].Type = rand() % 13; + } + } + + if ((Vierecke[Landscape[x + 1][y].Type][0][Landscape[x][y].Type] != 0) + && (Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] != 0)) { + if (Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] == 1) { + Landscape[x][y].Height = Landscape[x][y + 1].Height - 1; + + if (Landscape[x][y].Height < 0) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; } + + hasFound = true; } - // Verzwickte Fälle ausfiltern - if (((Vierecke[Scape[x][y].Typ][2][3] == 2) && (Vierecke[Scape[x + 1][y + 1].Typ][1][4] == 2)) || - ((Vierecke[Scape[x][y].Typ][2][1] == 2) && (Vierecke[Scape[x + 1][y + 1].Typ][1][2] == 2))) - { - gefunden = false; + + if (Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] == 2) { + Landscape[x][y].Height = Landscape[x][y + 1].Height; + hasFound = true; } - // Nebeninseln vermeiden - if (((Scape[x - 1][y].Typ == 0) && (Scape[x - 1][y].Hoehe == 0)) && - ((Scape[x][y + 1].Typ == 0) && (Scape[x][y + 1].Hoehe == 0))) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; + + if (Vierecke[Landscape[x][y + 1].Type][1][Landscape[x][y].Type] == 3) { + Landscape[x][y].Height = Landscape[x][y + 1].Height + 1; + hasFound = true; } } + + // Filter out tricky cases + if (((Vierecke[Landscape[x][y].Type][1][2] == 2) && (y > 0 && Vierecke[Landscape[x + 1][y - 1].Type][0][3] == 2)) || + ((Vierecke[Landscape[x][y].Type][1][4] == 2) && (y > 0 && Vierecke[Landscape[x + 1][y - 1].Type][0][1] == 2))) { + hasFound = false; + } + + // Avoid secondary islands + if (((Landscape[x + 1][y].Type == 0) && (Landscape[x + 1][y].Height == 0)) && + ((Landscape[x][y + 1].Type == 0) && (Landscape[x][y + 1].Height == 0))) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + } + } + } + } + + short Anzahl = 0; // Anzahl der Landstücke + bool CheckRand = true; // Reicht die Insel bis zum Rand? + + for (y = 0; y < MAX_TILESY; y++) // Landfläche zählen + for (x = 0; x < MAX_TILES_X; x++) { + if (Landscape[x][y].Height > 0) { + Anzahl++; + } + + if (Landscape[x][y].Type == 0) { + Landscape[x][y].RunningTime = 1; + } else { + Landscape[x][y].RunningTime = 2; + } + + if ((Landscape[x][y].Type != 0) && + ((x <= 2) || (x >= MAX_TILES_X - 2) || (y <= 2) || (y >= MAX_TILESY - 2))) { + CheckRand = false; + } + } + + if ((Anzahl > MinimumSize) && (Anzahl < maximumSize) && (CheckRand)) { + break; + } + } +} + +void CreateSea() // Das Meer und den Strand bestimmen +{ + short x, y; + + for (y = 0; y < MAX_TILESY; y++) // Meer rausfinden + for (x = 0; x < MAX_TILES_X; x++) { + if ((Landscape[x][y].Height < 0) || + ((Landscape[x][y].Height == 0) && (Landscape[x][y].Type == 0))) { + Landscape[x][y].Type = 0; + Landscape[x][y].Height = 0; + Landscape[x][y].Terrain = 1; + Landscape[x][y].Object = Tiles::SEA_WAVES; + Landscape[x][y].ObjectPosOffset.x = static_cast(Bmp[Tiles::SEA_WAVES].targetRect.left); + Landscape[x][y].ObjectPosOffset.y = static_cast(Bmp[Tiles::SEA_WAVES].targetRect.top); + + if (rand() % 2 == 0) { + Landscape[x][y].ReverseAnimation = true; + } + + Landscape[x][y].Walkable = false; + Landscape[x][y].AnimationPhase = static_cast(Bmp[Landscape[x][y].Object].AnimationPhaseCount - + rand() % (Bmp[Landscape[x][y].Object].AnimationPhaseCount) - 1); + } + } + + for (y = 1; y < MAX_TILESY - 1; y++) // Strand rausfinden + for (x = 1; x < MAX_TILES_X - 1; x++) { // Alle Möglichkeiten durchgehen + if ((Landscape[x][y].Type == 0) && (Landscape[x][y].Height == 0)) { + short Anzahl = 0; // Anzahl von angrenzenden Landstücken rausfinden + + if (Landscape[x - 1][y].Type != 0) { + Anzahl++; + } + + if (Landscape[x - 1][y - 1].Type != 0) { + Anzahl++; + } + + if (Landscape[x][y - 1].Type != 0) { + Anzahl++; + } + + if (Landscape[x + 1][y - 1].Type != 0) { + Anzahl++; + } + + if (Landscape[x + 1][y].Type != 0) { + Anzahl++; + } + + if (Landscape[x + 1][y + 1].Type != 0) { + Anzahl++; + } + + if (Landscape[x][y + 1].Type != 0) { + Anzahl++; + } + + if (Landscape[x - 1][y + 1].Type != 0) { + Anzahl++; + } + + if ((Anzahl >= 1) && (Anzahl < 6)) { + Landscape[x][y].Terrain = 2; + Landscape[x][y].Object = Tiles::INVALID; + Landscape[x][y].ReverseAnimation = false; + Landscape[x][y].Walkable = true; + Landscape[x][y].AnimationPhase = -1; + continue; + } + + if (Anzahl >= 6) { + Landscape[x][y].Terrain = 3; + Landscape[x][y].Object = Tiles::INVALID; + Landscape[x][y].ReverseAnimation = false; + Landscape[x][y].Walkable = false; + Landscape[x][y].AnimationPhase = -1; + continue; + } + + Landscape[x][y].Terrain = 1; // sonst Meer + Landscape[x][y].Object = Tiles::SEA_WAVES; + Landscape[x][y].ObjectPosOffset.x = static_cast(Bmp[Tiles::SEA_WAVES].targetRect.left); + Landscape[x][y].ObjectPosOffset.y = static_cast(Bmp[Tiles::SEA_WAVES].targetRect.top); + Landscape[x][y].AnimationPhase = static_cast(Bmp[Landscape[x][y].Object].AnimationPhaseCount - + rand() % (Bmp[Landscape[x][y].Object].AnimationPhaseCount) - 1); + + if (rand() % 2 == 0) { + Landscape[x][y].ReverseAnimation = true; + } + + Landscape[x][y].Walkable = false; + } + } +} + +void ToggleIsInBoat() +{ + IsInBoat = !IsInBoat; + + // Begehbarkeit umdrehen + for (short y = 0; y < MAX_TILESY; y++) { + for (short x = 0; x < MAX_TILES_X; x++) { + Landscape[x][y].Walkable = !Landscape[x][y].Walkable; + } + } +} + +void CheckPipe(short x, short y) +{ + Landscape[x][y].AnimationPhase = 1; + + if (Landscape[x][y].Terrain == 0) { + Landscape[x][y].Terrain = 4; + } + + if (Landscape[x - 1][y].Terrain == 0) { + Landscape[x - 1][y].Terrain = 4; + } + + if (Landscape[x - 1][y - 1].Terrain == 0) { + Landscape[x - 1][y - 1].Terrain = 4; + } + + if (Landscape[x][y - 1].Terrain == 0) { + Landscape[x][y - 1].Terrain = 4; + } + + if (Landscape[x + 1][y - 1].Terrain == 0) { + Landscape[x + 1][y - 1].Terrain = 4; + } + + if (Landscape[x + 1][y].Terrain == 0) { + Landscape[x + 1][y].Terrain = 4; + } + + if (Landscape[x + 1][y + 1].Terrain == 0) { + Landscape[x + 1][y + 1].Terrain = 4; + } + + if (Landscape[x][y + 1].Terrain == 0) { + Landscape[x][y + 1].Terrain = 4; + } + + if (Landscape[x - 1][y + 1].Terrain == 0) { + Landscape[x - 1][y + 1].Terrain = 4; + } + + if ((Landscape[x - 1][y].Object == Tiles::PIPE) && (Landscape[x - 1][y].AnimationPhase == 0)) { + CheckPipe(x - 1, y); + } + + if ((Landscape[x][y - 1].Object == Tiles::PIPE) && (Landscape[x][y - 1].AnimationPhase == 0)) { + CheckPipe(x, y - 1); + } + + if ((Landscape[x + 1][y].Object == Tiles::PIPE) && (Landscape[x + 1][y].AnimationPhase == 0)) { + CheckPipe(x + 1, y); + } + + if ((Landscape[x][y + 1].Object == Tiles::PIPE) && (Landscape[x][y + 1].AnimationPhase == 0)) { + CheckPipe(x, y + 1); + } +} + +void FillPipe() +{ + for (short y = 0; y < MAX_TILESY; y++) + for (short x = 0; x < MAX_TILES_X; x++) { + if ((Landscape[x][y].Object == Tiles::PIPE) && (Landscape[x][y].AnimationPhase < Bmp[Tiles::PIPE].AnimationPhaseCount)) { + Landscape[x][y].AnimationPhase = 0; + } + + if (Landscape[x][y].Terrain == 4) { + Landscape[x][y].Terrain = 0; + } + + if ((Landscape[x][y].Object >= Tiles::FLOODGATE_1) && (Landscape[x][y].Object <= Tiles::FLOODGATE_6)) { + Landscape[x][y].Object -= 14; + Landscape[x][y].ObjectPosOffset.x = static_cast(Bmp[Landscape[x][y].Object].targetRect.left); + Landscape[x][y].ObjectPosOffset.y = static_cast(Bmp[Landscape[x][y].Object].targetRect.top); + } + } + + // StartRohr finden + for (short y = 0; y < MAX_TILESY; y++) + for (short x = 0; x < MAX_TILES_X; x++) { + if ((Landscape[x][y].Object >= Tiles::RIVER_1) && (Landscape[x][y].Object <= Tiles::FLOODGATE_6)) { + if (Landscape[x][y].Terrain == 0) { + Landscape[x][y].Terrain = 4; + } + + if (Landscape[x - 1][y].Terrain == 0) { + Landscape[x - 1][y].Terrain = 4; + } + + if (Landscape[x - 1][y - 1].Terrain == 0) { + Landscape[x - 1][y - 1].Terrain = 4; + } + + if (Landscape[x][y - 1].Terrain == 0) { + Landscape[x][y - 1].Terrain = 4; + } + + if (Landscape[x + 1][y - 1].Terrain == 0) { + Landscape[x + 1][y - 1].Terrain = 4; + } + + if (Landscape[x + 1][y].Terrain == 0) { + Landscape[x + 1][y].Terrain = 4; + } + + if (Landscape[x + 1][y + 1].Terrain == 0) { + Landscape[x + 1][y + 1].Terrain = 4; + } + + if (Landscape[x][y + 1].Terrain == 0) { + Landscape[x][y + 1].Terrain = 4; + } + + if (Landscape[x - 1][y + 1].Terrain == 0) { + Landscape[x - 1][y + 1].Terrain = 4; + } + } + + if ((Landscape[x][y].Object != Tiles::PIPE) || (Landscape[x][y].AnimationPhase >= Bmp[Tiles::PIPE].AnimationPhaseCount)) { + continue; + } + + if ((Landscape[x - 1][y].Object >= Tiles::RIVER_5) && (Landscape[x - 1][y].Object <= Tiles::RIVER_10)) { + Landscape[x - 1][y].Object += 14; + Landscape[x - 1][y].ObjectPosOffset.x = static_cast(Bmp[Landscape[x - 1][y].Object].targetRect.left); + Landscape[x - 1][y].ObjectPosOffset.y = static_cast(Bmp[Landscape[x - 1][y].Object].targetRect.top); + CheckPipe(x, y); + } else if ((Landscape[x - 1][y].Object >= Tiles::FLOODGATE_1) && (Landscape[x - 1][y].Object <= Tiles::FLOODGATE_6)) { + CheckPipe(x, y); + } + + if ((Landscape[x][y - 1].Object >= Tiles::RIVER_5) && (Landscape[x][y - 1].Object <= Tiles::RIVER_10)) { + Landscape[x][y - 1].Object += 14; + Landscape[x][y - 1].ObjectPosOffset.x = static_cast(Bmp[Landscape[x][y - 1].Object].targetRect.left); + Landscape[x][y - 1].ObjectPosOffset.y = static_cast(Bmp[Landscape[x][y - 1].Object].targetRect.top); + CheckPipe(x, y); + } else if ((Landscape[x][y - 1].Object >= Tiles::FLOODGATE_1) && (Landscape[x][y - 1].Object <= Tiles::FLOODGATE_6)) { + CheckPipe(x, y); + } + + if ((Landscape[x + 1][y].Object >= Tiles::RIVER_5) && (Landscape[x + 1][y].Object <= Tiles::RIVER_10)) { + Landscape[x + 1][y].Object += 14; + Landscape[x + 1][y].ObjectPosOffset.x = static_cast(Bmp[Landscape[x + 1][y].Object].targetRect.left); + Landscape[x + 1][y].ObjectPosOffset.y = static_cast(Bmp[Landscape[x + 1][y].Object].targetRect.top); + CheckPipe(x, y); + } else if ((Landscape[x + 1][y].Object >= Tiles::FLOODGATE_1) && (Landscape[x + 1][y].Object <= Tiles::FLOODGATE_6)) { + CheckPipe(x, y); + } + + if ((Landscape[x][y + 1].Object >= Tiles::RIVER_5) && (Landscape[x][y + 1].Object <= Tiles::RIVER_10)) { + Landscape[x][y + 1].Object += 14; + Landscape[x][y + 1].ObjectPosOffset.x = static_cast(Bmp[Landscape[x][y + 1].Object].targetRect.left); + Landscape[x][y + 1].ObjectPosOffset.y = static_cast(Bmp[Landscape[x][y + 1].Object].targetRect.top); + CheckPipe(x, y); + } else if ((Landscape[x][y + 1].Object >= Tiles::FLOODGATE_1) && (Landscape[x][y + 1].Object <= Tiles::FLOODGATE_6)) { + CheckPipe(x, y); + } + } + + // Felder auf trockenen Wiesen löschen + for (short y = 0; y < MAX_TILESY; y++) { + for (short x = 0; x < MAX_TILES_X; x++) { + if ((Landscape[x][y].Object == Tiles::FIELD) && (Landscape[x][y].Terrain == 0)) { + Landscape[x][y].Object = Tiles::INVALID; + Landscape[x][y].ObjectPosOffset.x = 0; + Landscape[x][y].ObjectPosOffset.y = 0; + Landscape[x][y].AnimationPhase = -1; + Landscape[x][y].ConstructionActionStep = 0; + } + } + } + + Generate(); +} + +bool CheckRiverFlow(short x, short y) // Nachprüfen ob auf aktuellem Teil ein Fluss ist (Nur für die Fluss-Routine) +{ + for (short i = 0; i < NUMBER_OF_RIVERS; i++) { + for (short j = 0; j < MAX_RIVER_LENGTH; j++) { + if ((x == Rivers[i][j].x) && (y == Rivers[i][j].y)) { + return true; + } + } + } + + return false; +} + +void CreateRiver() // Number of rivers and the minimum length +{ + short i; + short l = 0; + short direction = 0; // Current flow direction from 0-3 + short x0 = 0; + short y0 = 0; + short x1 = 0; + short y1 = 0; + short x2 = 0; // x2,y2 Coordinate of the part to be tested + short y2 = 0; + bool hasFound = false; + RiverRun flowTmp[MAX_RIVER_LENGTH]; // To cache the experiment + short riverLength[NUMBER_OF_RIVERS]; + + for (short m = 0; m < NUMBER_OF_RIVERS; m++) + for (short j = 0; j < MAX_RIVER_LENGTH; j++) { + Rivers[m][j].x = -1; + Rivers[m][j].y = -1; + } + + for (short m = 0; m < NUMBER_OF_RIVERS; m++) { + bool isComplete = false; + short tmpLength = 0; + + for (short j = 0; j < MAX_RIVER_LENGTH; j++) { + flowTmp[j].x = -1; + flowTmp[j].y = -1; + } + + for (short k = 0; k < 1000; k++) { + for (short o = 0; o < 10000; o++) { + hasFound = true; + + x0 = rand() % MAX_TILES_X; // determine appropriate source/spring + y0 = rand() % MAX_TILESY; + + if (CheckRiverFlow(x0, y0)) { + hasFound = false; + } + + if ((Landscape[x0][y0].Type != 0) || + (Landscape[x0][y0].Height < 2)) { + hasFound = false; + } + + if (hasFound) { + break; } + } - // Teil rechts-oben - x = Mittex + l + 1; - y = Mittey - l - 1; - gefunden = false; - i = 0; - while (!gefunden) // Passendes Teil finden und Hoehe festlegen - { - i += 1; - if (i == 1000) { gefunden = true; } - - Scape[x][y].Typ = rand() % 13; - for (j = 0; j < 10; j++) - { - if (!((Scape[x][y].Typ == 0) || (Scape[x][y].Typ == 5))) - { - Scape[x][y].Typ = rand() % 13; - } - } + if (!hasFound) { +// MessageBeep(MB_OK); + break; + } // Wenn keine Quelle mehr gefunden aufhören - if (Vierecke[Scape[x - 1][y].Typ][2][Scape[x][y].Typ] == 1) - { - Scape[x][y].Hoehe = Scape[x - 1][y].Hoehe - 1; - if (Scape[x][y].Hoehe < 0) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } - gefunden = true; - } - if (Vierecke[Scape[x - 1][y].Typ][2][Scape[x][y].Typ] == 2) - { - Scape[x][y].Hoehe = Scape[x - 1][y].Hoehe; - gefunden = true; - } - if (Vierecke[Scape[x - 1][y].Typ][2][Scape[x][y].Typ] == 3) - { - Scape[x][y].Hoehe = Scape[x - 1][y].Hoehe + 1; - gefunden = true; - } - // Verzwickte Fälle ausfiltern - if (((Vierecke[Scape[x][y].Typ][3][2] == 2) && (Vierecke[Scape[x - 1][y + 1].Typ][2][3] == 2)) || - ((Vierecke[Scape[x][y].Typ][3][4] == 2) && (Vierecke[Scape[x - 1][y + 1].Typ][2][1] == 2))) - { - gefunden = false; - } - // Nebeninseln vermeiden - if ((Scape[x - 1][y].Typ == 0) && (Scape[x - 1][y].Hoehe == 0)) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } + Rivers[m][0].x = x0; + Rivers[m][0].y = y0; + bool Strand = false; + + for (i = 1; i < MAX_RIVER_LENGTH; i++) { + hasFound = false; + + if (!Strand) { + direction = rand() % 4; // Auf dem Strand geradeausfliessen } - // Den rechten Bereich von oben nach unten durchgehen - x = Mittex + l + 1; - for (y = Mittey - l; y <= Mittey + l; y++) - { - gefunden = false; - i = 0; - while (!gefunden) // Passendes Teil finden und Hoehe festlegen - { - i += 1; - if (i == 1000) { gefunden = true; } - - Scape[x][y].Typ = rand() % 13; - for (j = 0; j < 10; j++) - { - if (!((Scape[x][y].Typ == 0) || (Scape[x][y].Typ == 4))) - { - Scape[x][y].Typ = rand() % 13; - } - } + for (short l2 = 0; l2 < 4; l2++) { + l = (direction + l2) % 4; // Im Urzeigersinn nachprüfen und bei der vorgegeben Richtung anfangen - if ((Vierecke[Scape[x - 1][y].Typ][2][Scape[x][y].Typ] != 0) - && (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] != 0)) - { - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 1) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe - 1; - if (Scape[x][y].Hoehe < 0) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } - gefunden = true; - } - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 2) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe; - gefunden = true; - } - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 3) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe + 1; - gefunden = true; + x1 = Rivers[m][i - 1].x; + y1 = Rivers[m][i - 1].y; + + if (l == 0) { + x2 = x1 - 1; + y2 = y1; + + if (((Landscape[x1][y1].Type == 0) || (Landscape[x1][y1].Type == 2)) && + ((Landscape[x2][y2].Type == 0) || (Landscape[x2][y2].Type == 2))) { + hasFound = (!CheckRiverFlow(x2, y2)); + + if (hasFound) { + break; } } - // Verzwickte Fälle ausfiltern - if (((Vierecke[Scape[x][y].Typ][3][2] == 2) && (Vierecke[Scape[x - 1][y + 1].Typ][2][3] == 2)) || - ((Vierecke[Scape[x][y].Typ][3][4] == 2) && (Vierecke[Scape[x - 1][y + 1].Typ][2][1] == 2))) - { - gefunden = false; - } - // Nebeninseln vermeiden - if (((Scape[x - 1][y].Typ == 0) && (Scape[x - 1][y].Hoehe == 0)) && - ((Scape[x][y - 1].Typ == 0) && (Scape[x][y - 1].Hoehe == 0))) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } } - } - // Teil rechts-unten - x = Mittex + l + 1; - y = Mittey + l + 1; - gefunden = false; - i = 0; - while (!gefunden) // Passendes Teil finden und Hoehe festlegen - { - i += 1; - if (i == 1000) { gefunden = true; } - - Scape[x][y].Typ = rand() % 13; - for (j = 0; j < 10; j++) - { - if (!((Scape[x][y].Typ == 0) || (Scape[x][y].Typ == 8))) - { - Scape[x][y].Typ = rand() % 13; - } - } + if (l == 1) { + x2 = x1; + y2 = y1 - 1; + + if (((Landscape[x1][y1].Type == 0) || (Landscape[x1][y1].Type == 1)) && + ((Landscape[x2][y2].Type == 0) || (Landscape[x2][y2].Type == 1))) { + hasFound = (!CheckRiverFlow(x2, y2)); - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 1) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe - 1; - if (Scape[x][y].Hoehe < 0) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; + if (hasFound) { + break; + } } - gefunden = true; - } - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 2) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe; - gefunden = true; - } - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 3) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe + 1; - gefunden = true; - } - // Verzwickte Fälle ausfiltern - if (((Vierecke[Scape[x][y].Typ][0][1] == 2) && (Vierecke[Scape[x - 1][y - 1].Typ][3][2] == 2)) || - ((Vierecke[Scape[x][y].Typ][0][3] == 2) && (Vierecke[Scape[x - 1][y - 1].Typ][3][4] == 2))) - { - gefunden = false; - } - // Nebeninsel vermeiden - if ((Scape[x][y - 1].Typ == 0) && (Scape[x][y - 1].Hoehe == 0)) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; } - } - // Den unteren Bereich von rechts nach links durchgehen - y = Mittey + l + 1; - for (x = Mittex + l; x >= Mittex - l; x--) - { - gefunden = false; - i = 0; - while (!gefunden) // Passendes Teil finden und Hoehe festlegen - { - i += 1; - if (i == 1000) { gefunden = true; } - - Scape[x][y].Typ = rand() % 13; - for (j = 0; j < 10; j++) - { - if (!((Scape[x][y].Typ == 0) || (Scape[x][y].Typ == 3))) - { - Scape[x][y].Typ = rand() % 13; + if (l == 2) { + x2 = x1 + 1; + y2 = y1; + + if (((Landscape[x1][y1].Type == 0) || (Landscape[x1][y1].Type == 4)) && + ((Landscape[x2][y2].Type == 0) || (Landscape[x2][y2].Type == 4))) { + hasFound = (!CheckRiverFlow(x2, y2)); + + if (hasFound) { + break; } } + } - if ((Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] != 0) - && (Vierecke[Scape[x + 1][y].Typ][0][Scape[x][y].Typ] != 0)) - { - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 1) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe - 1; - if (Scape[x][y].Hoehe < 0) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } - gefunden = true; - } - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 2) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe; - gefunden = true; - } - if (Vierecke[Scape[x][y - 1].Typ][3][Scape[x][y].Typ] == 3) - { - Scape[x][y].Hoehe = Scape[x][y - 1].Hoehe + 1; - gefunden = true; + if (l == 3) { + x2 = x1; + y2 = y1 + 1; + + if (((Landscape[x1][y1].Type == 0) || (Landscape[x1][y1].Type == 3)) && + ((Landscape[x2][y2].Type == 0) || (Landscape[x2][y2].Type == 3))) { + hasFound = (!CheckRiverFlow(x2, y2)); + + if (hasFound) { + break; } } - // Verzwickte Fälle ausfiltern - if (((Vierecke[Scape[x][y].Typ][0][1] == 2) && (Vierecke[Scape[x - 1][y - 1].Typ][3][2] == 2)) || - ((Vierecke[Scape[x][y].Typ][0][3] == 2) && (Vierecke[Scape[x - 1][y - 1].Typ][3][4] == 2))) - { - gefunden = false; - } - // Nebeninseln vermeiden - if (((Scape[x + 1][y].Typ == 0) && (Scape[x + 1][y].Hoehe == 0)) && - ((Scape[x][y - 1].Typ == 0) && (Scape[x][y - 1].Hoehe == 0))) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } } } - //Teil links-unten - x = Mittex - l - 1; - y = Mittey + l + 1; - gefunden = false; - i = 0; - while (!gefunden) // Passendes Teil finden und Hoehe festlegen - { - i += 1; - if (i == 1000) { gefunden = true; } - - Scape[x][y].Typ = rand() % 13; - for (j = 0; j < 10; j++) - { - if (!((Scape[x][y].Typ == 0) || (Scape[x][y].Typ == 7))) - { - Scape[x][y].Typ = rand() % 13; - } - } + if (!hasFound) { + break; + } - if (Vierecke[Scape[x + 1][y].Typ][0][Scape[x][y].Typ] == 1) - { - Scape[x][y].Hoehe = Scape[x + 1][y].Hoehe - 1; - if (Scape[x][y].Hoehe < 0) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } - gefunden = true; - } - if (Vierecke[Scape[x + 1][y].Typ][0][Scape[x][y].Typ] == 2) - { - Scape[x][y].Hoehe = Scape[x + 1][y].Hoehe; - gefunden = true; - } - if (Vierecke[Scape[x + 1][y].Typ][0][Scape[x][y].Typ] == 3) - { - Scape[x][y].Hoehe = Scape[x + 1][y].Hoehe + 1; - gefunden = true; - } - // Verzwickte Fälle ausfiltern - if (((Vierecke[Scape[x][y].Typ][1][2] == 2) && (Vierecke[Scape[x + 1][y - 1].Typ][0][3] == 2)) || - ((Vierecke[Scape[x][y].Typ][1][4] == 2) && (Vierecke[Scape[x + 1][y - 1].Typ][0][1] == 2))) - { - gefunden = false; - } - // Nebeninsel vermeiden - if ((Scape[x + 1][y].Typ == 0) && (Scape[x + 1][y].Hoehe == 0)) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; + Rivers[m][i].x = x2; + Rivers[m][i].y = y2; + direction = l; + + if ((Landscape[Rivers[m][i].x][Rivers[m][i].y].Terrain == 2) && // Auf Strand die Richtung beibehalten + (Landscape[Rivers[m][i].x][Rivers[m][i].y].Type == 0)) { + if (Strand == true) { + break; // Nur ein Strandstück überfliessen } + + Strand = true; } - // Den linken Bereich von unten nach oben durchgehen - x = Mittex - l - 1; - for (y = Mittey + l; y >= Mittey - l - 1; y--) - { - gefunden = false; - i = 0; - while (!gefunden) // Passendes Teil finden und Hoehe festlegen - { - i += 1; - if (i == 1000) { gefunden = true; } - Scape[x][y].Typ = rand() % 13; - for (j = 0; j < 10; j++) - { - if (!((Scape[x][y].Typ == 0) || (Scape[x][y].Typ == 2))) - { - Scape[x][y].Typ = rand() % 13; - } - } + if ((Landscape[Rivers[m][i].x][Rivers[m][i].y].Terrain == 1) && // im meer aufhören + (Landscape[Rivers[m][i].x][Rivers[m][i].y].Type == 0)) { + isComplete = true; + break; + } + } - if ((Vierecke[Scape[x + 1][y].Typ][0][Scape[x][y].Typ] != 0) - && (Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] != 0)) - { - if (Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] == 1) - { - Scape[x][y].Hoehe = Scape[x][y + 1].Hoehe - 1; - if (Scape[x][y].Hoehe < 0) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } - gefunden = true; - } - if (Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] == 2) - { - Scape[x][y].Hoehe = Scape[x][y + 1].Hoehe; - gefunden = true; - } - if (Vierecke[Scape[x][y + 1].Typ][1][Scape[x][y].Typ] == 3) - { - Scape[x][y].Hoehe = Scape[x][y + 1].Hoehe + 1; - gefunden = true; - } - } - // Verzwickte Fälle ausfiltern - if (((Vierecke[Scape[x][y].Typ][1][2] == 2) && (Vierecke[Scape[x + 1][y - 1].Typ][0][3] == 2)) || - ((Vierecke[Scape[x][y].Typ][1][4] == 2) && (Vierecke[Scape[x + 1][y - 1].Typ][0][1] == 2))) - { - gefunden = false; - } - // Nebeninseln vermeiden - if (((Scape[x + 1][y].Typ == 0) && (Scape[x + 1][y].Hoehe == 0)) && - ((Scape[x][y + 1].Typ == 0) && (Scape[x][y + 1].Hoehe == 0))) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - } + if (isComplete) { + if (i > tmpLength) { + // neue Variante speichern + if (hasFound) { + tmpLength = i; + } else { + tmpLength = i - 1; + } + + for (short j = 0; j <= tmpLength; j++) { + flowTmp[j].x = Rivers[m][j].x; + flowTmp[j].y = Rivers[m][j].y; } } } - short Anzahl = 0; // Anzahl der Landstücke - bool CheckRand = true; // Reicht die Insel bis zum Rand? - for (y = 0; y < MAXYKACH; y++) // Landfläche zählen - for (x = 0; x < MAXXKACH; x++) - { - if (Scape[x][y].Hoehe > 0) Anzahl++; - if (Scape[x][y].Typ == 0) Scape[x][y].LaufZeit = 1; - else Scape[x][y].LaufZeit = 2; + for (i = 0; i < MAX_RIVER_LENGTH; i++) { + Rivers[m][i].x = -1; + Rivers[m][i].y = -1; + } - if ((Scape[x][y].Typ != 0) && - ((x <= 2) || (x >= MAXXKACH - 2) || (y <= 2) || (y >= MAXYKACH - 2))) - CheckRand = false; - } - if ((Anzahl > MinGroesse) && (Anzahl < MaxGroesse) && (CheckRand)) break; + isComplete = false; } - } - void Meer() // Das Meer und den Strand bestimmen - { - short x, y; + // Den längsten Fluss nehmen + riverLength[m] = tmpLength; - for (y = 0; y < MAXYKACH; y++) // Meer rausfinden - for (x = 0; x < MAXXKACH; x++) - { - if ((Scape[x][y].Hoehe < 0) || - ((Scape[x][y].Hoehe == 0) && (Scape[x][y].Typ == 0))) - { - Scape[x][y].Typ = 0; - Scape[x][y].Hoehe = 0; - Scape[x][y].Art = 1; - Scape[x][y].Objekt = MEERWELLEN; - Scape[x][y].ObPos.x = static_cast(Bmp[MEERWELLEN].rcDes.left); - Scape[x][y].ObPos.y = static_cast(Bmp[MEERWELLEN].rcDes.top); - if (rand() % 2 == 0) Scape[x][y].Reverse = true; - Scape[x][y].Begehbar = false; - Scape[x][y].Phase = static_cast(Bmp[Scape[x][y].Objekt].Anzahl - - rand() % (Bmp[Scape[x][y].Objekt].Anzahl) - 1); - } - } - for (y = 1; y < MAXYKACH - 1; y++) // Strand rausfinden - for (x = 1; x < MAXXKACH - 1; x++) // Alle Möglichkeiten durchgehen - { - if ((Scape[x][y].Typ == 0) && (Scape[x][y].Hoehe == 0)) - { - short Anzahl = 0; // Anzahl von angrenzenden Landstücken rausfinden - if (Scape[x - 1][y].Typ != 0) Anzahl++; - if (Scape[x - 1][y - 1].Typ != 0) Anzahl++; - if (Scape[x][y - 1].Typ != 0) Anzahl++; - if (Scape[x + 1][y - 1].Typ != 0) Anzahl++; - if (Scape[x + 1][y].Typ != 0) Anzahl++; - if (Scape[x + 1][y + 1].Typ != 0) Anzahl++; - if (Scape[x][y + 1].Typ != 0) Anzahl++; - if (Scape[x - 1][y + 1].Typ != 0) Anzahl++; - - if ((Anzahl >= 1) && (Anzahl < 6)) - { - Scape[x][y].Art = 2; - Scape[x][y].Objekt = -1; - Scape[x][y].Reverse = false; - Scape[x][y].Begehbar = true; - Scape[x][y].Phase = -1; - continue; - } - if (Anzahl >= 6) - { - Scape[x][y].Art = 3; - Scape[x][y].Objekt = -1; - Scape[x][y].Reverse = false; - Scape[x][y].Begehbar = false; - Scape[x][y].Phase = -1; - continue; - } - Scape[x][y].Art = 1; // sonst Meer - Scape[x][y].Objekt = MEERWELLEN; - Scape[x][y].ObPos.x = static_cast(Bmp[MEERWELLEN].rcDes.left); - Scape[x][y].ObPos.y = static_cast(Bmp[MEERWELLEN].rcDes.top); - Scape[x][y].Phase = static_cast(Bmp[Scape[x][y].Objekt].Anzahl - - rand() % (Bmp[Scape[x][y].Objekt].Anzahl) - 1); - if (rand() % 2 == 0) Scape[x][y].Reverse = true; - Scape[x][y].Begehbar = false; + for (short j = 0; j <= riverLength[m]; j++) { + Rivers[m][j].x = flowTmp[j].x; + Rivers[m][j].y = flowTmp[j].y; + } + + // Die richtigen Wasserkacheln auswählen + x0 = y0 = x1 = y1 = x2 = y2 = -1; + + for (m = 0; m < NUMBER_OF_RIVERS; m++) { + for (i = 0; i <= riverLength[m]; i++) { + // For the tile, one process before + if (x1 != -1 && y1 != -1) { + Landscape[x1][y1].ObjectPosOffset.x = static_cast(Bmp[Landscape[x1][y1].Object].targetRect.left); + Landscape[x1][y1].ObjectPosOffset.y = static_cast(Bmp[Landscape[x1][y1].Object].targetRect.top); } - } - } - void ChangeBootsFahrt() - { - BootsFahrt = !BootsFahrt; - // Begehbarkeit umdrehen - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) Scape[x][y].Begehbar = !Scape[x][y].Begehbar; - } + x1 = Rivers[m][i].x; + y1 = Rivers[m][i].y; - void CheckRohr(short x, short y) - { - Scape[x][y].Phase = 1; - if (Scape[x][y].Art == 0) Scape[x][y].Art = 4; - if (Scape[x - 1][y].Art == 0) Scape[x - 1][y].Art = 4; - if (Scape[x - 1][y - 1].Art == 0) Scape[x - 1][y - 1].Art = 4; - if (Scape[x][y - 1].Art == 0) Scape[x][y - 1].Art = 4; - if (Scape[x + 1][y - 1].Art == 0) Scape[x + 1][y - 1].Art = 4; - if (Scape[x + 1][y].Art == 0) Scape[x + 1][y].Art = 4; - if (Scape[x + 1][y + 1].Art == 0) Scape[x + 1][y + 1].Art = 4; - if (Scape[x][y + 1].Art == 0) Scape[x][y + 1].Art = 4; - if (Scape[x - 1][y + 1].Art == 0) Scape[x - 1][y + 1].Art = 4; - - if ((Scape[x - 1][y].Objekt == ROHR) && (Scape[x - 1][y].Phase == 0)) CheckRohr(x - 1, y); - if ((Scape[x][y - 1].Objekt == ROHR) && (Scape[x][y - 1].Phase == 0)) CheckRohr(x, y - 1); - if ((Scape[x + 1][y].Objekt == ROHR) && (Scape[x + 1][y].Phase == 0)) CheckRohr(x + 1, y); - if ((Scape[x][y + 1].Objekt == ROHR) && (Scape[x][y + 1].Phase == 0)) CheckRohr(x, y + 1); - } + Landscape[x1][y1].AnimationPhase = 0; - void FillRohr() - { - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - if ((Scape[x][y].Objekt == ROHR) && (Scape[x][y].Phase < Bmp[ROHR].Anzahl)) - Scape[x][y].Phase = 0; - if (Scape[x][y].Art == 4) Scape[x][y].Art = 0; - if ((Scape[x][y].Objekt >= SCHLEUSE1) && (Scape[x][y].Objekt <= SCHLEUSE6)) - { - Scape[x][y].Objekt -= 14; - Scape[x][y].ObPos.x = static_cast(Bmp[Scape[x][y].Objekt].rcDes.left); - Scape[x][y].ObPos.y = static_cast(Bmp[Scape[x][y].Objekt].rcDes.top); + if (Landscape[x1][y1].Terrain == 0) { + Landscape[x1][y1].Terrain = 4; } - } - // StartRohr finden - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - if ((Scape[x][y].Objekt >= FLUSS1) && (Scape[x][y].Objekt <= SCHLEUSE6)) - { - if (Scape[x][y].Art == 0) Scape[x][y].Art = 4; - if (Scape[x - 1][y].Art == 0) Scape[x - 1][y].Art = 4; - if (Scape[x - 1][y - 1].Art == 0) Scape[x - 1][y - 1].Art = 4; - if (Scape[x][y - 1].Art == 0) Scape[x][y - 1].Art = 4; - if (Scape[x + 1][y - 1].Art == 0) Scape[x + 1][y - 1].Art = 4; - if (Scape[x + 1][y].Art == 0) Scape[x + 1][y].Art = 4; - if (Scape[x + 1][y + 1].Art == 0) Scape[x + 1][y + 1].Art = 4; - if (Scape[x][y + 1].Art == 0) Scape[x][y + 1].Art = 4; - if (Scape[x - 1][y + 1].Art == 0) Scape[x - 1][y + 1].Art = 4; - } - if ((Scape[x][y].Objekt != ROHR) || (Scape[x][y].Phase >= Bmp[ROHR].Anzahl)) - continue; - if ((Scape[x - 1][y].Objekt >= FLUSS5) && (Scape[x - 1][y].Objekt <= FLUSS10)) - { - Scape[x - 1][y].Objekt += 14; - Scape[x - 1][y].ObPos.x = static_cast(Bmp[Scape[x - 1][y].Objekt].rcDes.left); - Scape[x - 1][y].ObPos.y = static_cast(Bmp[Scape[x - 1][y].Objekt].rcDes.top); - CheckRohr(x, y); + + if (Landscape[x1 - 1][y1].Terrain == 0) { + Landscape[x1 - 1][y1].Terrain = 4; } - else if ((Scape[x - 1][y].Objekt >= SCHLEUSE1) && (Scape[x - 1][y].Objekt <= SCHLEUSE6)) - { - CheckRohr(x, y); + + if (Landscape[x1 - 1][y1 - 1].Terrain == 0) { + Landscape[x1 - 1][y1 - 1].Terrain = 4; } - if ((Scape[x][y - 1].Objekt >= FLUSS5) && (Scape[x][y - 1].Objekt <= FLUSS10)) - { - Scape[x][y - 1].Objekt += 14; - Scape[x][y - 1].ObPos.x = static_cast(Bmp[Scape[x][y - 1].Objekt].rcDes.left); - Scape[x][y - 1].ObPos.y = static_cast(Bmp[Scape[x][y - 1].Objekt].rcDes.top); - CheckRohr(x, y); + + if (Landscape[x1][y1 - 1].Terrain == 0) { + Landscape[x1][y1 - 1].Terrain = 4; } - else if ((Scape[x][y - 1].Objekt >= SCHLEUSE1) && (Scape[x][y - 1].Objekt <= SCHLEUSE6)) - { - CheckRohr(x, y); + + if (Landscape[x1 + 1][y1 - 1].Terrain == 0) { + Landscape[x1 + 1][y1 - 1].Terrain = 4; } - if ((Scape[x + 1][y].Objekt >= FLUSS5) && (Scape[x + 1][y].Objekt <= FLUSS10)) - { - Scape[x + 1][y].Objekt += 14; - Scape[x + 1][y].ObPos.x = static_cast(Bmp[Scape[x + 1][y].Objekt].rcDes.left); - Scape[x + 1][y].ObPos.y = static_cast(Bmp[Scape[x + 1][y].Objekt].rcDes.top); - CheckRohr(x, y); + + if (Landscape[x1 + 1][y1].Terrain == 0) { + Landscape[x1 + 1][y1].Terrain = 4; } - else if ((Scape[x + 1][y].Objekt >= SCHLEUSE1) && (Scape[x + 1][y].Objekt <= SCHLEUSE6)) - { - CheckRohr(x, y); + + if (Landscape[x1 + 1][y1 + 1].Terrain == 0) { + Landscape[x1 + 1][y1 + 1].Terrain = 4; } - if ((Scape[x][y + 1].Objekt >= FLUSS5) && (Scape[x][y + 1].Objekt <= FLUSS10)) - { - Scape[x][y + 1].Objekt += 14; - Scape[x][y + 1].ObPos.x = static_cast(Bmp[Scape[x][y + 1].Objekt].rcDes.left); - Scape[x][y + 1].ObPos.y = static_cast(Bmp[Scape[x][y + 1].Objekt].rcDes.top); - CheckRohr(x, y); + + if (Landscape[x1][y1 + 1].Terrain == 0) { + Landscape[x1][y1 + 1].Terrain = 4; } - else if ((Scape[x][y + 1].Objekt >= SCHLEUSE1) && (Scape[x][y + 1].Objekt <= SCHLEUSE6)) - { - CheckRohr(x, y); + + if (Landscape[x1 - 1][y1 + 1].Terrain == 0) { + Landscape[x1 - 1][y1 + 1].Terrain = 4; } - } - // Felder auf trockenen Wiesen löschen - for (short y = 0; y < MAXYKACH; y++) - for (short x = 0; x < MAXXKACH; x++) - { - if ((Scape[x][y].Objekt == FELD) && (Scape[x][y].Art == 0)) - { - Scape[x][y].Objekt = -1; - Scape[x][y].ObPos.x = 0; - Scape[x][y].ObPos.y = 0; - Scape[x][y].Phase = -1; - Scape[x][y].AkNummer = 0; + + if (i < riverLength[m]) { + x2 = Rivers[m][i + 1].x; + y2 = Rivers[m][i + 1].y; } - } - Generate(); - } - bool CheckFluss(short x, short y) // Nachprüfen ob auf aktuellem Teil ein Fluss ist (Nur für die Fluss-Routine) - { - for (short i = 0; i < FLUSSANZAHL; i++) - for (short j = 0; j < MAXFLUSS; j++) - { - if ((x == Flusslauf[i][j].x) && (y == Flusslauf[i][j].y)) return true; - } - return false; - } + if (i != 0) { + x0 = Rivers[m][i - 1].x; + y0 = Rivers[m][i - 1].y; + } else { + // Quellen + if (x2 > x1) { + Landscape[x1][y1].Object = Tiles::RIVER_START_1; + continue; + } - void Fluss() // Anzahl der Flüsse und der minimale Länge - { - short i; - short l = 0; - short Richtung = 0; // Aktuelle Fliesrichtung von 0-3 - short x0 = 0; - short y0 = 0; - short x1 = 0; - short y1 = 0; - short x2 = 0; // x2,y2 Koordinate des zu prüfenden Teils - short y2 = 0; - bool gefunden = false; - FLUSSLAUF Flusstmp[MAXFLUSS]; // Zum zwischenspeichern des Versuchs - short Flusslaenge[FLUSSANZAHL]; - - for (short m = 0; m < FLUSSANZAHL; m++) - for (short j = 0; j < MAXFLUSS; j++) - { - Flusslauf[m][j].x = -1; - Flusslauf[m][j].y = -1; - } + if (x2 < x1) { + Landscape[x1][y1].Object = Tiles::RIVER_START_4; + continue; + } - for (short m = 0; m < FLUSSANZAHL; m++) - { - bool fertig = false; - short Laengetmp = 0; - for (short j = 0; j < MAXFLUSS; j++) - { - Flusstmp[j].x = -1; - Flusstmp[j].y = -1; - } - for (short k = 0; k < 1000; k++) - { - for (short o = 0; o < 10000; o++) - { - gefunden = true; + if (y2 > y1) { + Landscape[x1][y1].Object = Tiles::RIVER_START_2; + continue; + } - x0 = rand() % MAXXKACH; // geeignete Quelle bestimmen - y0 = rand() % MAXYKACH; - if (CheckFluss(x0, y0)) gefunden = false; - if ((Scape[x0][y0].Typ != 0) || - (Scape[x0][y0].Hoehe < 2)) - gefunden = false; - if (gefunden) break; + if (y2 < y1) { + Landscape[x1][y1].Object = Tiles::RIVER_START_3; + continue; + } } - if (!gefunden) - { - MessageBeep(MB_OK); - break; - } // Wenn keine Quelle mehr gefunden aufhören - Flusslauf[m][0].x = x0; - Flusslauf[m][0].y = y0; - bool Strand = false; - for (i = 1; i < MAXFLUSS; i++) - { - gefunden = false; - if (!Strand) Richtung = rand() % 4; // Auf dem Strand geradeausfliessen - for (short l2 = 0; l2 < 4; l2++) - { - l = (Richtung + l2) % 4; // Im Urzeigersinn nachprüfen und bei der vorgegeben Richtung anfangen - - x1 = Flusslauf[m][i - 1].x; - y1 = Flusslauf[m][i - 1].y; - - if (l == 0) - { - x2 = x1 - 1; - y2 = y1; - if (((Scape[x1][y1].Typ == 0) || (Scape[x1][y1].Typ == 2)) && - ((Scape[x2][y2].Typ == 0) || (Scape[x2][y2].Typ == 2))) - { - gefunden = (!CheckFluss(x2, y2)); - if (gefunden) break; - } - } - if (l == 1) - { - x2 = x1; - y2 = y1 - 1; - if (((Scape[x1][y1].Typ == 0) || (Scape[x1][y1].Typ == 1)) && - ((Scape[x2][y2].Typ == 0) || (Scape[x2][y2].Typ == 1))) - { - gefunden = (!CheckFluss(x2, y2)); - if (gefunden) break; + + // Alle Möglichkeiten durchgehen + + if (Landscape[x1][y1].Type == 1) { + Landscape[x1][y1].Object = Tiles::RIVER_1; + } + + if (Landscape[x1][y1].Type == 2) { + Landscape[x1][y1].Object = Tiles::RIVER_2; + } + + if (Landscape[x1][y1].Type == 3) { + Landscape[x1][y1].Object = Tiles::RIVER_3; + } + + if (Landscape[x1][y1].Type == 4) { + Landscape[x1][y1].Object = Tiles::RIVER_4; + } + + if (Landscape[x1][y1].Type == 0) { + if ((x0 < x1) && (y0 == y1)) { + if (Landscape[x1][y1].Terrain == 2) { + Landscape[x1][y1].Object = Tiles::RIVER_END_3; // River end/mouth + } else { + if ((x1 < x2) && (y1 == y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_5; } - } - if (l == 2) - { - x2 = x1 + 1; - y2 = y1; - if (((Scape[x1][y1].Typ == 0) || (Scape[x1][y1].Typ == 4)) && - ((Scape[x2][y2].Typ == 0) || (Scape[x2][y2].Typ == 4))) - { - gefunden = (!CheckFluss(x2, y2)); - if (gefunden) break; + + if ((x1 == x2) && (y1 < y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_7; } - } - if (l == 3) - { - x2 = x1; - y2 = y1 + 1; - if (((Scape[x1][y1].Typ == 0) || (Scape[x1][y1].Typ == 3)) && - ((Scape[x2][y2].Typ == 0) || (Scape[x2][y2].Typ == 3))) - { - gefunden = (!CheckFluss(x2, y2)); - if (gefunden) break; + + if ((x1 == x2) && (y1 > y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_9; } } } - if (!gefunden) break; - Flusslauf[m][i].x = x2; - Flusslauf[m][i].y = y2; - Richtung = l; + if ((x0 == x1) && (y0 < y1)) { + if (Landscape[x1][y1].Terrain == 2) { + Landscape[x1][y1].Object = Tiles::RIVER_END_4; // River end/mouth + } else { + if ((x1 < x2) && (y1 == y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_8; + } - if ((Scape[Flusslauf[m][i].x][Flusslauf[m][i].y].Art == 2) && // Auf Strand die Richtung beibehalten - (Scape[Flusslauf[m][i].x][Flusslauf[m][i].y].Typ == 0)) - { - if (Strand == true) break; // Nur ein Strandstück überfliessen - Strand = true; - } + if ((x1 == x2) && (y1 < y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_6; + } - if ((Scape[Flusslauf[m][i].x][Flusslauf[m][i].y].Art == 1) && // im meer aufhören - (Scape[Flusslauf[m][i].x][Flusslauf[m][i].y].Typ == 0)) - { - fertig = true; - break; - } - } - if (fertig) - { - if (i > Laengetmp) - { - // neue Variante speichern - if (gefunden) Laengetmp = i; - else Laengetmp = i - 1; - for (short j = 0; j <= Laengetmp; j++) - { - Flusstmp[j].x = Flusslauf[m][j].x; - Flusstmp[j].y = Flusslauf[m][j].y; + if ((x1 > x2) && (y1 == y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_9; + Landscape[x1][y1].ReverseAnimation = true; + } } } - } - for (i = 0; i < MAXFLUSS; i++) - { - Flusslauf[m][i].x = -1; - Flusslauf[m][i].y = -1; - } - fertig = false; - } - // Den längsten Fluss nehmen - Flusslaenge[m] = Laengetmp; - for (short j = 0; j <= Flusslaenge[m]; j++) - { - Flusslauf[m][j].x = Flusstmp[j].x; - Flusslauf[m][j].y = Flusstmp[j].y; - } - // Die richtigen Wasserkacheln auswählen - x0 , y0 , x1 , y1 , x2 , y2 = -1; - for (m = 0; m < FLUSSANZAHL; m++) - { - for (i = 0; i <= Flusslaenge[m]; i++) - { - // Für die Kachel, einen Vorgang davor - Scape[x1][y1].ObPos.x = static_cast(Bmp[Scape[x1][y1].Objekt].rcDes.left); - Scape[x1][y1].ObPos.y = static_cast(Bmp[Scape[x1][y1].Objekt].rcDes.top); - - x1 = Flusslauf[m][i].x; - y1 = Flusslauf[m][i].y; - - Scape[x1][y1].Phase = 0; - - if (Scape[x1][y1].Art == 0) Scape[x1][y1].Art = 4; - if (Scape[x1 - 1][y1].Art == 0) Scape[x1 - 1][y1].Art = 4; - if (Scape[x1 - 1][y1 - 1].Art == 0) Scape[x1 - 1][y1 - 1].Art = 4; - if (Scape[x1][y1 - 1].Art == 0) Scape[x1][y1 - 1].Art = 4; - if (Scape[x1 + 1][y1 - 1].Art == 0) Scape[x1 + 1][y1 - 1].Art = 4; - if (Scape[x1 + 1][y1].Art == 0) Scape[x1 + 1][y1].Art = 4; - if (Scape[x1 + 1][y1 + 1].Art == 0) Scape[x1 + 1][y1 + 1].Art = 4; - if (Scape[x1][y1 + 1].Art == 0) Scape[x1][y1 + 1].Art = 4; - if (Scape[x1 - 1][y1 + 1].Art == 0) Scape[x1 - 1][y1 + 1].Art = 4; - - if (i < Flusslaenge[m]) - { - x2 = Flusslauf[m][i + 1].x; - y2 = Flusslauf[m][i + 1].y; - } + if ((x0 > x1) && (y0 == y1)) { + if (Landscape[x1][y1].Terrain == 2) { + Landscape[x1][y1].Object = Tiles::RIVER_END_1; // River end/mouth + } else { + if ((x1 > x2) && (y1 == y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_5; + } - if (i != 0) - { - x0 = Flusslauf[m][i - 1].x; - y0 = Flusslauf[m][i - 1].y; - } - else - { - // Quellen - if (x2 > x1) - { - Scape[x1][y1].Objekt = QUELLE1; - continue; - } - if (x2 < x1) - { - Scape[x1][y1].Objekt = QUELLE4; - continue; - } - if (y2 > y1) - { - Scape[x1][y1].Objekt = QUELLE2; - continue; - } - if (y2 < y1) - { - Scape[x1][y1].Objekt = QUELLE3; - continue; - } - } + if ((x1 == x2) && (y1 < y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_10; + } - // Alle Möglichkeiten durchgehen - - if (Scape[x1][y1].Typ == 1) Scape[x1][y1].Objekt = FLUSS1; - if (Scape[x1][y1].Typ == 2) Scape[x1][y1].Objekt = FLUSS2; - if (Scape[x1][y1].Typ == 3) Scape[x1][y1].Objekt = FLUSS3; - if (Scape[x1][y1].Typ == 4) Scape[x1][y1].Objekt = FLUSS4; - - if (Scape[x1][y1].Typ == 0) - { - if ((x0 < x1) && (y0 == y1)) - { - if (Scape[x1][y1].Art == 2) Scape[x1][y1].Objekt = MUENDUNG3; // Mündung - else - { - if ((x1 < x2) && (y1 == y2)) Scape[x1][y1].Objekt = FLUSS5; - if ((x1 == x2) && (y1 < y2)) Scape[x1][y1].Objekt = FLUSS7; - if ((x1 == x2) && (y1 > y2)) Scape[x1][y1].Objekt = FLUSS9; + if ((x1 == x2) && (y1 > y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_8; } + + Landscape[x1][y1].ReverseAnimation = true; } - if ((x0 == x1) && (y0 < y1)) - { - if (Scape[x1][y1].Art == 2) Scape[x1][y1].Objekt = MUENDUNG4; // Mündung - else - { - if ((x1 < x2) && (y1 == y2)) Scape[x1][y1].Objekt = FLUSS8; - if ((x1 == x2) && (y1 < y2)) Scape[x1][y1].Objekt = FLUSS6; - if ((x1 > x2) && (y1 == y2)) - { - Scape[x1][y1].Objekt = FLUSS9; - Scape[x1][y1].Reverse = true; - } + } + + if ((x0 == x1) && (y0 > y1)) { + if (Landscape[x1][y1].Terrain == 2) { + Landscape[x1][y1].Object = Tiles::RIVER_END_2; // River end/mouth + } else { + if ((x1 == x2) && (y1 > y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_6; } - } - if ((x0 > x1) && (y0 == y1)) - { - if (Scape[x1][y1].Art == 2) Scape[x1][y1].Objekt = MUENDUNG1; // Mündung - else - { - if ((x1 > x2) && (y1 == y2)) Scape[x1][y1].Objekt = FLUSS5; - if ((x1 == x2) && (y1 < y2)) Scape[x1][y1].Objekt = FLUSS10; - if ((x1 == x2) && (y1 > y2)) Scape[x1][y1].Objekt = FLUSS8; - Scape[x1][y1].Reverse = true; + + if ((x1 > x2) && (y1 == y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_7; } - } - if ((x0 == x1) && (y0 > y1)) - { - if (Scape[x1][y1].Art == 2) Scape[x1][y1].Objekt = MUENDUNG2; // Mündung - else - { - if ((x1 == x2) && (y1 > y2)) - Scape[x1][y1].Objekt = FLUSS6; - - if ((x1 > x2) && (y1 == y2)) - Scape[x1][y1].Objekt = FLUSS7; - - Scape[x1][y1].Reverse = true; - if ((x1 < x2) && (y1 == y2)) - { - Scape[x1][y1].Objekt = FLUSS10; - Scape[x1][y1].Reverse = false; - } + + Landscape[x1][y1].ReverseAnimation = true; + + if ((x1 < x2) && (y1 == y2)) { + Landscape[x1][y1].Object = Tiles::RIVER_10; + Landscape[x1][y1].ReverseAnimation = false; } } } } - // Für das letzte Flussstück - Scape[x1][y1].ObPos.x = static_cast(Bmp[Scape[x1][y1].Objekt].rcDes.left); - Scape[x1][y1].ObPos.y = static_cast(Bmp[Scape[x1][y1].Objekt].rcDes.top); } + + //For the last stretch of the river + Landscape[x1][y1].ObjectPosOffset.x = static_cast(Bmp[Landscape[x1][y1].Object].targetRect.left); + Landscape[x1][y1].ObjectPosOffset.y = static_cast(Bmp[Landscape[x1][y1].Object].targetRect.top); } } +} - void Baeume(short Prozent) - { - ZWEID Pos; // Da steht der Baum - bool einGrosserBaum = false; // gibt es bereits einen großen Baum - - for (short y = 0; y < MAXYKACH; y++)//Alle Kacheln durchgehen - for (short x = 0; x < MAXXKACH; x++) - { - if ((Scape[x][y].Objekt != -1) || ((Scape[x][y].Art == 3) && (Scape[x][y].Typ == 0))) - continue; +void CreateTrees(short percent) +{ + Coordinate Pos; // There is the tree + bool hasBigTree = false; // there is already a big tree - // Wenn schon ein Objekt da ist oder Treibsand ist, dann mit nächsten Teil weitermachen - if (rand() % (100 / Prozent) != 0) // Die Wahrscheinlichkeit für einen Baum bestimmen - continue; + for (short y = 0; y < MAX_TILESY; y++)//Alle Kacheln durchgehen + for (short x = 0; x < MAX_TILES_X; x++) { + if ((Landscape[x][y].Object != -1) || ((Landscape[x][y].Terrain == 3) && (Landscape[x][y].Type == 0))) { + continue; + } - while (true) - { - Pos.x = rand() % KXPIXEL; - Pos.y = rand() % KYPIXEL; - ZWEID Erg = Renderer::GetKachel(Scape[x][y].xScreen + Pos.x, Scape[x][y].yScreen + Pos.y); - if ((Erg.x == x) && (Erg.y == y)) break; - } - if ((Scape[x][y].Art == 2) && (Scape[x][y].Typ == 0)) // Bei Strand nur Palmen nehmen - { - Scape[x][y].Objekt = BAUM2; - } - else - { - short r = rand() % 5; // random speicherung - Scape[x][y].Objekt = BAUM1 + r; - if ((rand() % 50 == 1) || (!einGrosserBaum)) - { - Scape[x][y].Objekt = BAUMGROSS; - einGrosserBaum = true; - } - } - // Linke obere Ecke speichern - Scape[x][y].ObPos.x = Pos.x - static_cast(Bmp[Scape[x][y].Objekt].Breite) / 2; - Scape[x][y].ObPos.y = Pos.y - static_cast(Bmp[Scape[x][y].Objekt].Hoehe); - // Startphase - if (Scape[x][y].Objekt == BUSCH) - Scape[x][y].Phase = static_cast(Bmp[Scape[x][y].Objekt].Anzahl) - 1; - else - Scape[x][y].Phase = static_cast(Bmp[Scape[x][y].Objekt].Anzahl - - rand() % (Bmp[Scape[x][y].Objekt].Anzahl) - 1); + // If there is already an object or quicksand, then continue with the next part + if (rand() % (100 / percent) != 0) { // Determine the probability of a tree + continue; } - } - void Piratenwrack() - { - short x = 0; - short y = 0; - - short Richtung = rand() % 3; - switch (Richtung) - { - case 0: - x = MAXXKACH / 2; - for (short i = 0; i < MAXYKACH; i++) - { - if (Scape[x][i].Art != 1) - { - y = i - 1; + while (true) { + Pos.x = rand() % TILE_SIZE_X; + Pos.y = rand() % TILE_SIZE_Y; + Coordinate Erg = Renderer::GetTile(Landscape[x][y].xScreen + Pos.x, Landscape[x][y].yScreen + Pos.y); + + if ((Erg.x == x) && (Erg.y == y)) { break; } } - break; - case 1: - y = MAXYKACH / 2; - for (short i = MAXXKACH - 1; i >= 0; i--) - { - if (Scape[i][y].Art != 1) - { - x = i + 1; - break; + + if ((Landscape[x][y].Terrain == 2) && (Landscape[x][y].Type == 0)) { // Only make palm trees at the beach + Landscape[x][y].Object = Tiles::TREE_2; + } else { + short r = rand() % 5; // random speicherung + Landscape[x][y].Object = Tiles::TREE_1 + r; + + if ((rand() % 50 == 1) || (!hasBigTree)) { + Landscape[x][y].Object = Tiles::TREE_BIG; + hasBigTree = true; } } - break; - case 2: - x = MAXXKACH / 2; - for (short i = MAXYKACH - 1; i >= 0; i--) - { - if (Scape[x][i].Art != 1) - { - y = i + 1; - break; - } + + // Linke obere Ecke speichern + Landscape[x][y].ObjectPosOffset.x = Pos.x - static_cast(Bmp[Landscape[x][y].Object].Width) / 2; + Landscape[x][y].ObjectPosOffset.y = Pos.y - static_cast(Bmp[Landscape[x][y].Object].Height); + + // Startphase + if (Landscape[x][y].Object == Tiles::BUSH) { + Landscape[x][y].AnimationPhase = static_cast(Bmp[Landscape[x][y].Object].AnimationPhaseCount) - 1; + } else + Landscape[x][y].AnimationPhase = static_cast(Bmp[Landscape[x][y].Object].AnimationPhaseCount - + rand() % (Bmp[Landscape[x][y].Object].AnimationPhaseCount) - 1); + } +} + +void CreatePirateWreck() +{ + short x = 0; + short y = 0; + + short Richtung = rand() % 3; + + switch (Richtung) { + case 0: + x = MAX_TILES_X / 2; + + for (short i = 0; i < MAX_TILESY; i++) { + if (Landscape[x][i].Terrain != 1) { + y = i - 1; + break; } - break; } - Scape[x][y].Objekt = WRACK2; - Scape[x][y].ObPos.x = static_cast(Bmp[WRACK2].rcDes.left); - Scape[x][y].ObPos.y = static_cast(Bmp[WRACK2].rcDes.top); - } - void Schatz() - { - while (true) - { - // Diese Kachel wird angeschaut - short x = rand() % (MAXXKACH - 1); - short y = rand() % (MAXYKACH - 1); - - // nur auf flachen Kacheln ohne Objekt - if ((Scape[x][y].Objekt == -1) && (Scape[x][y].Typ == 0) && (Scape[x][y].Art != 3)) - { - if (SchatzPos.x == -1) - { - SchatzPos.x = x; - SchatzPos.y = y; - } + break; - lpDDSScape->Lock(nullptr, &ddsd, DDLOCK_WAIT, nullptr); - lpDDSSchatzkarte->Lock(nullptr, &ddsd2, DDLOCK_WAIT, nullptr); + case 1: + y = MAX_TILESY / 2; - for (short i = 0; i < SKARTEX; i++) - for (short j = 0; j < SKARTEY; j++) - { - Renderer::GetPixel(static_cast(i + Scape[SchatzPos.x][SchatzPos.y].xScreen - SKARTEX / 2 + KXPIXEL / 2), - static_cast(j + Scape[SchatzPos.x][SchatzPos.y].yScreen - SKARTEY / 2 + 30), &ddsd); - Renderer::PutPixel(i, j, Renderer::RGB2DWORD((rgbStruct.r * 30 + rgbStruct.g * 59 + rgbStruct.b * 11) / 100, - (rgbStruct.r * 30 + rgbStruct.g * 59 + rgbStruct.b * 11) / 100, - (rgbStruct.r * 30 + rgbStruct.g * 59 + rgbStruct.b * 11) / 100 * 3 / 4), &ddsd2); - } + for (short i = MAX_TILES_X - 1; i >= 0; i--) { + if (Landscape[i][y].Terrain != 1) { + x = i + 1; + break; + } + } - lpDDSScape->Unlock(nullptr); - lpDDSSchatzkarte->Unlock(nullptr); - - rcRectsrc = Bmp[KREUZ].rcSrc; - rcRectdes.left = SKARTEX / 2 - Bmp[KREUZ].Breite / 2; - rcRectdes.right = rcRectdes.left + Bmp[KREUZ].Breite; - rcRectdes.top = SKARTEY / 2 - Bmp[KREUZ].Hoehe / 2; - rcRectdes.bottom = rcRectdes.top + Bmp[KREUZ].Hoehe; - Renderer::Blitten(Bmp[KREUZ].Surface, lpDDSSchatzkarte, true); - - lpDDSSchatzkarte->Lock(nullptr, &ddsd2, DDLOCK_WAIT, nullptr); - - // Weichzeichnen - for (short i = 0; i < SKARTEX; i++) - for (short j = 0; j < SKARTEY; j++) - { - if ((i > 0) && (i < SKARTEX - 1) && (j > 0) && (j < SKARTEY - 1)) - { - Renderer::GetPixel(i - 1, j, &ddsd2); - RGBSTRUCT rgbleft = rgbStruct; - Renderer::GetPixel(i, j - 1, &ddsd2); - RGBSTRUCT rgbtop = rgbStruct; - Renderer::GetPixel(i + 1, j, &ddsd2); - RGBSTRUCT rgbright = rgbStruct; - Renderer::GetPixel(i, j + 1, &ddsd2); - RGBSTRUCT rgbbottom = rgbStruct; - Renderer::GetPixel(i, j, &ddsd2); - Renderer::PutPixel(i, j, Renderer::RGB2DWORD( - (rgbleft.r + rgbtop.r + rgbright.r + rgbbottom.r + rgbStruct.r) / 5, - (rgbleft.g + rgbtop.g + rgbright.g + rgbbottom.g + rgbStruct.g) / 5, - (rgbleft.b + rgbtop.b + rgbright.b + rgbbottom.b + rgbStruct.b) / 5), - &ddsd2); - } - } - lpDDSSchatzkarte->Unlock(nullptr); + break; + + case 2: + x = MAX_TILES_X / 2; + + for (short i = MAX_TILESY - 1; i >= 0; i--) { + if (Landscape[x][i].Terrain != 1) { + y = i + 1; break; } } + + break; } - void CheckBenutze(short Objekt) - { - if (((Objekt == ROHSTEIN) && (TwoClicks == ROHAST)) || ((Objekt == ROHAST) && (TwoClicks == ROHSTEIN))) - { - if (Guy.Inventar[ROHAXT] < 1) - { - Guy.Inventar[ROHSTEIN]--; - Guy.Inventar[ROHAST]--; - Guy.Inventar[ROHAXT] = 1; - Bmp[BUTTFAELLEN].Phase = 0; - Bmp[BUTTBOOT].Phase = 0; - Bmp[BUTTROHR].Phase = 0; - PapierText = Renderer::DrawText(BAUEAXT, TXTPAPIER, 1); - PlaySound(Sound::INVENTION, 100); + Landscape[x][y].Object = Tiles::WRECK_2; + Landscape[x][y].ObjectPosOffset.x = static_cast(Bmp[Tiles::WRECK_2].targetRect.left); + Landscape[x][y].ObjectPosOffset.y = static_cast(Bmp[Tiles::WRECK_2].targetRect.top); +} + +void Treasure() +{ + puts("Rendering treasure map"); + sf::Image treasureMap; + treasureMap.create(TREASUREMAP_WIDTH, TREASUREMAP_HEIGHT, sf::Color::Red); + sf::Image landscape = Renderer::landscapeImage(); + while (true) { + + // This tile is viewed + short x = rand() % (MAX_TILES_X - 1); + short y = rand() % (MAX_TILESY - 1); + + // only on flat tiles without an object + if ((Landscape[x][y].Object == -1) && (Landscape[x][y].Type == 0) && (Landscape[x][y].Terrain != 3)) { + if (SchatzPos.x == -1) { + SchatzPos.x = x; + SchatzPos.y = y; } - else if (Guy.Inventar[ROHEGGE] < 1) - { - Guy.Inventar[ROHSTEIN]--; - Guy.Inventar[ROHAST]--; - Guy.Inventar[ROHEGGE] = 1; - Bmp[BUTTFELD].Phase = 0; - PapierText = Renderer::DrawText(BAUEEGGE, TXTPAPIER, 1); - PlaySound(Sound::INVENTION, 100); + +// lpDDSScape->Lock(nullptr, &ddsd, DDLOCK_WAIT, nullptr); +// lpDDSSchatzkarte->Lock(nullptr, &ddsd2, DDLOCK_WAIT, nullptr); + + RGBSTRUCT rgbStruct; + for (short i = 0; i < TREASUREMAP_WIDTH; i++) { + for (short j = 0; j < TREASUREMAP_HEIGHT; j++) { + rgbStruct = Renderer::GetPixel(static_cast(i + Landscape[SchatzPos.x][SchatzPos.y].xScreen - TREASUREMAP_WIDTH / 2 + TILE_SIZE_X / 2), + static_cast(j + Landscape[SchatzPos.x][SchatzPos.y].yScreen - TREASUREMAP_HEIGHT / 2 + 30), &landscape); +// printf("r %d g %d b %d\n", rgbStruct.r, rgbStruct.g, rgbStruct.b); + Renderer::PutPixel(i, j, + (rgbStruct.r * 30 + rgbStruct.g * 59 + rgbStruct.b * 11) / 100, + (rgbStruct.r * 30 + rgbStruct.g * 59 + rgbStruct.b * 11) / 100, + (rgbStruct.r * 30 + rgbStruct.g * 59 + rgbStruct.b * 11) / 100 * 3 / 4, &treasureMap); + } } - else - { - PapierText = Renderer::DrawText(STEINPLUSASTNICHTS, TXTPAPIER, 1); + +// lpDDSScape->Unlock(nullptr); +// lpDDSSchatzkarte->Unlock(nullptr); + +// rcRectsrc = Bmp[Tiles::CROSS].sourceRect; +// rcRectdes.left = TREASUREMAP_WIDTH / 2 - Bmp[Tiles::CROSS].Width / 2; +// rcRectdes.right = rcRectdes.left + Bmp[Tiles::CROSS].Width; +// rcRectdes.top = TREASUREMAP_HEIGHT / 2 - Bmp[Tiles::CROSS].Height / 2; +// rcRectdes.bottom = rcRectdes.top + Bmp[Tiles::CROSS].Height; +// lpDDSSchatzkarte->loadFromImage(treasureMap); +// s_treasureMapSprite->setPosition(TREASUREMAP_WIDTH / 2 - Bmp[Tiles::CROSS].Width / 2, rcRectdes.left + Bmp[Tiles::CROSS].Width); +// Renderer::Blit(Bmp[Tiles::CROSS].Surface, lpDDSSchatzkarte, true); + +// lpDDSSchatzkarte->Lock(nullptr, &ddsd2, DDLOCK_WAIT, nullptr); + + // Blur + for (short i = 0; i < TREASUREMAP_WIDTH; i++) { + for (short j = 0; j < TREASUREMAP_HEIGHT; j++) { + if ((i > 0) && (i < TREASUREMAP_WIDTH - 1) && (j > 0) && (j < TREASUREMAP_HEIGHT - 1)) { + RGBSTRUCT rgbleft = Renderer::GetPixel(i - 1, j, &treasureMap); + RGBSTRUCT rgbtop = Renderer::GetPixel(i, j - 1, &treasureMap); + RGBSTRUCT rgbright = Renderer::GetPixel(i + 1, j, &treasureMap); + RGBSTRUCT rgbbottom = Renderer::GetPixel(i, j + 1, &treasureMap); + rgbStruct = Renderer::GetPixel(i, j, &treasureMap); + Renderer::PutPixel(i, j, + (rgbleft.r + rgbtop.r + rgbright.r + rgbbottom.r + rgbStruct.r) / 5, + (rgbleft.g + rgbtop.g + rgbright.g + rgbbottom.g + rgbStruct.g) / 5, + (rgbleft.b + rgbtop.b + rgbright.b + rgbbottom.b + rgbStruct.b) / 5, &treasureMap); + } + } } +// Renderer::BlitToScreen(lpDDSSchatzkarte); + +// lpDDSSchatzkarte->Unlock(nullptr); + break; } - else if (((Objekt == ROHLIANE) && (TwoClicks == ROHAST)) || ((Objekt == ROHAST) && (TwoClicks == ROHLIANE))) - { - if (Guy.Inventar[ROHANGEL] < 1) - { - Guy.Inventar[ROHLIANE]--; - Guy.Inventar[ROHAST]--; - Guy.Inventar[ROHANGEL] = 1; - Bmp[BUTTANGELN].Phase = 0; - PapierText = Renderer::DrawText(BAUEANGEL, TXTPAPIER, 1); - PlaySound(Sound::INVENTION, 100); - } - else - { - PapierText = Renderer::DrawText(ASTPLUSLIANENICHTS, TXTPAPIER, 1); - } + } + lpDDSSchatzkarte->loadFromImage(treasureMap); +} + +void OnRawMaterialsUsed(short Objekt) +{ + if (((Objekt == Tiles::RAW_STONE) && (TwoClicks == Tiles::RAW_TREE_BRANCH)) || ((Objekt == Tiles::RAW_TREE_BRANCH) && (TwoClicks == Tiles::RAW_STONE))) { + if (Guy.Inventory[Tiles::RAW_AXE] < 1) { + Guy.Inventory[Tiles::RAW_STONE]--; + Guy.Inventory[Tiles::RAW_TREE_BRANCH]--; + Guy.Inventory[Tiles::RAW_AXE] = 1; + Bmp[Tiles::BUTTON_CHOP].AnimationPhase = 0; + Bmp[Tiles::BUTTON_BOAT].AnimationPhase = 0; + Bmp[Tiles::BUTTON_PIPE].AnimationPhase = 0; + PapierText = Renderer::DrawText(STRING_BUILD_AXE, TXTPAPIER, 1); + PlaySound(Sound::INVENTION, 100); + } else if (Guy.Inventory[Tiles::RAW_HOE] < 1) { + Guy.Inventory[Tiles::RAW_STONE]--; + Guy.Inventory[Tiles::RAW_TREE_BRANCH]--; + Guy.Inventory[Tiles::RAW_HOE] = 1; + Bmp[Tiles::BUTTON_FARM].AnimationPhase = 0; + PapierText = Renderer::DrawText(BAUEEGGE, TXTPAPIER, 1); + PlaySound(Sound::INVENTION, 100); + } else { + PapierText = Renderer::DrawText(STRING_STONE_BRANCH_NOTHING_ELSE, TXTPAPIER, 1); } - else if (((Objekt == ROHLIANE) && (TwoClicks == ROHSTEIN)) || ((Objekt == ROHSTEIN) && (TwoClicks == ROHLIANE))) - { - if (Guy.Inventar[ROHSCHLEUDER] < 1) - { - Guy.Inventar[ROHLIANE]--; - Guy.Inventar[ROHSTEIN]--; - Guy.Inventar[ROHSCHLEUDER] = 1; - Bmp[BUTTSCHLEUDER].Phase = 0; - PapierText = Renderer::DrawText(BAUESCHLEUDER, TXTPAPIER, 1); - PlaySound(Sound::INVENTION, 100); - } - else - { - PapierText = Renderer::DrawText(STEINPLUSLIANENICHTS, TXTPAPIER, 1); - } + } else if (((Objekt == Tiles::RAW_LIANA) && (TwoClicks == Tiles::RAW_TREE_BRANCH)) || ((Objekt == Tiles::RAW_TREE_BRANCH) && (TwoClicks == Tiles::RAW_LIANA))) { + if (Guy.Inventory[Tiles::RAW_FISHING_POLE] < 1) { + Guy.Inventory[Tiles::RAW_LIANA]--; + Guy.Inventory[Tiles::RAW_TREE_BRANCH]--; + Guy.Inventory[Tiles::RAW_FISHING_POLE] = 1; + Bmp[Tiles::BUTTON_FISH].AnimationPhase = 0; + PapierText = Renderer::DrawText(BAUEANGEL, TXTPAPIER, 1); + PlaySound(Sound::INVENTION, 100); + } else { + PapierText = Renderer::DrawText(ASTPLUSLIANENICHTS, TXTPAPIER, 1); } - else - { - PapierText = Renderer::DrawText(NICHTBASTELN, TXTPAPIER, 1); + } else if (((Objekt == Tiles::RAW_LIANA) && (TwoClicks == Tiles::RAW_STONE)) || ((Objekt == Tiles::RAW_STONE) && (TwoClicks == Tiles::RAW_LIANA))) { + if (Guy.Inventory[Tiles::RAW_SLINGSHOT] < 1) { + Guy.Inventory[Tiles::RAW_LIANA]--; + Guy.Inventory[Tiles::RAW_STONE]--; + Guy.Inventory[Tiles::RAW_SLINGSHOT] = 1; + Bmp[Tiles::BUTTON_SLINGSHOT].AnimationPhase = 0; + PapierText = Renderer::DrawText(BAUESCHLEUDER, TXTPAPIER, 1); + PlaySound(Sound::INVENTION, 100); + } else { + PapierText = Renderer::DrawText(STEINPLUSLIANENICHTS, TXTPAPIER, 1); } - TwoClicks = -1; + } else { + PapierText = Renderer::DrawText(STRING_CANT_BUILD, TXTPAPIER, 1); } - void Entdecken() - { - bool Aenderung = false; + TwoClicks = -1; +} - for (short i = -1; i <= 1; i++) - for (short j = -1; j <= 1; j++) - { - if (!Scape[Guy.Pos.x + i][Guy.Pos.y + j].Entdeckt) - { - Scape[Guy.Pos.x + i][Guy.Pos.y + j].Entdeckt = true; - Aenderung = true; - } +void UpdateDiscovered() +{ + bool changed = false; + + for (short i = -1; i <= 1; i++) + for (short j = -1; j <= 1; j++) { + if (!Landscape[Guy.Pos.x + i][Guy.Pos.y + j].Discovered) { + Landscape[Guy.Pos.x + i][Guy.Pos.y + j].Discovered = true; + changed = true; } + } - if (Aenderung) - Generate(); + if (changed) { + Generate(); } +} } // namespace World diff --git a/src/World.hpp b/src/World.hpp index 0dddf1b..d444f89 100644 --- a/src/World.hpp +++ b/src/World.hpp @@ -3,24 +3,23 @@ #include "headers.hpp" #include "extern.hpp" -namespace World -{ - void AddTime(short h, short m); // Addiert Stunden und Minuten zur TagesZeit - void AddResource(short Art, float Anzahl); // Fügt wassser usw hinzu - void Generate(); // Kacheln in den Speicher zeichnen - void Compute(short MinGroesse, short MaxGroesse); // Zufallslandschaft erzeugen - void Meer(); // Mit Meer aufüllen - void Fluss(); // Erstellt einen Fluß - bool CheckFluss(short x, short y); // Für FLuss() - void Baeume(short Prozent); // Verteilt die Bäume auf Insel - void Entdecken(); // Deckt die Kacheln neben der Spielfigur auf - void CheckBenutze(short Objekt); // Prüft ob die richtigen Rohstoffe benutzt wurden (im Inventar) - bool CheckRohstoff(); // Prüft die Rohstoffe die zum Bau benötigt werden - void MakeRohString(short x, short y, short Objekt); // Schreibt in den Rohstring die benötigten Rohstoffe - void CheckSpzButton(); // Wechselt die Knöpfe (Stop,Weiter,Ablegen usw.) - void ChangeBootsFahrt(); // Ändert die notwendigen Sachen für eine Bootsfahrt (und zurück); - void FillRohr(); // Überprüft die Röhren, ob sie an Wassernetz angeschlossen sind - void CheckRohr(short x, short y); // Rekursive Procedure für FillRohr(); - void Schatz(); // Schatz vergraben und Schatzkarte malen - void Piratenwrack(); // Setzt das Piratenwrack +namespace World { +void AddTime(short h, short m); // Adds hours and minutes to the time of day +void AddResource(short Art, float Anzahl); // Adds water, etc. +void Generate(); // Generate tiles in memory +void Compute(short MinimumSize, short maximumSize); // Generate a random landscape +void CreateSea(); // Fill up with sea +void CreateRiver(); // Create a river +bool CheckRiverFlow(short x, short y); // For flow () +void CreateTrees(short percent); // Spread the trees on the island +void UpdateDiscovered(); // Reveal the tiles next to the player +void OnRawMaterialsUsed(short Objekt); // Checks whether the correct raw materials have been used (in the inventory) +bool CheckRawMaterials(); // Checks the raw materials that are needed for construction +void RawMaterialsDescriptionString(short x, short y, short Objekt); // // Writes the required raw materials in the raw string +void UpdateButtons(); // Changes the buttons (stop, next, discard, etc.) +void ToggleIsInBoat(); // change the necessary things for a boat trip (and back); +void FillPipe(); // Checks the pipes to see if they are connected to the water supply +void CheckPipe(short x, short y); // recursive procedure for fill pipe (); +void Treasure(); // Bury the treasure and draw a treasure map +void CreatePirateWreck(); // Set the pirate wreck } // namespace World diff --git a/src/constants.hpp b/src/constants.hpp index ec2b2e7..30c8c77 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -1,213 +1,215 @@ #pragma once -const int KXPIXEL = 54; // Breite der Kacheln -const int KYPIXEL = 44; // Hoehe der Kacheln -const unsigned int S1XPIXEL = 20; // Breite der Schrift1 -const unsigned int S1YPIXEL = 20; // Höhe der Schrift1 -const unsigned int S1ABSTAND = 13; // Abstand zum nächsten Buchstaben -const unsigned int S2XPIXEL = 10; // Breite der Schrift2 -const unsigned int S2YPIXEL = 15; // Höhe der Schrift2 -const unsigned int S2ABSTAND = 10; // Abstand zum nächsten Buchstaben -const unsigned int MAXXKACH = 60; // Anzahl der Kacheln -const unsigned int MAXYKACH = 60; -const unsigned int MAXSCAPEX = 3360; // Größe der Scapesurface -const unsigned int MAXSCAPEY = 1700; -const unsigned int MAXX = 1280; // Bildschirmauflösung -const unsigned int MAXY = 720; -const unsigned int GIPFEL = 3; // Hoehe des Gipfels -const unsigned int MAXFLUSS = 1000; // Maximale Flusslänge -const unsigned int FLUSSANZAHL = 1; // Wieviele Flüsse? Mehr als 1 funktioniert seltsamerweise nicht mehr.. -const unsigned int SKARTEX = 370; // Schatzkartenbreite -const unsigned int SKARTEY = 370; // Schatzkartenhöhe +const int TILE_SIZE_X = 54; // Breite der Kacheln +const int TILE_SIZE_Y = 44; // Hoehe der Kacheln +const int FONT1_LETTER_WIDTH = 20; // Breite der Schrift1 +const int FONT1_LETTER_HEIGHT = 20; // Höhe der Schrift1 +const int FONT1_LETTER_SPACING = 13; // Abstand zum nächsten Buchstaben +const int FONT2_LETTER_WIDTH = 10; // Breite der Schrift2 +const int FONT2_LETTER_HEIGHT = 15; // Höhe der Schrift2 +const int FONT2_LETTER_SPACING = 10; // Abstand zum nächsten Buchstaben +const int MAX_TILES_X = 60; // Anzahl der Kacheln +const int MAX_TILESY = 60; +const int MAX_SURFACE_X = 3360; // Größe der Scapesurface +const int MAX_SURFACE_Y = 1700; +const int MAX_SCREEN_X = 1280; // Bildschirmauflösung +const int MAX_SCREEN_Y = 720; +const int MOUNTAIN_HEIGHT = 3; // Hoehe des Gipfels +const int MAX_RIVER_LENGTH = 1000; // Maximale Flusslänge +const int NUMBER_OF_RIVERS = 1; // Wieviele Flüsse? Mehr als 1 funktioniert seltsamerweise nicht mehr.. +const int TREASUREMAP_WIDTH = 370; // Schatzkartenbreite +const int TREASUREMAP_HEIGHT = 370; // Schatzkartenhöhe -enum Tiles -{ - MEERWELLEN = 0, - FLUSS1 = MEERWELLEN + 1, - FLUSS2 = MEERWELLEN + 2, - FLUSS3 = MEERWELLEN + 3, - FLUSS4 = MEERWELLEN + 4, - FLUSS5 = MEERWELLEN + 5, - FLUSS6 = MEERWELLEN + 6, - FLUSS7 = MEERWELLEN + 7, - FLUSS8 = MEERWELLEN + 8, - FLUSS9 = MEERWELLEN + 9, - FLUSS10 = MEERWELLEN + 10, - MUENDUNG1 = MEERWELLEN + 11, - MUENDUNG2 = MEERWELLEN + 12, - MUENDUNG3 = MEERWELLEN + 13, - MUENDUNG4 = MEERWELLEN + 14, - QUELLE1 = MEERWELLEN + 15, - QUELLE2 = MEERWELLEN + 16, // Wenn hier was eingefügt wird, auch die FillRohr ändern!! - QUELLE3 = MEERWELLEN + 17, - QUELLE4 = MEERWELLEN + 18, - SCHLEUSE1 = MEERWELLEN + 19, - SCHLEUSE2 = MEERWELLEN + 20, - SCHLEUSE3 = MEERWELLEN + 21, - SCHLEUSE4 = MEERWELLEN + 22, - SCHLEUSE5 = MEERWELLEN + 23, - SCHLEUSE6 = MEERWELLEN + 24, - BAUM1 = 25, - BAUM2 = BAUM1 + 1, - BAUM3 = BAUM1 + 2, - BAUM4 = BAUM1 + 3, - BUSCH = BAUM1 + 4, - BAUM1DOWN = BAUM1 + 5, - BAUM2DOWN = BAUM1 + 6, - BAUM3DOWN = BAUM1 + 7, - BAUM4DOWN = BAUM1 + 8, - BAUMGROSS = BAUM1 + 9, - FEUER = BAUM1 + 10, - WRACK = BAUM1 + 11, - WRACK2 = BAUM1 + 12, - FELD = 38, - ZELT = FELD + 1, - BOOT = FELD + 2, - ROHR = FELD + 3, - SOS = FELD + 4, - HAUS1 = FELD + 5, - HAUS2 = FELD + 6, - HAUS3 = FELD + 7, - FEUERSTELLE = FELD + 8, - CUPFEIL = 47, - CURICHTUNG = CUPFEIL + 1, - CUUHR = CUPFEIL + 2, - GUYLINKS = 50, - GUYOBEN = GUYLINKS + 1, - GUYRECHTS = GUYLINKS + 2, - GUYUNTEN = GUYLINKS + 3, - GUYSUCHEN = GUYLINKS + 4, - GUYESSEN = GUYLINKS + 5, - GUYTRINKEN = GUYLINKS + 6, - GUYFAELLEN = GUYLINKS + 7, - GUYWARTEN = GUYLINKS + 8, - GUYFELD = GUYLINKS + 9, - GUYBINDENOBEN = GUYLINKS + 10, - GUYBINDENUNTEN = GUYLINKS + 11, - GUYSCHLAFEN = GUYLINKS + 12, - GUYSCHLAFZELT = GUYLINKS + 13, - GUYGEHINZELT = GUYLINKS + 14, - GUYHINLEGEN = GUYLINKS + 15, - GUYAUFSTEHEN = GUYLINKS + 16, - GUYANGELN1LINKS = GUYLINKS + 17, - GUYANGELN1OBEN = GUYLINKS + 18, - GUYANGELN1RECHTS = GUYLINKS + 19, - GUYANGELN1UNTEN = GUYLINKS + 20, - GUYANGELN2LINKS = GUYLINKS + 21, - GUYANGELN2OBEN = GUYLINKS + 22, - GUYANGELN2RECHTS = GUYLINKS + 23, - GUYANGELN2UNTEN = GUYLINKS + 24, - GUYANGELN3LINKS = GUYLINKS + 25, - GUYANGELN3OBEN = GUYLINKS + 26, - GUYANGELN3RECHTS = GUYLINKS + 27, - GUYANGELN3UNTEN = GUYLINKS + 28, - GUYSCHLAGEN = GUYLINKS + 29, - GUYBOOTLINKS = GUYLINKS + 30, - GUYBOOTOBEN = GUYLINKS + 31, - GUYBOOTRECHTS = GUYLINKS + 32, - GUYBOOTUNTEN = GUYLINKS + 33, - GUYBOOTANGELN1 = GUYLINKS + 34, - GUYBOOTANGELN2 = GUYLINKS + 35, - GUYBOOTANGELN3 = GUYLINKS + 36, - GUYTAUCHEN1 = GUYLINKS + 37, - GUYTAUCHEN2 = GUYLINKS + 38, - GUYTAUCHEN3 = GUYLINKS + 39, - GUYHAMMER = GUYLINKS + 40, - GUYKLETTERN1 = GUYLINKS + 41, - GUYKLETTERN2 = GUYLINKS + 42, - GUYHAMMER2 = GUYLINKS + 43, - GUYGEHINHAUS = GUYLINKS + 44, - GUYSCHLAFHAUS = GUYLINKS + 45, - GUYGEHAUSHAUS = GUYLINKS + 46, - GUYANZUENDEN = GUYLINKS + 47, - GUYAUSSCHAU = GUYLINKS + 48, - GUYSCHAUFELN = GUYLINKS + 49, - GUYSCHIFF = GUYLINKS + 50, - GUYSCHIFFDOWN = GUYLINKS + 51, - GUYSCHWIMMEN = GUYLINKS + 52, - GUYTOD = GUYLINKS + 53, - GUYBOOTTOD = GUYLINKS + 54, - GUYBOOTWARTEN = GUYLINKS + 55, - GUYSCHLEUDER = GUYLINKS + 56, - BUTTGITTER = 107, - BUTTANIMATION = BUTTGITTER + 1, - BUTTBEENDEN = BUTTGITTER + 2, - BUTTNEU = BUTTGITTER + 3, - BUTTTAGNEU = BUTTGITTER + 4, - BUTTSOUND = BUTTGITTER + 5, - BUTTAKTION = BUTTGITTER + 6, - BUTTBAUEN = BUTTGITTER + 7, - BUTTINVENTAR = BUTTGITTER + 8, - BUTTWEITER = BUTTGITTER + 9, - BUTTSTOP = BUTTGITTER + 10, - BUTTABLEGEN = BUTTGITTER + 11, - BUTTSUCHEN = 119, - BUTTESSEN = BUTTSUCHEN + 1, - BUTTSCHLAFEN = BUTTSUCHEN + 2, - BUTTFAELLEN = BUTTSUCHEN + 3, - BUTTANGELN = BUTTSUCHEN + 4, - BUTTANZUENDEN = BUTTSUCHEN + 5, - BUTTAUSSCHAU = BUTTSUCHEN + 6, - BUTTSCHATZKARTE = BUTTSUCHEN + 7, - BUTTSCHATZ = BUTTSUCHEN + 8, - BUTTSCHLEUDER = BUTTSUCHEN + 9, - BUTTZELT = 129, - BUTTFELD = BUTTZELT + 1, - BUTTBOOT = BUTTZELT + 2, - BUTTROHR = BUTTZELT + 3, - BUTTSOS = BUTTZELT + 4, - BUTTHAUS1 = BUTTZELT + 5, - BUTTHAUS2 = BUTTZELT + 6, - BUTTHAUS3 = BUTTZELT + 7, - BUTTFEUERST = BUTTZELT + 8, - BUTTFRAGEZ = BUTTZELT + 9, - BUTTDESTROY = BUTTZELT + 10, - SAEULE1 = 140, - SAEULE2 = SAEULE1 + 1, - SAEULE3 = SAEULE1 + 2, - ROHAST = 143, - ROHSTAMM = ROHAST + 1, - ROHSTEIN = ROHAST + 2, - ROHAXT = ROHAST + 3, - ROHBLATT = ROHAST + 4, - ROHEGGE = ROHAST + 5, - ROHLIANE = ROHAST + 6, - ROHANGEL = ROHAST + 7, - ROHHAMMER = ROHAST + 8, - ROHFERNROHR = ROHAST + 9, - ROHSTREICHHOLZ = ROHAST + 10, - ROHSCHAUFEL = ROHAST + 11, - ROHKARTE = ROHAST + 12, - ROHSCHLEUDER = ROHAST + 13, +namespace Tiles { +enum Tile { + INVALID = -1, + SEA_WAVES = 0, + RIVER_1 = SEA_WAVES + 1, + RIVER_2 = SEA_WAVES + 2, + RIVER_3 = SEA_WAVES + 3, + RIVER_4 = SEA_WAVES + 4, + RIVER_5 = SEA_WAVES + 5, + RIVER_6 = SEA_WAVES + 6, + RIVER_7 = SEA_WAVES + 7, + RIVER_8 = SEA_WAVES + 8, + RIVER_9 = SEA_WAVES + 9, + RIVER_10 = SEA_WAVES + 10, + RIVER_END_1 = SEA_WAVES + 11, + RIVER_END_2 = SEA_WAVES + 12, + RIVER_END_3 = SEA_WAVES + 13, + RIVER_END_4 = SEA_WAVES + 14, + RIVER_START_1 = SEA_WAVES + 15, + RIVER_START_2 = SEA_WAVES + 16, // Wenn hier was eingefügt wird, auch die FillRohr ändern!! + RIVER_START_3 = SEA_WAVES + 17, + RIVER_START_4 = SEA_WAVES + 18, + FLOODGATE_1 = SEA_WAVES + 19, + FLOODGATE_2 = SEA_WAVES + 20, + FLOODGATE_3 = SEA_WAVES + 21, + FLOODGATE_4 = SEA_WAVES + 22, + FLOODGATE_5 = SEA_WAVES + 23, + FLOODGATE_6 = SEA_WAVES + 24, + TREE_1 = 25, + TREE_2 = 26,//TREE_1 + 1, + TREE_3 = 27,//TREE_1 + 2, + TREE_4 = 28,//TREE_1 + 3, + BUSH = 29,//TREE_1 + 4, + TREE_DOWN_1 = 30,//TREE_1 + 5, + TREE_DOWN_2 = 31,//TREE_1 + 6, + TREE_DOWN_3 = 32,//TREE_1 + 7, + TREE_DOWN_4 = 33,//TREE_1 + 8, + TREE_BIG = 34,//TREE_1 + 9, + FIRE = 35,//TREE_1 + 10, + WRECK_1 = 36,//TREE_1 + 11, + WRECK_2 = 37,//TREE_1 + 12, + FIELD = 38, + TENT = 39,//FIELD + 1, + BOAT = 40,//FIELD + 2, + PIPE = 41,//FIELD + 3, + SOS = 42,//FIELD + 4, + HOUSE_1 = 43,//FIELD + 5, + HOUSE_2 = 44,//FIELD + 6, + HOUSE_3 = 45,//FIELD + 7, + BONFIRE = 46,//FIELD + 8, + CURSOR_ARROW = 47, + CURSOR_DIRECTION = 48,// CURSOR_ARROW + 1, + CURSOR_CLOCK = 49,//CURSOR_ARROW + 2, + GUY_LEFT = 50, + GUY_OVER = GUY_LEFT + 1, + GUY_RIGHT = GUY_LEFT + 2, + GUY_BELOW = GUY_LEFT + 3, + GUY_SEARCH = GUY_LEFT + 4, + GUY_EAT = GUY_LEFT + 5, + GUY_DRINK = GUY_LEFT + 6, + GUY_CHOP = GUY_LEFT + 7, + GUY_WAITING = GUY_LEFT + 8, + GUY_FARMING = GUY_LEFT + 9, + GUY_TIE_UP = GUY_LEFT + 10, + GUY_TIE_DOWN = GUY_LEFT + 11, + GUY_SLEEPING = GUY_LEFT + 12, + GUY_SLEEPING_TENT = GUY_LEFT + 13, + GUY_ENTER_TENT = GUY_LEFT + 14, + GUY_LAYING_TENT = GUY_LEFT + 15, + GUY_STAND_UP = GUY_LEFT + 16, + GUY_FISHING_LEFT_1 = GUY_LEFT + 17, + GUY_FISHING_ABOVE_1 = GUY_LEFT + 18, + GUY_FISHING_RIGHT_1 = GUY_LEFT + 19, + GUY_FISHING_BELOW_1 = GUY_LEFT + 20, + GUY_FISHING_LEFT_2 = GUY_LEFT + 21, + GUY_FISHING_ABOVE_2 = GUY_LEFT + 22, + GUY_FISHING_RIGHT_2 = GUY_LEFT + 23, + GUY_FISHING_BELOW_2 = GUY_LEFT + 24, + GUY_FISHING_LEFT_3 = GUY_LEFT + 25, + GUY_FISHING_ABOVE_3 = GUY_LEFT + 26, + GUY_FISHING_RIGHT_3 = GUY_LEFT + 27, + GUY_FISHING_BELOW_3 = GUY_LEFT + 28, + GUY_BEAT = GUY_LEFT + 29, + GUY_BOAT_LEFT = GUY_LEFT + 30, + GUY_BOAT_ABOVE = GUY_LEFT + 31, + GUY_BOAT_RIGHT = GUY_LEFT + 32, + GUY_BOAT_BELOW = GUY_LEFT + 33, + GUY_BOAT_FISHING_1 = GUY_LEFT + 34, + GUY_BOAT_FISHING_2 = GUY_LEFT + 35, + GUY_BOAT_FISHING_3 = GUY_LEFT + 36, + GUY_DIVING_1 = GUY_LEFT + 37, + GUY_DIVING_2 = GUY_LEFT + 38, + GUY_DIVING_3 = GUY_LEFT + 39, + GUY_HAMMER_1 = GUY_LEFT + 40, + GUY_CLIMBING_1 = GUY_LEFT + 41, + GUY_CLIMBING_2 = GUY_LEFT + 42, + GUY_HAMMER_2 = GUY_LEFT + 43, + GUY_ENTER_HOUSE = GUY_LEFT + 44, + GUY_SLEEP_HOUSE = GUY_LEFT + 45, + GUY_EXIT_HOUSE = GUY_LEFT + 46, + GUY_SET_FIRE = GUY_LEFT + 47, + GUY_LOOK_OUT = GUY_LEFT + 48, + GUY_SHOVEL = GUY_LEFT + 49, + GUY_SHIP = GUY_LEFT + 50, + GUY_SHIP_DOWN = GUY_LEFT + 51, + GUY_SWIM = GUY_LEFT + 52, + GUY_DEAD = GUY_LEFT + 53, + GUY_BOAT_DEAD = GUY_LEFT + 54, + GUY_BOAT_WAITING = GUY_LEFT + 55, + GUY_SLINGSHOT = GUY_LEFT + 56, + BUTTON_GRID = 107, + BUTTON_ANIMATION = BUTTON_GRID + 1, + BUTTON_END = BUTTON_GRID + 2, + BUTTON_NEW = BUTTON_GRID + 3, + BUTTON_NEW_DAY = BUTTON_GRID + 4, + BUTTON_SOUND = BUTTON_GRID + 5, + BUTTON_ACTION = BUTTON_GRID + 6, + BUTTON_CONSTRUCT = BUTTON_GRID + 7, + BUTTON_INVENTORY = BUTTON_GRID + 8, + BUTTON_CONTINUE = BUTTON_GRID + 9, + BUTTON_STOP = BUTTON_GRID + 10, + BUTTON_LAY_DOWN = BUTTON_GRID + 11, + BUTTON_SEARCH = 119, + BUTTON_EAT = BUTTON_SEARCH + 1, + BUTTON_SLEEP = BUTTON_SEARCH + 2, + BUTTON_CHOP = BUTTON_SEARCH + 3, + BUTTON_FISH = BUTTON_SEARCH + 4, + BUTTON_IGNITE = BUTTON_SEARCH + 5, + BUTTON_LOOK_OUT = BUTTON_SEARCH + 6, + BUTTON_TREASUREMAP = BUTTON_SEARCH + 7, + BUTTON_TREASURE = BUTTON_SEARCH + 8, + BUTTON_SLINGSHOT = BUTTON_SEARCH + 9, + BUTTON_TENT = 129, + BUTTON_FARM = BUTTON_TENT + 1, + BUTTON_BOAT = BUTTON_TENT + 2, + BUTTON_PIPE = BUTTON_TENT + 3, + BUTTON_SOS = BUTTON_TENT + 4, + BUTTON_HOUSE_1 = BUTTON_TENT + 5, + BUTTON_HOUSE_2 = BUTTON_TENT + 6, + BUTTON_HOUSE_3 = BUTTON_TENT + 7, + BUTTON_FIRE = BUTTON_TENT + 8, + BUTTON_QUESTION = BUTTON_TENT + 9, + BUTTON_DESTROY = BUTTON_TENT + 10, + COLUMN_1 = 140, + COLUMN_2 = COLUMN_1 + 1, + COLUMN_3 = COLUMN_1 + 2, + RAW_TREE_BRANCH = 143, + RAW_TREE_TRUNK = RAW_TREE_BRANCH + 1, + RAW_STONE = RAW_TREE_BRANCH + 2, + RAW_AXE = RAW_TREE_BRANCH + 3, + RAW_LEAF = RAW_TREE_BRANCH + 4, + RAW_HOE = RAW_TREE_BRANCH + 5, + RAW_LIANA = RAW_TREE_BRANCH + 6, + RAW_FISHING_POLE = RAW_TREE_BRANCH + 7, + RAW_HAMMER = RAW_TREE_BRANCH + 8, + RAW_TELESCOPE = RAW_TREE_BRANCH + 9, + RAW_MATCH = RAW_TREE_BRANCH + 10, + RAW_SHOVEL = RAW_TREE_BRANCH + 11, + RAW_MAP = RAW_TREE_BRANCH + 12, + RAW_SLINGSHOT = RAW_TREE_BRANCH + 13, ROEMISCH1 = 157, ROEMISCH2 = ROEMISCH1 + 1, - INVPAPIER = 159, - RING = INVPAPIER + 1, - KREUZ = INVPAPIER + 2, - JA = INVPAPIER + 3, - NEIN = INVPAPIER + 4, - SONNE = INVPAPIER + 5, - PROGRAMMIERUNG = 165, - DIRKPLATE = PROGRAMMIERUNG + 1, - MATTHIAS = PROGRAMMIERUNG + 2, - TOBIAS = PROGRAMMIERUNG + 3, - SIGRID = PROGRAMMIERUNG + 4, - SOUNDS = PROGRAMMIERUNG + 5, - PATHFINDING = PROGRAMMIERUNG + 6, - JOHN = PROGRAMMIERUNG + 7, - HEIKO = PROGRAMMIERUNG + 8, - GISELA = PROGRAMMIERUNG + 9, - WEITEREHILFE = PROGRAMMIERUNG + 10, - TESTSPIELER = PROGRAMMIERUNG + 11, - SCHWARZ = PROGRAMMIERUNG + 12, - MUSIK = PROGRAMMIERUNG + 13, - DPSOFTWARE = PROGRAMMIERUNG + 14, - BILDANZ = DPSOFTWARE + 1, // Wieviele Bilder + INVENTORY_PAPER = 159, + RING = INVENTORY_PAPER + 1, + CROSS = INVENTORY_PAPER + 2, + YES = INVENTORY_PAPER + 3, + NO = INVENTORY_PAPER + 4, + SUN = INVENTORY_PAPER + 5, + PROGRAMMING = 165, + DIRK_PLATE = PROGRAMMING + 1, + MATTHIAS = PROGRAMMING + 2, + TOBIAS = PROGRAMMING + 3, + SIGRID = PROGRAMMING + 4, + SOUNDS = PROGRAMMING + 5, + PATHFINDING = PROGRAMMING + 6, + JOHN = PROGRAMMING + 7, + HEIKO = PROGRAMMING + 8, + GISELA = PROGRAMMING + 9, + FURTHER_HELP = PROGRAMMING + 10, + TEST_PLAYER = PROGRAMMING + 11, + SCHWARZ = PROGRAMMING + 12, + MUSIC = PROGRAMMING + 13, + DPSOFTWARE = PROGRAMMING + 14, + SPRITE_COUNT = DPSOFTWARE + 1, // Wieviele Bilder }; +} +static constexpr int SPRITE_COUNT = int(Tiles::SPRITE_COUNT); // Textfelder -enum Textfields -{ +enum Textfields { TXTTEXTFELD = 0, TXTFPS = 1, TXTTAGESZEIT = 2, @@ -217,26 +219,8 @@ enum Textfields }; // Resourcen -enum Resources -{ - WASSER = 0, - NAHRUNG = 1, - GESUNDHEIT = 2, +enum Resources { + Water = 0, + Food = 1, + Health = 2, }; - -// Bilder -static const char Misc[] = "MISC"; -static const char Panel[] = "PANEL"; -static const char GuyAni[] = "GUYANI"; -static const char Animation[] = "ANIMATION"; -static const char Schrift1[] = "SCHRIFT1"; -static const char Schrift2[] = "SCHRIFT2"; -static const char TextFeld[] = "TEXTFELD"; -static const char Papier[] = "PAPIER"; -static const char Baum[] = "BAUM"; -static const char Cursorbmp[] = "CURSORBMP"; -static const char Buttons[] = "BUTTONS"; -static const char Inventarbmp[] = "INVENTARBMP"; -static const char Bau[] = "BAU"; -static const char Credits[] = "CREDITS"; -static const char Logo[] = "LOGO"; diff --git a/src/ddutil.cpp b/src/ddutil.cpp deleted file mode 100644 index dfbd640..0000000 --- a/src/ddutil.cpp +++ /dev/null @@ -1,308 +0,0 @@ -//----------------------------------------------------------------------------- -// File: ddutil.cpp -// -// Desc: Routines for loading bitmap and palettes from resources -// -// -// Copyright (c) 1995-1998 Microsoft Corporation. All rights reserved. -//----------------------------------------------------------------------------- - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -//----------------------------------------------------------------------------- -// Include files -//----------------------------------------------------------------------------- -#include -#include -#include -#include "ddutil.h" - - -//----------------------------------------------------------------------------- -// Name: DDLoadBitmap() -// Desc: Create a DirectDrawSurface from a bitmap resource. -//----------------------------------------------------------------------------- -extern "C" IDirectDrawSurface4* -DDLoadBitmap(IDirectDraw4* pdd, LPCSTR szBitmap, int dx, int dy) -{ - HBITMAP hbm; - BITMAP bm; - DDSURFACEDESC2 ddsd; - IDirectDrawSurface4* pdds; - - // - // Try to load the bitmap as a resource, if that fails, try it as a file - // - hbm = (HBITMAP)LoadImage(GetModuleHandle(nullptr), szBitmap, IMAGE_BITMAP, dx, - dy, LR_CREATEDIBSECTION); - if (hbm == nullptr) - hbm = (HBITMAP)LoadImage(nullptr, szBitmap, IMAGE_BITMAP, dx, dy, - LR_LOADFROMFILE | LR_CREATEDIBSECTION); - if (hbm == nullptr) - return nullptr; - // - // Get size of the bitmap - // - GetObject(hbm, sizeof(bm), &bm); - // - // Create a DirectDrawSurface for this bitmap - // - ZeroMemory(&ddsd, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = bm.bmWidth; - ddsd.dwHeight = bm.bmHeight; - if (pdd->CreateSurface(&ddsd, &pdds, nullptr) != DD_OK) - return nullptr; - DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); - DeleteObject(hbm); - return pdds; -} - - -//----------------------------------------------------------------------------- -// Name: DDReLoadBitmap() -// Desc: Load a bitmap from a file or resource into a directdraw surface. -// normaly used to re-load a surface after a restore. -//----------------------------------------------------------------------------- -HRESULT -DDReLoadBitmap(IDirectDrawSurface4* pdds, LPCSTR szBitmap) -{ - HBITMAP hbm; - HRESULT hr; - - // - // Try to load the bitmap as a resource, if that fails, try it as a file - // - hbm = (HBITMAP)LoadImage(GetModuleHandle(nullptr), szBitmap, IMAGE_BITMAP, 0, - 0, LR_CREATEDIBSECTION); - if (hbm == nullptr) - hbm = (HBITMAP)LoadImage(nullptr, szBitmap, IMAGE_BITMAP, 0, 0, - LR_LOADFROMFILE | LR_CREATEDIBSECTION); - if (hbm == nullptr) - { - OutputDebugString("handle is null\n"); - return E_FAIL; - } - hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); - if (hr != DD_OK) - { - OutputDebugString("ddcopybitmap failed\n"); - } - DeleteObject(hbm); - return hr; -} - - -//----------------------------------------------------------------------------- -// Name: DDCopyBitmap() -// Desc: Draw a bitmap into a DirectDrawSurface -//----------------------------------------------------------------------------- -extern "C" HRESULT -DDCopyBitmap(IDirectDrawSurface4* pdds, HBITMAP hbm, int x, int y, - int dx, int dy) -{ - HDC hdcImage; - HDC hdc; - BITMAP bm; - DDSURFACEDESC2 ddsd; - HRESULT hr; - - if (hbm == nullptr || pdds == nullptr) - return E_FAIL; - // - // Make sure this surface is restored. - // - pdds->Restore(); - // - // Select bitmap into a memoryDC so we can use it. - // - hdcImage = CreateCompatibleDC(nullptr); - if (!hdcImage) - OutputDebugString("createcompatible dc failed\n"); - SelectObject(hdcImage, hbm); - // - // Get size of the bitmap - // - GetObject(hbm, sizeof(bm), &bm); - dx = dx == 0 ? bm.bmWidth : dx; // Use the passed size, unless zero - dy = dy == 0 ? bm.bmHeight : dy; - // - // Get size of surface. - // - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; - pdds->GetSurfaceDesc(&ddsd); - - if ((hr = pdds->GetDC(&hdc)) == DD_OK) - { - StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, - dx, dy, SRCCOPY); - pdds->ReleaseDC(hdc); - } - DeleteDC(hdcImage); - return hr; -} - - -//----------------------------------------------------------------------------- -// Name: DDLoadPalette() -// Desc: Create a DirectDraw palette object from a bitmap resource -// if the resource does not exist or nullptr is passed create a -// default 332 palette. -//----------------------------------------------------------------------------- -extern "C" IDirectDrawPalette* -DDLoadPalette(IDirectDraw4* pdd, LPCSTR szBitmap) -{ - IDirectDrawPalette* ddpal; - int i; - int n; - int fh; - HRSRC h; - LPBITMAPINFOHEADER lpbi; - PALETTEENTRY ape[256]; - RGBQUAD* prgb; - - // - // Build a 332 palette as the default. - // - for (i = 0; i < 256; i++) - { - ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7); - ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7); - ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3); - ape[i].peFlags = (BYTE)0; - } - // - // Get a pointer to the bitmap resource. - // - if (szBitmap && (h = FindResource(nullptr, szBitmap, RT_BITMAP))) - { - lpbi = (LPBITMAPINFOHEADER)LockResource(LoadResource(nullptr, h)); - if (!lpbi) - OutputDebugString("lock resource failed\n"); - prgb = (RGBQUAD *)((BYTE *)lpbi + lpbi->biSize); - if (lpbi == nullptr || lpbi->biSize < sizeof(BITMAPINFOHEADER)) - n = 0; - else if (lpbi->biBitCount > 8) - n = 0; - else if (lpbi->biClrUsed == 0) - n = 1 << lpbi->biBitCount; - else - n = lpbi->biClrUsed; - // - // A DIB color table has its colors stored BGR not RGB - // so flip them around. - // - for (i = 0; i < n; i++) - { - ape[i].peRed = prgb[i].rgbRed; - ape[i].peGreen = prgb[i].rgbGreen; - ape[i].peBlue = prgb[i].rgbBlue; - ape[i].peFlags = 0; - } - } - else if (szBitmap && (fh = _lopen(szBitmap, OF_READ)) != -1) - { - BITMAPFILEHEADER bf; - BITMAPINFOHEADER bi; - - _lread(fh, &bf, sizeof(bf)); - _lread(fh, &bi, sizeof(bi)); - _lread(fh, ape, sizeof(ape)); - _lclose(fh); - if (bi.biSize != sizeof(BITMAPINFOHEADER)) - n = 0; - else if (bi.biBitCount > 8) - n = 0; - else if (bi.biClrUsed == 0) - n = 1 << bi.biBitCount; - else - n = bi.biClrUsed; - // - // A DIB color table has its colors stored BGR not RGB - // so flip them around. - // - for (i = 0; i < n; i++) - { - BYTE r = ape[i].peRed; - - ape[i].peRed = ape[i].peBlue; - ape[i].peBlue = r; - } - } - pdd->CreatePalette(DDPCAPS_8BIT, ape, &ddpal, nullptr); - return ddpal; -} - - -//----------------------------------------------------------------------------- -// Name: DDColorMatch() -// Desc: Convert a RGB color to a pysical color. -// We do this by leting GDI SetPixel() do the color matching -// then we lock the memory and see what it got mapped to. -//----------------------------------------------------------------------------- -extern "C" DWORD -DDColorMatch(IDirectDrawSurface4* pdds, COLORREF rgb) -{ - COLORREF rgbT = 0; - HDC hdc; - DWORD dw = CLR_INVALID; - DDSURFACEDESC2 ddsd; - HRESULT hres; - - // - // Use GDI SetPixel to color match for us - // - if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) - { - rgbT = GetPixel(hdc, 0, 0); // Save current pixel value - SetPixel(hdc, 0, 0, rgb); // Set our value - pdds->ReleaseDC(hdc); - } - // - // Now lock the surface so we can read back the converted color - // - ddsd.dwSize = sizeof(ddsd); - while ((hres = pdds->Lock(nullptr, &ddsd, 0, nullptr)) == DDERR_WASSTILLDRAWING) - { - // Busy wait - } - - if (hres == DD_OK) - { - dw = *(DWORD *)ddsd.lpSurface; // Get DWORD - if (ddsd.ddpfPixelFormat.dwRGBBitCount < 32) - dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount) - 1; // Mask it to bpp - pdds->Unlock(nullptr); - } - // - // Now put the color that was there back. - // - if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) - { - SetPixel(hdc, 0, 0, rgbT); - pdds->ReleaseDC(hdc); - } - return dw; -} - - -//----------------------------------------------------------------------------- -// Name: DDSetColorKey() -// Desc: Set a color key for a surface, given a RGB. -// If you pass CLR_INVALID as the color key, the pixel -// in the upper-left corner will be used. -//----------------------------------------------------------------------------- -extern "C" HRESULT -DDSetColorKey(IDirectDrawSurface4* pdds, COLORREF rgb) -{ - DDCOLORKEY ddck; - - ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb); - ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; - return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); -} diff --git a/src/ddutil.h b/src/ddutil.h deleted file mode 100644 index 1317fbb..0000000 --- a/src/ddutil.h +++ /dev/null @@ -1,24 +0,0 @@ -/*========================================================================== - * - * Copyright (C) 1998 Microsoft Corporation. All Rights Reserved. - * - * File: ddutil.cpp - * Content: Routines for loading bitmap and palettes from resources - * - ***************************************************************************/ - -#ifdef __cplusplus -extern "C" -{ /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - - extern IDirectDrawPalette* DDLoadPalette(IDirectDraw4* pdd, LPCSTR szBitmap); - extern IDirectDrawSurface4* DDLoadBitmap(IDirectDraw4* pdd, LPCSTR szBitmap, int dx, int dy); - extern HRESULT DDReLoadBitmap(IDirectDrawSurface4* pdds, LPCSTR szBitmap); - extern HRESULT DDCopyBitmap(IDirectDrawSurface4* pdds, HBITMAP hbm, int x, int y, int dx, int dy); - extern DWORD DDColorMatch(IDirectDrawSurface4* pdds, COLORREF rgb); - extern HRESULT DDSetColorKey(IDirectDrawSurface4* pdds, COLORREF rgb); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/src/extern.hpp b/src/extern.hpp index e363a36..29f5797 100644 --- a/src/extern.hpp +++ b/src/extern.hpp @@ -4,89 +4,95 @@ #include "types.hpp" #include +#include +#include +#include #include -extern int Spielzustand; // in welchem Zustand ist das Spiel? +extern int s_GameState; // in welchem Zustand ist das Spiel? extern bool LAnimation; // Ist die Landschaftanimation angeschaltet? extern bool Gitter; // Gitternetz an/aus extern RECT ScapeGrenze; // Diese Koordinaten zeigen die Größe der Landschaft an extern short CursorTyp; // Welcher Cursortyp? extern short RouteLaenge; // Länge extern short RoutePunkt; // Aktueller Index in RouteKoor -extern short Bild, LastBild; // Anzahl der Bilder in der Sekunde +extern short CurrentFrame, FPS; // Anzahl der Bilder in der Sekunde extern RECT rcRectdes, rcRectsrc; // Ständig benötigte Variable zum Blitten -extern short Tag, Stunden, Minuten; // Wieviel Uhr (0-12h) +extern short Tag, Hours, Minutes; // Wieviel Uhr (0-12h) extern char StdString[1024]; // Standard string extern char RohString[1024]; // Darin wird gespeichert, wieviel Rohstoffe noch benötigt werden extern short PapierText; // Wieviel Papier? (in Pixel) -1 = Kein Text extern short HauptMenue; // Welches Menü? extern short TwoClicks; // Für Aktionen mit zwei Mausklicks extern float Chance; // Wie groß ist die Chance am Tag gerettet zu werden -extern bool BootsFahrt; // Gerade mit dem Boot unterwegs? -extern bool Nacht; // Wird die Tageszusammenfassung angezeigt? -extern short Soundzustand; // -1 = keine Soundkarte;0=kein Sound;1=Sound an +extern bool IsInBoat; // Gerade mit dem Boot unterwegs? +extern bool Night; // Wird die Tageszusammenfassung angezeigt? +extern short s_SoundState; // -1 = keine Soundkarte;0=kein Sound;1=Sound an extern short Frage; // -1=KeineFrage;0=Frage wird gestellt;1=Ja;2=Nein -extern short AbspannNr; // Zähler für Abspann -extern short AbspannZustand; // Wo im Abspann +extern short CreditsNum; // End credits counter +extern short CreditsState; // Wo im Abspann extern bool SchatzGef; // wurde der Schatz gefunden extern short Step, Steps; // Should be const extern RECT rcGesamt; -extern RECT rcSpielflaeche; +extern RECT rcPlayingSurface; extern RECT rcPanel; extern RECT rcKarte; -extern ZWEID EckKoor[13][4]; +extern Coordinate CornerCoord[13][4]; -extern TEXTBEREICH TextBereich[TEXTANZ]; +extern TextArea TextBereich[TEXTANZ]; -extern ZWEID Camera, // aktueller Kartenausschnitt - MousePosition, // " Mauskoordinaten - RouteZiel, RouteStart, // Koordinaten des Starts und des Endes der Route - Route[MAXXKACH * MAXYKACH], // Liste der Routenpunkte - RouteKoor[2 * MAXXKACH * MAXYKACH], // Liste der Routenkoordinaten - SchatzPos; // Hier ist der Schatz vergraben +extern Coordinate Camera, // aktueller Kartenausschnitt + MousePosition, // " Mauskoordinaten + RouteDestination, RouteStart, // Koordinaten des Starts und des Endes der Route + Route[MAX_TILES_X * MAX_TILESY], // Liste der Routenpunkte + RouteKoor[2 * MAX_TILES_X * MAX_TILESY], // Liste der Routenkoordinaten + SchatzPos; // Hier ist der Schatz vergraben -extern RGBSTRUCT rgbStruct; // Hier werden die Farben eines Pixels zwischengespeichert extern GUY Guy; -extern BMP Bmp[BILDANZ]; +extern BMP Bmp[SPRITE_COUNT]; extern WAV Wav[25]; // Sound::COUNT; -extern ABSPANN AbspannListe[10][10]; // Namenabfolge im Abspann -extern SCAPE Scape[MAXXKACH][MAXYKACH]; +extern CREDITS CreditsList[10][10]; // Namenabfolge im Abspann +extern SCAPE Landscape[MAX_TILES_X][MAX_TILESY]; // DirectDraw -extern LPDIRECTDRAWSURFACE4 lpDDSPrimary; // DirectDraw primary surface -extern LPDIRECTDRAWSURFACE4 lpDDSBack; // DirectDraw back surface -extern LPDIRECTDRAWSURFACE4 lpDDSMisc; // DirectDraw Bilder surface -extern LPDIRECTDRAWSURFACE4 lpDDSPanel; // DirectDraw Panel surface -extern LPDIRECTDRAWSURFACE4 lpDDSGuyAni; // DirectDraw GuyAni surface -extern LPDIRECTDRAWSURFACE4 lpDDSAnimation; // DirectDraw Animation surface -extern LPDIRECTDRAWSURFACE4 lpDDSKarte; // DirectDraw MiniMap surface -extern LPDIRECTDRAWSURFACE4 lpDDSSchrift; // DirectDraw Schrift surface -extern LPDIRECTDRAWSURFACE4 lpDDSSchrift1; // DirectDraw Schrift1 surface -extern LPDIRECTDRAWSURFACE4 lpDDSSchrift2; // DirectDraw Schrift2 surface -extern LPDIRECTDRAWSURFACE4 lpDDSTextFeld; // DirectDraw TextFeld surface -extern LPDIRECTDRAWSURFACE4 lpDDSPapier; // DirectDraw Paier surface -extern LPDIRECTDRAWSURFACE4 lpDDSBaum; // DirectDraw Bäume surface -extern LPDIRECTDRAWSURFACE4 lpDDSBau; // DirectDraw Bauwerke surface -extern LPDIRECTDRAWSURFACE4 lpDDSCredits; // DirectDraw Credits surface -extern LPDIRECTDRAWSURFACE4 lpDDSLogo; // DirectDraw Logo surface -extern LPDIRECTDRAWSURFACE4 lpDDSCursor; // DirectDraw Cursor surface -extern LPDIRECTDRAWSURFACE4 lpDDSButtons; // DirectDraw Buttons surface -extern LPDIRECTDRAWSURFACE4 lpDDSInventar; // DirectDraw Inventar surface -extern LPDIRECTDRAWSURFACE4 lpDDSScape; // DirectDraw Landschaft surface -extern LPDIRECTDRAWSURFACE4 lpDDSSchatzkarte; // SchatzkartenSurface -extern LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette -extern DDBLTFX ddbltfx; // DirectDraw Effekte -extern DDPIXELFORMAT ddpf; -extern DDSURFACEDESC2 ddsd, ddsd2; // Zwischenspeicher der SurfaceEigenschaften - -extern LPDIRECTDRAWGAMMACONTROL lpDDGammaControl; // Die drei sind für das Gammaablenden -extern DDGAMMARAMP DDGammaRamp; -extern DDGAMMARAMP DDGammaOld; - -// Directinput -extern HINSTANCE g_hInst; +extern sf::Texture *screenTexture; // DirectDraw primary surface +extern sf::Texture *lpDDSBack; // DirectDraw back surface +extern sf::Texture *lpDDSMisc; // DirectDraw Bilder surface +extern sf::Texture *lpDDSPanel; // DirectDraw Panel surface +extern sf::Texture *lpDDSGuyAni; // DirectDraw GuyAni surface +extern sf::Texture *lpDDSAnimation; // DirectDraw Animation surface +extern sf::Texture *lpDDSKarte; // DirectDraw MiniMap surface +extern sf::Texture *lpDDSSchrift1; // DirectDraw Schrift1 surface +extern sf::Texture *lpDDSSchrift2; // DirectDraw Schrift2 surface +extern sf::Texture *lpDDSTextFeld; // DirectDraw TextFeld surface +extern sf::Texture *lpDDSPaper; // DirectDraw Paier surface +extern sf::Texture *lpDDSBaum; // DirectDraw Bäume surface +extern sf::Texture *lpDDSBau; // DirectDraw Bauwerke surface +extern sf::Texture *lpDDSCredits; // DirectDraw Credits surface +extern sf::Texture *lpDDSLogo; // DirectDraw Logo surface +extern sf::Texture *lpDDSCursor; // DirectDraw Cursor surface +extern sf::Texture *lpDDSButtons; // DirectDraw Buttons surface +extern sf::Texture *lpDDSInventar; // DirectDraw Inventar surface + +extern sf::Texture *lpDDSSchatzkarte; // SchatzkartenSurface +//extern sf::Sprite *s_treasureMapSprite; + +extern sf::Sprite *s_creditsSprite; + +extern sf::Sprite *minimapPlayerSprite; +extern sf::Texture *minimapPlayerTexture; + +extern sf::Color s_darknessColor; + +extern sf::Sprite *s_creditsSprite; +extern int s_previousCreditsOverlay; +//extern bool s_creditsVisible; + +extern int s_previousCreditsOverlay; + +const char *GetLanguageString(const unsigned index); diff --git a/src/globals.cpp b/src/globals.cpp index 233c9a9..2a3fd56 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -1,35 +1,37 @@ -#pragma once +//#pragma once #include "types.hpp" #include "constants.hpp" #include "extern.hpp" +#include "strings.h" + #include #include -int Spielzustand = 0; // in welchem Zustand ist das Spiel? +int s_GameState = 0; // in welchem Zustand ist das Spiel? bool LAnimation = true; // Ist die Landschaftanimation angeschaltet? bool Gitter; // Gitternetz an/aus RECT ScapeGrenze; // Diese Koordinaten zeigen die Größe der Landschaft an short CursorTyp; // Welcher Cursortyp? short RouteLaenge; // Länge short RoutePunkt; // Aktueller Index in RouteKoor -short Bild, LastBild; // Anzahl der Bilder in der Sekunde +short CurrentFrame, FPS; // Anzahl der Bilder in der Sekunde RECT rcRectdes, rcRectsrc; // Ständig benötigte Variable zum Blitten -short Tag, Stunden, Minuten; // Wieviel Uhr (0-12h) +short Tag, Hours, Minutes; // Wieviel Uhr (0-12h) char StdString[1024]; // Standard string char RohString[1024]; // Darin wird gespeichert, wieviel Rohstoffe noch benötigt werden short PapierText; // Wieviel Papier? (in Pixel) -1 = Kein Text short HauptMenue; // Welches Menü? short TwoClicks; // Für Aktionen mit zwei Mausklicks float Chance; // Wie groß ist die Chance am Tag gerettet zu werden -bool BootsFahrt; // Gerade mit dem Boot unterwegs? -bool Nacht; // Wird die Tageszusammenfassung angezeigt? -short Soundzustand; // -1 = keine Soundkarte;0=kein Sound;1=Sound an +bool IsInBoat; // Gerade mit dem Boot unterwegs? +bool Night; // Wird die Tageszusammenfassung angezeigt? +short s_SoundState; // -1 = keine Soundkarte;0=kein Sound;1=Sound an short Frage; // -1=KeineFrage;0=Frage wird gestellt;1=Ja;2=Nein -short AbspannNr = 0; // Zähler für Abspann -short AbspannZustand = 0; // Wo im Abspann +short CreditsNum = 0; // Zähler für Abspann +short CreditsState = 0; // Wo im Abspann bool SchatzGef = false; // wurde der Schatz gefunden // Pathfinding @@ -37,14 +39,14 @@ short Step, Steps; //Bereiche // links, oben, rechts, unten -RECT rcGesamt = {0, 0, MAXX, MAXY}; -RECT rcSpielflaeche = {0, 0, MAXX - 195, MAXY - 20}; -RECT rcPanel = {MAXX - 205, 0, MAXX, MAXY}; -RECT rcKarte = {MAXX - 158, 27, rcKarte.left + MAXXKACH * 2, rcKarte.top + (MAXYKACH + 13) * 2}; +RECT rcGesamt = {0, 0, MAX_SCREEN_X, MAX_SCREEN_Y}; +RECT rcPlayingSurface = {0, 0, MAX_SCREEN_X - 195, MAX_SCREEN_Y - 20}; +RECT rcPanel = {MAX_SCREEN_X - 205, 0, MAX_SCREEN_X, MAX_SCREEN_Y}; +RECT rcKarte = {MAX_SCREEN_X - 158, 27, rcKarte.left + MAX_TILES_X * 2, rcKarte.top + (MAX_TILESY + 13) * 2}; //Die Eckkoordinaten der Kacheln (Achtung: mit überlappendem Rand) -ZWEID EckKoor[13][4] = -{// 0 1 2 3 Ecke +Coordinate CornerCoord[13][4] = { + // 0 1 2 3 Ecke {{-1, 29}, {26, 15}, {54, 30}, {27, 44}},//0 {{-1, 13}, {26, 15}, {54, 30}, {27, 28}},//1 {{-1, 29}, {26, 15}, {54, 14}, {27, 28}},//2 @@ -61,51 +63,57 @@ ZWEID EckKoor[13][4] = }; -TEXTBEREICH TextBereich[TEXTANZ]; +TextArea TextBereich[TEXTANZ]; + -ZWEID Camera, // aktueller Kartenausschnitt - MousePosition, // " Mauskoordinaten - RouteZiel, RouteStart, // Koordinaten des Starts und des Endes der Route - Route[MAXXKACH * MAXYKACH], // Liste der Routenpunkte - RouteKoor[2 * MAXXKACH * MAXYKACH], // Liste der Routenkoordinaten - SchatzPos; // Hier ist der Schatz vergraben -RGBSTRUCT rgbStruct; // Hier werden die Farben eines Pixels zwischengespeichert +Coordinate Camera, // aktueller Kartenausschnitt + MousePosition, // " Mauskoordinaten + RouteDestination, RouteStart, // Koordinaten des Starts und des Endes der Route + Route[MAX_TILES_X * MAX_TILESY], // Liste der Routenpunkte + RouteKoor[2 * MAX_TILES_X * MAX_TILESY], // Liste der Routenkoordinaten + SchatzPos; // Hier ist der Schatz vergraben GUY Guy; -BMP Bmp[BILDANZ]; +BMP Bmp[SPRITE_COUNT]; WAV Wav[25]; // Sound::COUNT -ABSPANN AbspannListe[10][10]; // Namenabfolge im Abspann -SCAPE Scape[MAXXKACH][MAXYKACH]; +CREDITS CreditsList[10][10]; // Namenabfolge im Abspann +SCAPE Landscape[MAX_TILES_X][MAX_TILESY]; // DirectDraw -LPDIRECTDRAWSURFACE4 lpDDSPrimary = nullptr; // DirectDraw primary surface -LPDIRECTDRAWSURFACE4 lpDDSBack = nullptr; // DirectDraw back surface -LPDIRECTDRAWSURFACE4 lpDDSMisc = nullptr; // DirectDraw Bilder surface -LPDIRECTDRAWSURFACE4 lpDDSPanel = nullptr; // DirectDraw Panel surface -LPDIRECTDRAWSURFACE4 lpDDSGuyAni = nullptr; // DirectDraw GuyAni surface -LPDIRECTDRAWSURFACE4 lpDDSAnimation = nullptr; // DirectDraw Animation surface -LPDIRECTDRAWSURFACE4 lpDDSKarte = nullptr; // DirectDraw MiniMap surface -LPDIRECTDRAWSURFACE4 lpDDSSchrift = nullptr; // DirectDraw Schrift surface -LPDIRECTDRAWSURFACE4 lpDDSSchrift1 = nullptr; // DirectDraw Schrift1 surface -LPDIRECTDRAWSURFACE4 lpDDSSchrift2 = nullptr; // DirectDraw Schrift2 surface -LPDIRECTDRAWSURFACE4 lpDDSTextFeld = nullptr; // DirectDraw TextFeld surface -LPDIRECTDRAWSURFACE4 lpDDSPapier = nullptr; // DirectDraw Paier surface -LPDIRECTDRAWSURFACE4 lpDDSBaum = nullptr; // DirectDraw Bäume surface -LPDIRECTDRAWSURFACE4 lpDDSBau = nullptr; // DirectDraw Bauwerke surface -LPDIRECTDRAWSURFACE4 lpDDSCredits = nullptr; // DirectDraw Credits surface -LPDIRECTDRAWSURFACE4 lpDDSLogo = nullptr; // DirectDraw Logo surface -LPDIRECTDRAWSURFACE4 lpDDSCursor = nullptr; // DirectDraw Cursor surface -LPDIRECTDRAWSURFACE4 lpDDSButtons = nullptr; // DirectDraw Buttons surface -LPDIRECTDRAWSURFACE4 lpDDSInventar = nullptr; // DirectDraw Inventar surface -LPDIRECTDRAWSURFACE4 lpDDSScape = nullptr; // DirectDraw Landschaft surface -LPDIRECTDRAWSURFACE4 lpDDSSchatzkarte = nullptr; // SchatzkartenSurface -LPDIRECTDRAWPALETTE lpDDPal = nullptr; // DirectDraw palette -DDBLTFX ddbltfx; // DirectDraw Effekte -DDPIXELFORMAT ddpf; -DDSURFACEDESC2 ddsd, ddsd2; // Zwischenspeicher der SurfaceEigenschaften - -LPDIRECTDRAWGAMMACONTROL lpDDGammaControl = nullptr; // Die drei sind für das Gammaablenden -DDGAMMARAMP DDGammaRamp; -DDGAMMARAMP DDGammaOld; - -// Directinput -HINSTANCE g_hInst = nullptr; +sf::Texture *screenTexture = nullptr; // DirectDraw primary surface +sf::Texture *lpDDSBack = nullptr; // DirectDraw back surface +sf::Texture *lpDDSMisc = nullptr; // DirectDraw Bilder surface +sf::Texture *lpDDSPanel = nullptr; // DirectDraw Panel surface +sf::Texture *lpDDSGuyAni = nullptr; // DirectDraw GuyAni surface +sf::Texture *lpDDSAnimation = nullptr; // DirectDraw Animation surface +sf::Texture *lpDDSKarte = nullptr; // DirectDraw MiniMap surface +sf::Texture *lpDDSSchrift1 = nullptr; // DirectDraw Schrift1 surface +sf::Texture *lpDDSSchrift2 = nullptr; // DirectDraw Schrift2 surface +sf::Texture *lpDDSTextFeld = nullptr; // DirectDraw TextFeld surface +sf::Texture *lpDDSPaper = nullptr; // DirectDraw Paier surface +sf::Texture *lpDDSBaum = nullptr; // DirectDraw Bäume surface +sf::Texture *lpDDSBau = nullptr; // DirectDraw Bauwerke surface +sf::Texture *lpDDSCredits = nullptr; // DirectDraw Credits surface +sf::Texture *lpDDSLogo = nullptr; // DirectDraw Logo surface +sf::Texture *lpDDSCursor = nullptr; // DirectDraw Cursor surface +sf::Texture *lpDDSButtons = nullptr; // DirectDraw Buttons surface +sf::Texture *lpDDSInventar = nullptr; // DirectDraw Inventar surface + +sf::Texture *lpDDSSchatzkarte = nullptr; // SchatzkartenSurface +sf::Sprite *s_treasureMapSprite; + +sf::Color s_darknessColor; + +sf::Sprite *s_creditsSprite; +int s_previousCreditsOverlay; + +sf::Sprite *minimapPlayerSprite; +sf::Texture *minimapPlayerTexture; + +//LPDIRECTDRAWPALETTE lpDDPal = nullptr; // DirectDraw palette +//DDBLTFX ddbltfx; // DirectDraw Effekte +//DDPIXELFORMAT ddpf; +//DDSURFACEDESC2 ddsd, ddsd2; // Zwischenspeicher der SurfaceEigenschaften + +////LPDIRECTDRAWGAMMACONTROL lpDDGammaControl = nullptr; // Die drei sind für das Gammaablenden +//DDGAMMARAMP DDGammaRamp; +//DDGAMMARAMP DDGammaOld; diff --git a/src/headers.hpp b/src/headers.hpp index c892db1..5af0f45 100644 --- a/src/headers.hpp +++ b/src/headers.hpp @@ -1,19 +1,5 @@ #pragma once -#define ROUND(s) ((short) ((short)(s-0.5) == (short) s ? s+1:s)) //Zahlen runden Macro -#define INITGUID -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#define DIRECTINPUT_VERSION 0x0700 -#define DIRECTDRAW_VERSION 0x0500 - -#include -#include -#include -#include - -#include "ddutil.h" -#include "resource.h" +#include "strings.h" #include "constants.hpp" diff --git a/src/main.cpp b/src/main.cpp index a61b076..8a5cb14 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ #include "Application.hpp" -int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +int main(int argc, char *argv[]) { - Application app("Landscape", hInstance); + Application app("Schiffbruch"); app.run(); } diff --git a/src/strings b/src/strings new file mode 100644 index 0000000..10fdefd --- /dev/null +++ b/src/strings @@ -0,0 +1,143 @@ +Since this file is used 1-indexed, this line is not used. +Dies ist ein Test. /a Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. /z /z Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. +Turn grid on +Turn grid off +This feature has not been included yet, unfortunately. Please wait for a future version of Landscape. The full range of features will be available at that time. +Opens the Action Menu +Closes the Action Menu +Search the surroundings +Cut tree +It's that late? +Eat and drink +Opens the Inventory +Closes the Inventory +. +Branch +Stone +After searching forever in the blazing sun, I found a branch-- exactly what I've been looking for. The search was worth it. +After digging around laboriously in the area, I found a beautiful branch. I'm carrying around so many branches already that I end up throwing it away. +In the tropical heat I looked more closely at the surrounding area these past few minutes. These beautiful stones caught my attention. I could use these three quite well and take them along. +YESSS!! Another stone!! I have plenty of them already in my pockets and decide to throw the extra stones into the sea (Hopefully I didn't hit a rescue ship with them!). +After looking through the area very closely, I managed to find absolutely nothing. +Ax +There is neither anything to eat nor to drink here. +With great skill, I combined a stone with a branch and made an ax. With this, I'm now in a situation where I can prepare wood, for example: chop down trees. +I bet I could build something else from a branch and a stone. +Unfortunately, there's nothing else that I can build with a stone and a branch. +I can't build anything sensible from these two things. Maybe I could try a couple of other things? +Hmmmm, that's a big leaf! I could use that, I bet: I'd better take it along just to be safe. Who knows whether I'll ever come across something this unusual again?gYet another very rare leaf. They show up quite frequently. Therefore, I won't bother taking it along. +Leaf +I don't need any more tree trunks right now. +Opens the Build Menu +Closes the Build Menu +Plow field +This area is not suitable, unfortunately. +After tying an oblong stone to a branch, the whole thing looks like a harrow or a hoe. With this, I should be able to cultivate a field so that I don't have rely upon looking for these tedious bushes. +Hoe +Day /a is over. Unfortunately, I haven't been successful in building a comfortable place to sleep. Therefore, I have to sleep under the open sky tonight. These wild animals won't leave me alone and my health has dropped to /b %. My chance of being rescued is /c %. +Finally, a ship!! Thanks to my intense efforts, I've been found and the ship has now dropped anchor at the island. Should I leave this desolate island? /d +Build tent +I don't have enough raw materials to build this. +There isn't a tree here. +Continue process +Interrupt process +Day /a is over now. Fortunately, I reached my tent on time, and the bats will leave my alone, at least. Unfortuantely, the wild animals are biting at my feet and my health has fallen to /b %. The chance of being rescued is /c %. +Sleep 1 hour +Plain +Sea +Beach +Quicksand +Damp plain +Tree +Field +Tent +Bush +with +Liana +With a lot of effort, I've managed to tear off a liana from the tree. You can use lianas for many things. Therefore, I'll take it and carry it with me right now. +Lianas aren't that useful now and I don't need to carry any more of them. +Rod +This thin, flexible branch and this liana have been combined to make an excellent fishing rod. Finally, I don't have to live as a strict vegetarian and can try catching a few fat trout. +Fish +How can I fish here? +Dug-out +Build dug-out +Tree trunk +Go on/off board +Day /a is over now. It is pitch black. I'm lost and will surely die. Let that be a lesson to me. +River +Build irrigation +Irrigation pipe +Tear down structure +There isn't any structure here to tear down. +Write S.O.S. +S.O.S. +This tree is a bit too big. +Build ladder for treehouse +Tree and ladder +Hammer +Build platform for treehouse +Tree and platform +Tree and treehouse +Build treehouse +Day /a is over now. I'm quite glad that I built this beautiful treehouse. The wild animals are leaving me alone now. I'm sleeping very well and my health has risen to /b %. My chances of being saved are at /c %. +This tree is a bit too small. +Without a ladder, I can't build a platform. +I can only build a treehouse on a platform. +My chances of being saved today +Big tree +Bonfire +Pile up wood for bonfire +Smoke signal +Light bonfire +I can only light bonfires +Look for rescue ships +Telescope +Examine treasure map +Shovel +Matches +Dig for treasure +Hurrah!! I've found an old pirate treasure. With my hopes set on a gigantic treasure, I opened the old, musty chest and found.... only a box of matches. Well, I can't buy anything here, anyhow. +Although I dug around the entire area, I didn't find any treasure. Perhaps I should first take a look at a treasure map. +Shipwreck +I searched the entire wreck. After diving into the captain's cabin, I found this old telescope. With this, I can be on the lookout for passing ships and the chances of being saved have risen. /z On the way out, I also found a hammer and a few nails from the ship's carpenter. With these, I could build a more stable type of housing. +I'm in a mess now: stranded on a lonely island out in the middle of the Pacific. I'd better look for some fresh water and food as soon as possible. Maybe I could build a few tools as well. +I searched all over the ground, but I didn't find anything of interest. +Treasure map +After diving into the ancient pirate ship without finding a single thing, suddenly I found the skeleton of the captain. In his hand, he was holding a surprisingly well-preserved treasure map. After taking it, I found a shovel and took that as well. Now I can fill my idle time by searching for treasure! +Turn off water animation +Turn on water animation +I can't build anything else with a liana and a branch. +Slingshot +I can't think of anything else that I could build with a liana and a stone. +I made a knot and loop in the liana and now I can misuse it as a slingshot. Just put a stone in the loop and I'll be able to go off on a hunt. It seems as though there are only birds on this island in the daytime. I should restrict myself to shooting them while they're in the trees. +There are no birds here. +Hunt for birds +It's too dangerous to go to sleep in this small boat. +The waves are too high to see anything. +5 +I can only dig for treasure on an open and flat area. +I can only lay out fields on flat, damp, and open meadows. +I can build tents only on flat and open areas. +I can build boats only on an open beach. +I can build pipes only on flat and open areas. +I can only write SOS on a flat and open area. +I can only build bonfires on flat and open landscapes. +I've built my first boat, a dug-out. (To go on board or off board, click on the 'Anchor' button.) I can only go off board when nothing else is in the way on the beach. I should also keep my eye on the time, because I could never survive a night on the high seas. +My first field is ready. The grain will grow on its own and when it turns yellow, I will be able to eat it. +I've built this huge pile of wood for a bonfire, but how can I light it? The fire would burn for quite a while and would increase my chances of being rescued. The higher that the bonfire is located, the better. +My treehouse is finally finished. I can go to sleep here at any time and recover my health. If I want to spend the night here, I should be in this immediate area by 1800 hours (6 p.m.), before it gets dark. +Now I own an irrigation system. They will fill up with water if I have built it near the river. The plains can be irrigated with water so that I can lay out a field here. These will disappear, of course, if I tear down the pipe. +Passing planes should be able to notice me now and could send for help. The SOS is especially easy to read on the beach. +Finally, I have a roof over my head. I can go to sleep here at any time. If I want to use this at night, I have to be in the immediate area when it gets dark (1800 hours or 6 p.m.) +Do you really want to exit the game? /z (The game will be saved automatically) /d +End the game +Do you want to start a new game? /d +Start new game +Would you like to begin the day over again? /d +Suddenly, I'm feeling very strange. I think that I'm dying... +Day /a is over now. I don't feel too well and probably won't survive through the night. +Begin a new day +Turn on sound +Turn off sound +Sorry. No sound diff --git a/src/resource.h b/src/strings.h similarity index 67% rename from src/resource.h rename to src/strings.h index 23847fd..0e780b7 100644 --- a/src/resource.h +++ b/src/strings.h @@ -1,14 +1,10 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Landscape.rc -// #define TESTTEXT1 1 #define GITTERAN 2 #define GITTERAUS 3 #define KEINEFUNKTION 4 #define MEAKTIONAUF 5 #define MEAKTIONZU 6 -#define BEGINNSUCHEN 7 +#define STRING_BEGIN_SEARCH 7 #define BEGINNFAELLEN 8 #define SOSPAET 9 #define BEGINNESSEN 10 @@ -22,14 +18,14 @@ #define ROHSTEINGEFUNDEN 18 #define ROHSTEINZUVIEL 19 #define NICHTSGEFUNDEN 20 -#define AXT 21 -#define KEINESSENTRINKEN 22 -#define BAUEAXT 23 -#define STEINPLUSASTNICHTS 24 -#define NICHTBASTELN 25 -#define ROHBLATTGEFUNDEN 26 -#define ROHBLATTZUVIEL 27 -#define BLATT 28 +#define STRING_AXE 21 +#define STRING_NOTHING_EAT_DRINK 22 +#define STRING_BUILD_AXE 23 +#define STRING_STONE_BRANCH_NOTHING_ELSE 24 +#define STRING_CANT_BUILD 25 +#define STRING_LEAF_FOUND 26 +#define STRING_ALREADY_HAVE_LEAF 27 +#define STRING_LEAF 28 #define ROHSTAMMZUVIEL 29 #define MEBAUENAUF 30 #define MEBAUENZU 31 @@ -45,24 +41,24 @@ #define WEITER 41 #define STOP 42 #define TAGENDE2 43 -#define BEGINNSCHLAFEN 44 +#define STRING_BEGIN_SLEEP 44 #define WIESETEXT 45 -#define MEERTEXT 46 -#define STRANDTEXT 47 -#define TREIBSANDTEXT 48 -#define FEUCHTEWIESETEXT 49 -#define BAUMTEXT 50 -#define FELDTEXT 51 -#define ZELTTEXT 52 -#define BUSCHTEXT 53 -#define MIT 54 -#define LIANE 55 -#define ROHLIANEGEFUNDEN 56 -#define ROHLIANEZUVIEL 57 +#define STRING_SEA 46 +#define STRING_BEACH 47 +#define STRING_QUICKSAND 48 +#define STRING_DAMP_PLAIN 49 +#define STRING_TREE 50 +#define STRING_FIELD 51 +#define STRING_TENT 52 +#define STRING_BUSH 53 +#define STRING_WITH 54 +#define STRING_LIANA 55 +#define STRING_LIANA_FOUND 56 +#define STRING_LIANA_FULL 57 #define ANGEL 58 #define BAUEANGEL 59 -#define BEGINNANGELN 60 -#define KEINWASSER 61 +#define STRING_BEGIN_FISHING 60 +#define STRING_NO_FISHINGWATER 61 #define BOOTTEXT 62 #define BEGINNBOOT 63 #define STAMM 64 @@ -71,47 +67,47 @@ #define FLUSSTEXT 67 #define BEGINNROHR 68 #define ROHRTEXT 69 -#define BEGINNDESTROY 70 -#define KEINBAUWERK 71 -#define BEGINNSOS 72 +#define STRING_BEGIN_DESTROY 70 +#define STRING_NOTHING_TO_DESTROY 71 +#define STRINGBEGIN_WRITE_SOS 72 #define SOSTEXT 73 #define BAUMZUGROSS 74 #define BEGINNHAUS1 75 #define HAUS1TEXT 76 #define HAMMERTEXT 77 #define BEGINNHAUS2 78 -#define HAUS2TEXT 79 +#define STRING_TREE_AND_PLATFORM 79 #define HAUS3TEXT 80 -#define BEGINNHAUS3 81 +#define STRING_BUILD_TREEHOUSE 81 #define TAGENDE4 82 #define BAUMZUKLEIN 83 #define NICHTOHNELEITER 84 #define NICHTOHNEPLATTFORM 85 #define CHANCETEXT 86 -#define BAUMGROSSTEXT 87 -#define FEUERSTELLETEXT 88 -#define BEGINNFEUERSTELLE 89 -#define FEUERTEXT 90 -#define BEGINNANZUENDEN 91 -#define KEINEFEUERST 92 -#define BEGINNAUSSCHAU 93 -#define FERNROHR 94 -#define BEGINNSCHATZKARTE 95 -#define SCHAUFEL 96 -#define STREICHHOLZ 97 -#define BEGINNSCHATZ 98 +#define STRING_BIG_TREE 87 +#define STRING_BONFIRE 88 +#define STRING_BEGIN_BONFIRE 89 +#define STRING_SMOKE_SIGNAL 90 +#define STRING_LIGHT_BONFIRE 91 +#define STRING_ONLY_LIGHT_BONFIRE 92 +#define STRING_BEGIN_LOOK_OUT 93 +#define STRING_TELESCOPE 94 +#define STRING_BEGIN_TREASUREMAP 95 +#define STRING_SHOVEL 96 +#define STRING_MATCHES 97 +#define STRING_BEGIN_TREASUREDIG 98 #define SCHATZGEFUNDEN 99 #define KEINSCHATZ 100 #define WRACKTEXT 101 -#define FERNROHRGEFUNDEN 102 +#define STRING_TELESCOPE_FOUND 102 #define INTROTEXT 103 #define NICHTSGEFUNDEN2 104 -#define KARTE 105 +#define STRING_MAP 105 #define KARTEGEFUNDEN 106 #define ANIMATIONAUS 107 #define ANIMATIONAN 108 #define ASTPLUSLIANENICHTS 109 -#define SCHLEUDER 110 +#define STRING_SLINGSHOT 110 #define STEINPLUSLIANENICHTS 111 #define BAUESCHLEUDER 112 #define KEINVOGEL 113 diff --git a/src/strings_de.cpp b/src/strings_de.cpp new file mode 100644 index 0000000..98644c4 --- /dev/null +++ b/src/strings_de.cpp @@ -0,0 +1,147 @@ +const char *GetLanguageString(const unsigned index) { static const char *strings[] = { "Since this file is used 1-indexed, this line is not used.", "Dies ist ein Test. /a Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. /z /z Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test.", + "Gitternetz anschalten", + "Gitternetz ausschalten", + "Diese Funktion ist leider noch nicht integriert. Warten Sie bitte eine spaetere Version von Schiffbruch ab. Dann wird Ihnen der gesamte Funktionsumfang zur Verfuegung stehen.", + "Oeffnet das Aktionsmenue", + "Schliesst das Aktionsmenue", + "Durchsuche die Umgebung", + "Baum faellen", + "Schon so spaet?", + "Essen und trinken", + "Oeffnet das Inventar", + "Schliesst das Inventar", + ".", + "Ast", + "Stein", + "Nach ewigem Suchen in der prallen Sonne habe ich einen Ast gefunden. Genau das, was mir noch gefehlt hat. Die Suche hat sich gelohnt.", + "Nachdem ich mich muehsam durch die Gegend gewuehlt habe, finde ich einen wunderschoenen Ast. Allerdings schleppe ich schon so viele Aeste mit mir herum, dass ich ihn wieder wegwerfe.", + "In der tropischen Hitze habe ich mir in den letzen Minuten die naehere Umgebung genauer angeschaut. Besonders aufgefallen sind mir diese wunderschoenen Steine. Diese drei kann ich gut gebrauchen und packe sie ein.", + "Jaa, ich habe etwas gefunden!! Einen Stein!! Mir reichen allerdings die, die ich schon in der Tasche habe, und werfe ihn deshalb bis ins Meer (Hoffentlich habe ich nicht das mich rettende Schiff getroffen!).", + "Selbst nachdem ich die Gegend sehr genau unter die Lupe genommen habe, habe ich absolut nichts gefunden. ", + "Axt", + "Hier gibt es weder etwas zu essen noch zu trinken.", + "Mit viel Geschick habe ich einen Stein mit einem Ast verbunden und eine Axt erhalten. Damit bin ich nun in der Lage, Holz zu bearbeiten, zum Beispiel Baeume faellen. /z Ich glaube, ich koennte mir noch etwas aus einem Ast und einem Stein bauen.", + "Leider gibt es nichts mehr, was ich mit einem Stein und einem Stock bauen kann.", + "Aus diesen beiden Sachen kann ich mir nichts Sinnvolles bauen. Vielleicht sollte ich zwei andere Dinge probieren?", + "Mmh, das ist aber ein grosses Blatt. Das kann ich sicher noch gebrauchen, ich werde es vorsichtshalber mitnehmen. Wer weiss, ob ich noch einmal so etwas Besonderes finde.", + "Schon wieder so ein seltenes Blatt. Sie scheinen doch relativ haeufig zu sein, deshalb werde ich es nicht mitnehmen.", + "Blatt", + "Noch mehr Baumstaemme brauche ich im Moment nicht. ", + "Oeffnet das Baumenue", + "Schliesst das Baumenue", + "Feld anlegen", + "Diese Gegend ist leider nicht geeignet.", + "Nachdem ich einen laenglichen Stein an einen Ast gebunden habe, sieht das ganze wie eine Egge aus. Damit sollte es mir moeglich sein, ein Feld anzulegen, so dass ich nicht mehr nur auf diese laestigen Buesche angewiesen bin.", + "Egge", + "Tag /a ist nun zu Ende. Leider habe ich es nicht mehr bis zu einer angenehmen Schlafstelle geschafft, deshalb muss ich heute nacht unter freien Himmel schlafen. Die wilden Tiere lassen mir keine Ruhe, deshalb sinkt meine Gesundheit auf /b %. Meine Chance gerettet zu werden betraegt /c %.", + "Endlich ein Schiff!! Dank meiner intensiven Bemuehungen wurde ich entdeckt und nun ankert das Schiff vor der Insel. Soll ich diese trostlose Insel verlassen? /d ", + "Zelt bauen", + "Ich habe leider nicht genug Rohstoffe, um den Bau fortzusetzen.", + "Hier steht leider kein Baum.", + "Vorgang fortsetzen", + "Vorgang unterbrechen", + "Tag /a ist nun zu Ende. Zum Glueck bin ich rechtzeitig zu meinem Zelt gekommen, so lassen mich wenigstens die Fledermaeuse in Ruhe. Allerdings beissen mich wilde Tiere in meine Fuesse, deshalb sinkt meine Gesundheit auf /b %. Meine Chance gerettet zu werden betraegt /c %.", + "1 Stunde schlafen", + "Wiese", + "Meer", + "Strand", + "Treibsand", + "feuchte Wiese", + "Baum", + "Feld", + "Zelt", + "Busch", + "mit", + "Liane ", + "Mit sehr viel Muehe habe ich es geschafft, eine Liane vom Baum abzureissen. Mit Lianen kann man sehr viel anstellen, deshalb werde ich sie die naechste Zeit mit mir herumschleppen.", + "So nuetzlich sind Lianen dann doch wieder nicht, dass ich so viele davon mit mir herumtragen muss.", + "Angel", + "Dieser duenne, biegsame Ast und diese Liane lassen sich vorzueglich zu einer Angel verbinden. Endlich muss ich nicht mehr vegetarisch leben und kann mir ein paar fette Forellen fischen.", + "Angeln", + "Wo soll ich denn hier angeln?", + "Einbaum", + "Einbaum bauen", + "Baumstamm", + "An- und Ablegen", + "Tag /a ist nun zu Ende. Es ist stockdunkel, ich treibe ab und werde wohl sterben. Das wird mir eine Lehre sein. ", + "Fluss", + "Bewaesserungsanlage bauen", + "Bewaesserungsrohr", + "Bauwerk abreissen", + "Hier ist leider kein Bauwerk, das ich abreissen kann.", + "S.O.S. schreiben", + "S.O.S.", + "Der ist mir eine Nummer zu gross.", + "Leiter fuer Baumhaus bauen", + "Baum und Leiter", + "Hammer", + "Plattform fuer Baumhaus bauen", + "Baum und Plattform", + "Baum und Baumhaus", + "Baumhaus bauen", + "Tag /a ist nun zu Ende. Bin ich froh, dass ich mir dieses schoene Baumhaus gebaut habe. So lassen mich die wilden Tiere in Frieden. Ich schlafe ausgezeichnet und meine Gesundheit steigt auf /b %. Meine Chance gerettet zu werden betraegt /c %.", + "Dieser Baum ist eine Nummer zu klein.", + "Ohne Leiter kann ich keine Plattform bauen.", + "Das Baumhaus kann ich nur auf einer Plattform bauen.", + "Meine Chance heute gerettet zu werden", + "grossem Baum", + "Feuerstelle", + "Holz fuer Feuerstelle aufstapeln", + "Signalfeuer", + "Feuerstelle anzuenden", + "Ich kann nur Feuerstellen anzuenden", + "Nach Rettung Ausschau halten", + "Fernrohr", + "Schatzkarte anschauen", + "Schaufel", + "Streichhoelzer", + "Nach Schatz graben", + "Hurra!! Ich habe einen alten Piratenschatz gefunden. Mit Hoffnung auf einen grossartigen Schatz oeffnete ich die alte modrige Kiste und entdeckte ... nur eine Streichholzschachtel. Was solls, ich kann mir hier eh nichts kaufen.", + "Obwohl ich die ganze Gegend hier umgegraben habe, habe ich keinen Schatz gefunden. Vielleicht sollte ich mir erst eine Schatzkarte anschauen.", + "Schiffswrack", + "Ich habe das gesamte Wrack abgesucht.Als ich in die Kapitaenskajute getaucht bin, habe ich mein altes Fernrohr gefunden. Damit kann ich nach Schiffen Ausschau halten und meine Chance, gerettet zu werden, steigt. /z Auf dem Weg nach draussen entdeckte ich noch den Hammer und einige Naegel vom Schiffszimmermann. Damit kann ich mir eine stabilere Behausung bauen.", + "Jetzt habe ich den Schlamassel: Gestrandet auf einer einsamen Insel mitten im Pazifik. Ich sollte mich schnellstens nach Suesswasser und Nahrung umsehen. Vielleicht kann ich mir auch ein paar Werkzeuge bauen.", + "Ich habe den ganzen Grund abgesucht, aber nichts von Interesse gefunden.", + "Schatzkarte", + "Ich tauchte durch das uralte Piratenschiff, allerdings ohne etwas zu finden, bis ich ploetzlich das Skelett des Kapitains fand. In der Hand hielt er noch eine erstaunlich gut erhaltene Schatzkarte. Nachdem ich sie an mich genommen hatte, nahm ich mir noch eine Schaufel mit. Jetzt kann ich mir die Zeit mit einer Schatzsuche vertreiben. ", + "Wasseranimationen ausschalten", + "Wasseranimationen anschalten", + "Mehr kann ich mir auch mit einer Liane und einem Ast nicht bauen.", + "Steinschleuder", + "Mir faellt nichts mehr ein, was ich mir aus einer Liane und einem Stein bauen k�nnte.", + "Ich knotete eine Schlaufe in die Liane und jetzt kann man sie als Steinschleuder missbrauchen. Einfach noch den Stein in die Schlaufe gelegt und ich kann auf Jagd gehen. Da es am Tag auf dieser Insel nur Voegel zu geben scheint, sollte ich mich darauf beschraenken, diese Tiere von den Baeumen zu schiessen.", + "Hier sind keine Voegel.", + "Auf Vogeljagd gehen", + "In diesem kleinen Boot ist es zum Schlafen zu gefaehrlich.", + "Die Wellen sind zu hoch, um etwas zu sehen.", + "Ich kann nur auf flachen und freien Gegenden nach einem Schatz graben.", + "Felder kann ich nur auf flachen, feuchten und freien Wiesen anlegen.", + "Zelte kann ich nur auf einer flachen und freien Gegend bauen.", + "Boote kann ich nur auf einem freien Strandabschnitt bauen.", + "Rohre kann ich nur auf flachen und freien Gegenden bauen.", + "SOS kann ich nur auf flachen und freien Gegenden schreiben.", + "Feuerstellen kann ich nur in flachen und freien Landschaften anlegen.", + "Ich habe nun mein erstes Boot gebaut. (Zum An- und Ablegen auf den 'Anker-Knopf' klicken.) Anlegen kann ich nur, wenn auf dem Strand nichts im Weg ist. Auch sollte ich immer die Zeit im Auge haben, da ich eine Nacht auf hoher See nicht ueberleben wuerde.", + "Mein erstes Feld ist fertig. Das Getreide wird von ganz allein wachsen und, wenn es schoen gelb ist, kann ich es essen. ", + "Jetzt habe ich einen grossen Haufen Holz aufgebaut. Womit kann ihn anzuenden? Das Feuer wuerde eine Weile brennen und meine Chance erhoehen, gerettet zu werden. Je hoeher die Feuerstelle liegt, desto besser.", + "Meine Baumhaus ist endlich fertig. Dort kann ich jederzeit ein Schlaefchen machen und mich erholen. Wenn ich dort uebernachten will, sollte ich puenktlich um 18.00 Uhr, wenn es dunkel wird, in unmittelbarer Naehe sein.", + "Jetzt besitze ich eine eigene Bewaesserungsanlage. Sie wird sich mit Wasser fuellen, wenn ich sie in der Naehe eines Flusses gebaut habe. Damit werden die anliegenden Wiesen befeuchtet, so dass ich auch dort Felder anlegen kann. Diese gehen natuerlich auch wieder ein, wenn ich das Rohr abreisse.", + "So, jetzt muessten mich vorbeifliegende Flugzeuge bemerken und Hilfe schicken. Auf dem Strand ist das SOS besonders gut zu lesen.", + "Endlich habe ich ein Dach ueber dem Kopf. Dort kann ich jederzeit ein Nickerchen machen. Wenn ich es auch in der Nacht benutzen will, muss ich mich, wenn es dunkel wird (18.00 Uhr), in der Naehe befinden.", + "Willst du das Spiel wirklich verlassen? /z (Der Spielstand wird automatisch gespeichert) /d ", + "Spiel beenden", + "Willst du das Spiel neu starten? /d ", + "Spiel neu starten", + "Willst du den Tag noch einmal neu beginnen? /d ", + "Ich fuehle mich ploetzlich ganz seltsam. Ich spuere, dass ich sterbe...", + "Tag /a ist nun zu Ende. Ich fuehle mich nicht besonders gut und werde die Nacht wohl nicht ueberleben. ", + "Tag neu starten", + "Sound anstellen", + "Sound austellen", + "Leider kein Sound" + }; + if (index >= sizeof strings) { + return "????"; + } + return strings[index]; +} diff --git a/src/strings_en.cpp b/src/strings_en.cpp new file mode 100644 index 0000000..f9855f1 --- /dev/null +++ b/src/strings_en.cpp @@ -0,0 +1,147 @@ +const char *GetLanguageString(const unsigned index) { static const char *strings[] = { "Since this file is used 1-indexed, this line is not used.", "Dies ist ein Test. /a Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. /z /z Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test. Dies ist ein Test.", + "Turn grid on", + "Turn grid off", + "This feature has not been included yet, unfortunately. Please wait for a future version of Landscape. The full range of features will be available at that time.", + "Opens the Action Menu", + "Closes the Action Menu", + "Search the surroundings", + "Cut tree", + "It's that late?", + "Eat and drink", + "Opens the Inventory", + "Closes the Inventory", + ".", + "Branch", + "Stone", + "After searching forever in the blazing sun, I found a branch-- exactly what I've been looking for. The search was worth it.", + "After digging around laboriously in the area, I found a beautiful branch. I'm carrying around so many branches already that I end up throwing it away.", + "In the tropical heat I looked more closely at the surrounding area these past few minutes. These beautiful stones caught my attention. I could use these three quite well and take them along.", + "YESSS!! Another stone!! I have plenty of them already in my pockets and decide to throw the extra stones into the sea (Hopefully I didn't hit a rescue ship with them!).", + "After looking through the area very closely, I managed to find absolutely nothing. ", + "Ax", + "There is neither anything to eat nor to drink here.", + "With great skill, I combined a stone with a branch and made an ax. With this, I'm now in a situation where I can prepare wood, for example: chop down trees.", + "I bet I could build something else from a branch and a stone. Unfortunately, there's nothing else that I can build with a stone and a branch.", + "I can't build anything sensible from these two things. Maybe I could try a couple of other things?", + "Hmmmm, that's a big leaf! I could use that, I bet: I'd better take it along just to be safe. Who knows whether I'll ever come across something this unusual again?", + "Yet another very rare leaf. They show up quite frequently. Therefore, I won't bother taking it along.", + "Leaf", + "I don't need any more tree trunks right now. ", + "Opens the Build Menu", + "Closes the Build Menu", + "Plow field", + "This area is not suitable, unfortunately.", + "After tying an oblong stone to a branch, the whole thing looks like a harrow or a hoe. With this, I should be able to cultivate a field so that I don't have rely upon looking for these tedious bushes.", + "Hoe", + "Day /a is over. Unfortunately, I haven't been successful in building a comfortable place to sleep. Therefore, I have to sleep under the open sky tonight. These wild animals won't leave me alone and my health has dropped to /b %. My chance of being rescued is /c %.", + "Finally, a ship!! Thanks to my intense efforts, I've been found and the ship has now dropped anchor at the island. Should I leave this desolate island? /d ", + "Build tent", + "I don't have enough raw materials to build this.", + "There isn't a tree here.", + "Continue process", + "Interrupt process", + "Day /a is over now. Fortunately, I reached my tent on time, and the bats will leave my alone, at least. Unfortuantely, the wild animals are biting at my feet and my health has fallen to /b %. The chance of being rescued is /c %.", + "Sleep 1 hour", + "Plain", + "Sea", + "Beach", + "Quicksand", + "Damp plain", + "Tree", + "Field", + "Tent", + "Bush", + "with", + "Liana ", + "With a lot of effort, I've managed to tear off a liana from the tree. You can use lianas for many things. Therefore, I'll take it and carry it with me right now.", + "Lianas aren't that useful now and I don't need to carry any more of them.", + "Rod", + "This thin, flexible branch and this liana have been combined to make an excellent fishing rod. Finally, I don't have to live as a strict vegetarian and can try catching a few fat trout.", + "Fish", + "How can I fish here?", + "Dug-out", + "Build dug-out", + "Tree trunk", + "Go on/off board", + "Day /a is over now. It is pitch black. I'm lost and will surely die. Let that be a lesson to me. ", + "River", + "Build irrigation", + "Irrigation pipe", + "Tear down structure", + "There isn't any structure here to tear down.", + "Write S.O.S.", + "S.O.S.", + "This tree is a bit too big.", + "Build ladder for treehouse", + "Tree and ladder", + "Hammer", + "Build platform for treehouse", + "Tree and platform", + "Tree and treehouse", + "Build treehouse", + "Day /a is over now. I'm quite glad that I built this beautiful treehouse. The wild animals are leaving me alone now. I'm sleeping very well and my health has risen to /b %. My chances of being saved are at /c %.", + "This tree is a bit too small.", + "Without a ladder, I can't build a platform.", + "I can only build a treehouse on a platform.", + "My chances of being saved today", + "Big tree", + "Bonfire", + "Pile up wood for bonfire", + "Smoke signal", + "Light bonfire", + "I can only light bonfires", + "Look for rescue ships", + "Telescope", + "Examine treasure map", + "Shovel", + "Matches", + "Dig for treasure", + "Hurrah!! I've found an old pirate treasure. With my hopes set on a gigantic treasure, I opened the old, musty chest and found.... only a box of matches. Well, I can't buy anything here, anyhow.", + "Although I dug around the entire area, I didn't find any treasure. Perhaps I should first take a look at a treasure map.", + "Shipwreck", + "I searched the entire wreck. After diving into the captain's cabin, I found this old telescope. With this, I can be on the lookout for passing ships and the chances of being saved have risen. /z On the way out, I also found a hammer and a few nails from the ship's carpenter. With these, I could build a more stable type of housing.", + "I'm in a mess now: stranded on a lonely island out in the middle of the Pacific. I'd better look for some fresh water and food as soon as possible. Maybe I could build a few tools as well.", + "I searched all over the ground, but I didn't find anything of interest.", + "Treasure map", + "After diving into the ancient pirate ship without finding a single thing, suddenly I found the skeleton of the captain. In his hand, he was holding a surprisingly well-preserved treasure map. After taking it, I found a shovel and took that as well. Now I can fill my idle time by searching for treasure!", + "Turn off water animation", + "Turn on water animation", + "I can't build anything else with a liana and a branch.", + "Slingshot", + "I can't think of anything else that I could build with a liana and a stone.", + "I made a knot and loop in the liana and now I can misuse it as a slingshot. Just put a stone in the loop and I'll be able to go off on a hunt. It seems as though there are only birds on this island in the daytime. I should restrict myself to shooting them while they're in the trees.", + "There are no birds here.", + "Hunt for birds", + "It's too dangerous to go to sleep in this small boat.", + "The waves are too high to see anything.", + "I can only dig for treasure on an open and flat area.", + "I can only lay out fields on flat, damp, and open meadows.", + "I can build tents only on flat and open areas.", + "I can build boats only on an open beach.", + "I can build pipes only on flat and open areas.", + "I can only write SOS on a flat and open area.", + "I can only build bonfires on flat and open landscapes. ", + "I've built my first boat, a dug-out. (To go on board or off board, click on the 'Anchor' button.) I can only go off board when nothing else is in the way on the beach. I should also keep my eye on the time, because I could never survive a night on the high seas.", + "My first field is ready. The grain will grow on its own and when it turns yellow, I will be able to eat it. ", + "I've built this huge pile of wood for a bonfire, but how can I light it? The fire would burn for quite a while and would increase my chances of being rescued. The higher that the bonfire is located, the better.", + "My treehouse is finally finished. I can go to sleep here at any time and recover my health. If I want to spend the night here, I should be in this immediate area by 1800 hours (6 p.m.), before it gets dark.", + "Now I own an irrigation system. They will fill up with water if I have built it near the river. The plains can be irrigated with water so that I can lay out a field here. These will disappear, of course, if I tear down the pipe.", + "Passing planes should be able to notice me now and could send for help. The SOS is especially easy to read on the beach.", + "Finally, I have a roof over my head. I can go to sleep here at any time. If I want to use this at night, I have to be in the immediate area when it gets dark (1800 hours or 6 p.m.)", + "Do you really want to exit the game? /z (The game will be saved automatically) /d ", + "End the game", + "Do you want to start a new game? /d ", + "Start new game", + "Would you like to begin the day over again? /d ", + "Suddenly, I'm feeling very strange. I think that I'm dying...", + "Day /a is over now. I don't feel too well and probably won't survive through the night. ", + "Begin a new day", + "Turn on sound", + "Turn off sound", + "Sorry. No sound" + }; + if (index >= sizeof strings) { + return "????"; + } + return strings[index]; +} diff --git a/src/types.hpp b/src/types.hpp index 2b76081..2034966 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -1,89 +1,94 @@ #pragma once #include "headers.hpp" +//#include "miniwin.h" -struct TEXTBEREICH -{ - bool Aktiv; // Steht Text in diesem Bereich? - RECT rcText; // Die Position des Ausgabe +#include + +namespace Action { +enum Type : short; +} +struct RECT { + int left; + int top; + int right; + int bottom; +}; +struct TextArea { + bool HasText; // Steht Text in diesem Bereich? + RECT textRect; // Die Position des Ausgabe }; -struct ZWEID -{ +struct Coordinate { short x; short y; }; -struct RGBSTRUCT -{ - BYTE r, g, b; +struct RGBSTRUCT { + uint8_t r, g, b; }; -struct GUY -{ - bool Aktiv; // Ist er aktiv? - short Aktion; // Welche Aktion (Suchen, fischen ...) (Übergeordnet über Zustand) - ZWEID Pos; // KachelPosition der Spielfigur - ZWEID PosAlt; // Die ursprünglich Position in der Kachel (für die Aktionsprozeduren) - ZWEID PosScreen; // Absolute Position der Spielfigur - short Zustand; // Was macht er gerade? (Animation)(linkslaufen,rechtslaufen...,angeln..) - short AkNummer; // Bei welcher Aktion (für die Aktionsprozeduren) - float Resource[3]; // Wieviel Wasservorrat usw - short Inventar[BILDANZ]; // Welche Rohstoffe usw. besitzt man +struct GUY { + bool IsActive; // Ist er aktiv? + Action::Type CurrentAction; // Welche Aktion (Suchen, fischen ...) (Übergeordnet über Zustand) + Coordinate Pos; // KachelPosition der Spielfigur + Coordinate OriginalPosition; // Die ursprünglich Position in der Kachel (für die Aktionsprozeduren) + Coordinate ScreenPosition; // Absolute Position der Spielfigur + short AnimationState = Tiles::INVALID; // Was macht er gerade? (Animation)(linkslaufen,rechtslaufen...,angeln..) + short ActionStep; // Bei welcher Aktion (für die Aktionsprozeduren) + float ResourceAmount[3]; // Wieviel Wasservorrat usw + short Inventory[SPRITE_COUNT]; // Welche Rohstoffe usw. besitzt man }; -struct BMP -{ - LPDIRECTDRAWSURFACE4 Surface; // in welcher Surface gespeichert? - bool Animation; // Läuft die Animations? - short Anzahl; // Anzahl der Animationsphasen - short Phase; // die aktuelle Phase - RECT rcSrc; // Quelle des 1. Bildes - RECT rcDes; // Falls es immer an die gleiche Stelle gezeichnet wird. (Buttons) - short Breite; // Die Breite des Bildes - short Hoehe; // Die Hoehe des Bildes - short Geschwindigkeit; // Wieviel Bilder/sec +struct BMP { + sf::Texture *Surface; // in welcher Surface gespeichert? + bool IsAnimationRunning; // Läuft die Animations? + short AnimationPhaseCount; // Anzahl der Animationsphasen + short AnimationPhase; // die aktuelle Phase + RECT sourceRect; // Quelle des 1. Bildes + RECT targetRect; // Falls es immer an die gleiche Stelle gezeichnet wird. (Buttons) + short Width; // Die Breite des Bildes + short Height; // Die Hoehe des Bildes + short Speed; // Wieviel Bilder/sec short Sound; // Welcher Sound gehört dazu //zum bauen - short Rohstoff[BILDANZ]; // Anzahl des i.Rohstoffs, den man zum Bau benötigt - short AkAnzahl; // Anzahl der Aktionsfaellen, die zum Bau benötigt werden + short RequiredRawMaterials[SPRITE_COUNT]; // Anzahl des i.Rohstoffs, den man zum Bau benötigt + short RequiredActionCases; // Anzahl der Aktionsfaellen, die zum Bau benötigt werden bool First; // Ist es das erstemal gebaut, dann Hilfetext }; -struct WAV -{ - char* Dateiname; // Dateiname der Wavdatei +struct WAV { + const char *Filename; // Dateiname der Wavdatei bool Loop; // Nur einmal abspielen und ständig short Volume; // Die Standardlautstärke in Prozent }; -struct ABSPANN -{ - bool Aktiv; // Bewegt sich gerade - short Bild; // welches Bild +struct CREDITS { + bool IsRunning; // Bewegt sich gerade + short Picture; // welches Bild }; -struct SCAPE -{ - short Typ; // Flach, Hang usw. - short Art; // Sand, Moor ... - short Hoehe; // Die Hoehe der Kachel - bool Markiert; // Ist diese Kachel markiert? +struct SCAPE { + short Type; // Flach, Hang usw. + short Terrain; // Sand, Moor ... + short Height; // Die Hoehe der Kachel + bool Marked; // Ist diese Kachel markiert? short xScreen, yScreen; // Die Koordinaten in der Scape-Surface - bool Begehbar; // notwendig für Pathfinding - bool Entdeckt; // Ist dieses Feld schon aufgedeckt? - short LaufZeit; // LaufZeit auf dieser Kachel (1 am schnellsten...) - short Objekt; // Welches Objekt steht drauf (z.Bsp. Flüsse) - bool Reverse; // Wird die Objektanimation umgekehrt abgespielt (für flüsse) - ZWEID ObPos; // Die Koordinaten des Objekts (relativ zu xScreen und yScreen) - float Phase; // Welche Animationsphase oder Bildversion - short AkNummer; // Welche Aktionsnummer (um Baustellen vortzusetzen) - ZWEID GPosAlt; // Damit der Guy an der richtigen Stelle (x,y) weiterbaut - short Rohstoff[BILDANZ]; //Anzahl des i.Rohstoffs, den man noch zum bauen braucht - float Timer; //Bis jetzt nur fürs Feuer nötig + bool Walkable; // notwendig für Pathfinding + bool Discovered; // Ist dieses Feld schon aufgedeckt? + short RunningTime; // LaufZeit auf dieser Kachel (1 am schnellsten...) + short Object = Tiles::INVALID; // Welches Objekt steht drauf (z.Bsp. Flüsse) + bool ReverseAnimation; // Wird die Objektanimation umgekehrt abgespielt (für flüsse) + Coordinate ObjectPosOffset; // Die Koordinaten des Objekts (relativ zu xScreen und yScreen) + float AnimationPhase; // Welche Animationsphase oder Bildversion + short ConstructionActionStep; // Welche Aktionsnummer (um Baustellen vortzusetzen) + Coordinate GPosAlt; // Damit der Guy an der richtigen Stelle (x,y) weiterbaut + short RequiredRawMaterials[SPRITE_COUNT]; //Anzahl des i.Rohstoffs, den man noch zum bauen braucht + float FireTimer; //Bis jetzt nur fürs Feuer nötig }; -struct FLUSSLAUF -{ +struct RiverRun { short x, y; }; + +using byte = uint8_t; diff --git a/tools/resgen/CMakeLists.txt b/tools/resgen/CMakeLists.txt new file mode 100644 index 0000000..30e89c5 --- /dev/null +++ b/tools/resgen/CMakeLists.txt @@ -0,0 +1,21 @@ +project(resgen) + +add_executable(resgen main.cpp) + +target_compile_features(resgen PRIVATE cxx_std_17) + +function(add_resource generated_source) + set(resource_file "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV1}") + set(outfile "${PROJECT_BINARY_DIR}/${ARGV1}") + get_filename_component(filedir ${ARGV1} DIRECTORY) + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${filedir}") + add_custom_command( + OUTPUT "${outfile}.cpp" "${outfile}.hpp" + COMMAND resgen ${resource_file} + DEPENDS resgen ${resource_file} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/${filedir}" + COMMENT "Generating code for resource ${resource_file}" + VERBATIM + ) + set(${generated_source} "${outfile}.cpp" PARENT_SCOPE) +endfunction() diff --git a/tools/resgen/main.cpp b/tools/resgen/main.cpp new file mode 100644 index 0000000..a0d3efb --- /dev/null +++ b/tools/resgen/main.cpp @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc != 2) { + std::cerr << "Usage: " << argv[0] << " " << std::endl; + std::cerr << "Generates _res.h and _res.c" << std::endl; + return 1; + } + + // Get names + const std::string inFilepath = argv[1]; + const std::string inFilename = std::filesystem::path(inFilepath).filename().string(); + if (inFilename.empty()) { + std::cerr << "Passed invalid input file path " << inFilepath << std::endl; + return 1; + } + + // Open input + std::ifstream inStream(inFilepath, std::ios::binary|std::ios::in); + if (!inStream.is_open()) { + std::cerr << "Failed to open " << inFilepath << " for reading" << std::endl; + return 1; + } + + // Open outputs + const std::string hFilename = inFilename + ".hpp"; + std::ofstream hStream(hFilename); + if (!hStream.is_open()) { + std::cerr << "Failed to open " << hFilename << " for writing" << std::endl; + return 1; + } + + const std::string cFilename = inFilename + ".cpp"; + std::ofstream cStream(cFilename, std::ios::binary|std::ios::out); + if (!cStream.is_open()) { + std::cerr << "Failed to open " << cFilename << " for writing" << std::endl; + return 1; + } + + std::string resname = "resource_" + std::regex_replace(inFilename, std::regex("[^A-Za-z0-9]+"), "_"); + + // Generate .hpp + hStream << "#pragma once" << std::endl << std::endl; + hStream << "// Automatically generated from " << inFilename << std::endl << std::endl; + hStream << "#ifdef __cplusplus" << std::endl; + hStream << "extern \"C\"" << std::endl; + hStream << "#else//__cplusplus" << std::endl; + hStream << "extern" << std::endl; + hStream << "#endif//__cplusplus" << std::endl; + hStream << "const unsigned char " << resname << "_data[];" << std::endl << std::endl; + + hStream << "static const unsigned long long " << resname << "_size = " << std::filesystem::file_size(inFilepath) << "ull;" << std::endl; + + // Generate .cpp + cStream << "// Automatically generated from " << inFilename << std::endl << std::endl; + cStream << "#include \"" << hFilename << "\"" << std::endl << std::endl; + cStream << "const unsigned char " << resname << "_data[] = {" << std::endl; + cStream << " "; + + // Generate array + cStream << std::hex; + unsigned char c = inStream.get(); + while (inStream.good()) { + if (c < 16) { + cStream << " "; + } + + cStream << "0x" << int(c); + + c = inStream.get(); + if (inStream.eof()) { + break; + } + + cStream << ","; + + if (inStream.tellg() % 10 == 1) { + // Break lines + cStream << std::endl; + cStream << " "; + } else { + cStream << " "; + } + } + + if (inStream.bad()) { + std::cerr << "Fail when reading data" << std::endl; + return 1; + } + + cStream << std::dec; + cStream << std::endl << "};" << std::endl; + + std::cout << "Generated " << hFilename << " and " << cFilename << " based on " << inFilename << std::endl; + + return 0; +}