├── CMakeLists.txt ├── doc ├── README.md ├── gad.md ├── unbekannt.md ├── grafikreihenfolge.md ├── mdcii-bshdump.md ├── mdcii-sdltest.md ├── mdcii-bshpacker.md ├── warencodes.md ├── produktion.md └── bitflags.md ├── src ├── .clang-format ├── animation.hpp ├── block.hpp ├── grafiken.hpp ├── block.cpp ├── spielbildschirm.cpp ├── bsh_leser.hpp ├── spielbildschirm.hpp ├── zei_leser.hpp ├── karte.hpp ├── bebauung.hpp ├── strukturen.cpp ├── bildspeicher_rgb24.hpp ├── grafiken.cpp ├── bildspeicher_pal8.hpp ├── bsh_schreiber.hpp ├── codcat.cpp ├── bebauung.cpp ├── welt.hpp ├── files.hpp ├── CMakeLists.txt ├── bildspeicher.hpp ├── insel.hpp ├── inselbmp.cpp ├── kamera.hpp ├── weltbmp.cpp ├── karte.cpp ├── bshdump.cpp ├── bshpacker.cpp ├── zeitext.cpp ├── generischer_bsh_leser.hpp ├── files.cpp ├── bildspeicher_rgb24.cpp ├── bildspeicher.cpp ├── sdltest.cpp ├── palette.hpp ├── bildspeicher_pal8.cpp ├── welt.cpp ├── bsh_schreiber.cpp ├── insel.cpp ├── grafiken.txt ├── grafiken_1602.txt ├── kamera.cpp └── bebauung.txt ├── README.md └── COPYING /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | add_subdirectory(src) 4 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | Dokumentation 2 | ============= 3 | 4 | In diesem Ordner soll all das dokumentiert werden, wofür doxygen-Kommentare ungeeignet sind. 5 | -------------------------------------------------------------------------------- /doc/gad.md: -------------------------------------------------------------------------------- 1 | Aufbau einer .gad-Datei 2 | ======================= 3 | 4 | ```c 5 | typedef gadget_t = struct { 6 | int id; 7 | int blocknr; 8 | int gfxnr; 9 | int kind; 10 | int slidverflg; 11 | int noselflg; 12 | point pos; 13 | point size; 14 | point color; 15 | point posoffs; 16 | int pressoff; 17 | int flipflg; 18 | }; 19 | ``` 20 | 21 | - nummer: Pointer 22 | - objfill: Objekt(e), mit denen das aktuelle Objekt gefüllt wird 23 | 24 | - vorangestelltes @: Wert kann relativ sein 25 | -------------------------------------------------------------------------------- /doc/unbekannt.md: -------------------------------------------------------------------------------- 1 | Fehlende Informationen 2 | ====================== 3 | 4 | Schiffe 5 | ------- 6 | - Weiße Flagge 7 | - Patrouille (Punkt 1, Punkt 2) 8 | - Im Angriff 9 | - Animationsschritt? 10 | - Sinkt gerade 11 | - Formation? 12 | 13 | Werft 14 | ----- 15 | - Lagerstand Stoffe (wird offenbar nicht mitgespeichert) 16 | - Hat Rohstoffmangel 17 | - Auslastung? 18 | - Lebenspunkte? 19 | 20 | Timer 21 | ----- 22 | (alles unbekannt) 23 | 24 | Player 25 | ------ 26 | - Punktestand 27 | - ... 28 | 29 | Soldat 30 | ------ 31 | - Formation 32 | - ... 33 | -------------------------------------------------------------------------------- /doc/grafikreihenfolge.md: -------------------------------------------------------------------------------- 1 | Grafikreihenfolge 2 | ================= 3 | 4 | Es folgt eine Visualisierung der Reihenfolge der Grafiken für Gebäude mit einer Größe von mehr als einem Feld. 5 | 6 | Rotation 0 7 | ---------- 8 | 9 | ``` 10 | 1 2 11 | 3 4 12 | 13 | 1 14 | 3 2 15 | 4 16 | ``` 17 | 18 | Rotation 1 19 | ---------- 20 | 21 | ``` 22 | 3 1 23 | 4 2 24 | 25 | 3 26 | 4 1 27 | 2 28 | ``` 29 | 30 | Rotation 2 31 | ---------- 32 | 33 | ``` 34 | 4 3 35 | 2 1 36 | 37 | 4 38 | 2 3 39 | 1 40 | ``` 41 | 42 | Rotation 3 43 | ---------- 44 | 45 | ``` 46 | 2 4 47 | 1 3 48 | 49 | 2 50 | 1 4 51 | 3 52 | ``` 53 | -------------------------------------------------------------------------------- /doc/mdcii-bshdump.md: -------------------------------------------------------------------------------- 1 | mdcii-bshdump 2 | ============= 3 | 4 | Mit `mdcii-bshdump` steht ein Werkzeug zum Entpacken der `bsh`-Grafikarchive zur Verfügung. 5 | 6 | Bedienung 7 | --------- 8 | 9 | Das Programm akzeptiert die Folgenden Kommandozeilenparameter: 10 | 11 | Zulässige Optionen: 12 | -i [ --input ] arg Eingabedatei (*.bsh) 13 | -f [ --format ] arg (=pnm) Format (bmp oder pnm) 14 | -b [ --bpp ] arg (=24) Bits pro Pixel (8 oder 24) 15 | -p [ --prefix ] arg (=g_) Präfix (inklusive Pfad) für die Zieldateinamen 16 | -c [ --color ] arg (=0) Hintergrundfarbe für transparente Bereiche 17 | -h [ --help ] Gibt diesen Hilfetext aus 18 | 19 | -------------------------------------------------------------------------------- /doc/mdcii-sdltest.md: -------------------------------------------------------------------------------- 1 | mdcii-sdltest 2 | ============= 3 | 4 | Das Programm `mdcii-sdltest` kann Spielstände animiert und navigierbar darstellen. 5 | 6 | Bedienung 7 | --------- 8 | 9 | Die folgenden Kommandozeilenparameter können beim Programmaufruf angegebenen werden: 10 | 11 | Zulässige Optionen: 12 | -W [ --width ] arg (=800) Bildschirmbreite 13 | -H [ --height ] arg (=600) Bildschirmhöhe 14 | -F [ --fullscreen ] arg (=0) Vollbildmodus (true/false) 15 | -r [ --rate ] arg (=10) Bildrate 16 | -l [ --load ] arg (=game00.gam) Lädt den angegebenen Spielstand (*.gam) 17 | -p [ --path ] arg (=.) Pfad zur ANNO1602-Installation 18 | -h [ --help ] Gibt diesen Hilfetext aus 19 | 20 | 21 | Alle Parameter haben sinnvolle Voreinstellungen, sodass das Programm normalerweise ohne Kommandozeilenparameter aufgerufen werden kann. 22 | -------------------------------------------------------------------------------- /src/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: WebKit 3 | AlignAfterOpenBracket: DontAlign 4 | AlignConsecutiveAssignments: 'false' 5 | AllowShortBlocksOnASingleLine: 'false' 6 | AllowShortCaseLabelsOnASingleLine: 'true' 7 | AllowShortFunctionsOnASingleLine: InlineOnly 8 | AllowShortIfStatementsOnASingleLine: 'false' 9 | AllowShortLoopsOnASingleLine: 'false' 10 | BreakBeforeBraces: Allman 11 | ColumnLimit: '160' 12 | ConstructorInitializerAllOnOneLineOrOnePerLine: 'false' 13 | ConstructorInitializerIndentWidth: '2' 14 | IndentCaseLabels: 'true' 15 | IndentWidth: '2' 16 | Language: Cpp 17 | NamespaceIndentation: None 18 | SpaceInEmptyParentheses: 'false' 19 | Standard: Auto 20 | TabWidth: '8' 21 | SortIncludes: 'false' 22 | AlwaysBreakTemplateDeclarations: Yes 23 | AccessModifierOffset: '-2' 24 | AlignTrailingComments: 'true' 25 | Cpp11BracedListStyle: 'true' 26 | MaxEmptyLinesToKeep: '2' 27 | SpaceAfterTemplateKeyword: 'false' 28 | 29 | ... 30 | -------------------------------------------------------------------------------- /doc/mdcii-bshpacker.md: -------------------------------------------------------------------------------- 1 | mdcii-bshpacker 2 | =============== 3 | 4 | Mit `mdcii-bshpacker` steht ein Werkzeug zum Packen der `bsh`-Grafikarchive zur Verfügung. 5 | 6 | Bedienung 7 | --------- 8 | 9 | Das Programm akzeptiert die Folgenden Kommandozeilenparameter: 10 | 11 | Zulässige Optionen: 12 | -o [ --output ] arg Zieldatei (*.bsh, *.zei) 13 | -s [ --signature ] arg (=BSH) Signatur (BSH oder ZEI) 14 | -f [ --format ] arg (=pnm) Format (bmp oder pnm) 15 | -b [ --bpp ] arg (=8) Bits pro Pixel (8 oder 24) 16 | -p [ --prefix ] arg (=g_) Präfix (inklusive Pfad) für die Namen der 17 | Ausgangsdateien 18 | -n [ --number ] arg (=1) Anzahl zu verarbeitenden Bilder (mit Nummern 0 19 | bis n-1) 20 | -c [ --color ] arg (=0) Hintergrundfarbe für transparente Bereiche 21 | -e [ --extra ] arg (=0) Extraspalten in den Ausgangsdateien 22 | -h [ --help ] Gibt diesen Hilfetext aus 23 | 24 | -------------------------------------------------------------------------------- /src/animation.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2017 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef ANIMATION_HPP 20 | #define ANIMATION_HPP 21 | 22 | struct Animation 23 | { 24 | int x, y, z; 25 | int ani; 26 | int start_index; 27 | int schritte; 28 | int bs_z_versatz; 29 | bool wiederholen; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/block.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BLOCK_HPP 20 | #define BLOCK_HPP 21 | 22 | #include 23 | #include 24 | 25 | class Block 26 | { 27 | public: 28 | char kennung[16]; 29 | uint32_t laenge; 30 | uint8_t* daten; 31 | 32 | Block(std::istream& f); 33 | ~Block(); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/grafiken.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef GRAFIKEN_HPP 20 | #define GRAFIKEN_HPP 21 | 22 | #include 23 | #include 24 | 25 | class Grafiken 26 | { 27 | std::map index; 28 | 29 | public: 30 | Grafiken(std::string dateiname); 31 | int grafik_zu(uint16_t i); 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/block.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "block.hpp" 20 | 21 | Block::Block(std::istream& f) 22 | { 23 | f.read(this->kennung, sizeof(this->kennung)); 24 | f.read((char*)&this->laenge, sizeof(this->laenge)); 25 | this->daten = new uint8_t[this->laenge]; 26 | f.read((char*)this->daten, this->laenge); 27 | } 28 | 29 | Block::~Block() 30 | { 31 | delete daten; 32 | } 33 | -------------------------------------------------------------------------------- /doc/warencodes.md: -------------------------------------------------------------------------------- 1 | Warencodes 2 | ========== 3 | 4 | Code | Ware 5 | -------|-------------- 6 | 0x0961 | Eisenerz 7 | 0x0965 | Gold 8 | 0x05e1 | Wolle 9 | 0x05e7 | Zuckerrohr 10 | 0x05e3 | Tabak 11 | 0x05e9 | Schlachtvieh 12 | 0x05df | Weizen 13 | 0x01f5 | Mehl 14 | 0x0209 | Eisen 15 | 0x0205 | Schwerter 16 | 0x0211 | Musketen 17 | 0x020f | Kanonen 18 | 0x0433 | Nahrung 19 | 0x020d | Tabakwaren 20 | 0x05dd | Gewürze 21 | 0x05e5 | Kakao 22 | 0x0207 | Alkohol 23 | 0x01fb | Stoffe 24 | 0x01f9 | Kleidung 25 | 0x0215 | Schmuck 26 | 0x0203 | Werkzeug 27 | 0x07d1 | Holz 28 | 0x0201 | Steine 29 | 30 | Folgende Codes werden für Soldaten im Laderaum von Schiffen verwendet: 31 | 32 | Code | Einheit 33 | -------|-------------------- 34 | 0x26ad | Infanterist (rot) 35 | 0x26ae | Infanterist (blau) 36 | 0x26af | Infanterist (gelb) 37 | 0x26b0 | Infanterist (grau) 38 | 0x26b1 | Kavallerist (rot) 39 | 0x26b2 | Kavallerist (blau) 40 | 0x26b3 | Kavallerist (gelb) 41 | 0x26b4 | Kavallerist (grau) 42 | 0x26b5 | Musketier (rot) 43 | 0x26b6 | Musketier (blau) 44 | 0x26b7 | Musketier (gelb) 45 | 0x26b8 | Musketier (grau) 46 | 0x26b9 | Kanonier (rot) 47 | 0x26ba | Kanonier (blau) 48 | 0x26bb | Kanonier (gelb) 49 | 0x26bc | Kanonier (grau) 50 | 51 | Die Farbe wird im Spiel nicht angezeigt und beim Ausladen überschrieben. 52 | -------------------------------------------------------------------------------- /src/spielbildschirm.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "spielbildschirm.hpp" 20 | 21 | Spielbildschirm::Spielbildschirm(Bildspeicher& bs) 22 | : bs(bs) 23 | , karte(bs.breite - 182, 0, 182, 156) 24 | { 25 | // leer 26 | } 27 | 28 | void Spielbildschirm::zeichne_bild(Welt& welt, int maus_x, int maus_y) 29 | { 30 | kamera.zeichne_bild(bs, welt, maus_x, maus_y); 31 | karte.zeichne_bild(bs, welt); 32 | karte.zeichne_kameraposition(bs, kamera); 33 | } 34 | -------------------------------------------------------------------------------- /src/bsh_leser.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BSH_LESER_HPP 20 | #define BSH_LESER_HPP 21 | 22 | #include 23 | 24 | #include "generischer_bsh_leser.hpp" 25 | 26 | struct Bsh_bild : public Generisches_bsh_bild<0> 27 | { 28 | }; 29 | 30 | class Bsh_leser : public Generischer_bsh_leser 31 | { 32 | public: 33 | Bsh_leser(std::string pfadname) 34 | : Generischer_bsh_leser(pfadname, "BSH") 35 | { 36 | } 37 | }; 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/spielbildschirm.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef SPIELBILDSCHIRM_HPP 20 | #define SPIELBILDSCHIRM_HPP 21 | 22 | #include "bildspeicher.hpp" 23 | #include "kamera.hpp" 24 | #include "karte.hpp" 25 | #include "welt.hpp" 26 | 27 | class Spielbildschirm 28 | { 29 | Bildspeicher& bs; 30 | Karte karte; 31 | 32 | public: 33 | Kamera kamera; // vorübergehend public 34 | 35 | Spielbildschirm(Bildspeicher& bs); 36 | 37 | void zeichne_bild(Welt& welt, int maus_x, int maus_y); 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/zei_leser.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef ZEI_LESER_HPP 20 | #define ZEI_LESER_HPP 21 | 22 | #include 23 | 24 | #include "generischer_bsh_leser.hpp" 25 | 26 | struct Zei_zeichen : public Generisches_bsh_bild<3> 27 | { 28 | }; 29 | 30 | class Zei_leser : public Generischer_bsh_leser 31 | { 32 | public: 33 | Zei_leser(std::string pfadname) 34 | : Generischer_bsh_leser(pfadname, "ZEI") 35 | { 36 | } 37 | }; 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/karte.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef KARTE_HPP 20 | #define KARTE_HPP 21 | 22 | #include 23 | #include "bildspeicher.hpp" 24 | #include "welt.hpp" 25 | #include "kamera.hpp" 26 | 27 | class Karte 28 | { 29 | int xpos, ypos; 30 | int breite, hoehe; 31 | 32 | public: 33 | Karte(int xpos = 0, int ypos = 0, int breite = 500, int hoehe = 350); 34 | 35 | void zeichne_bild(Bildspeicher& bs, Welt& welt); 36 | void zeichne_kameraposition(Bildspeicher& bs, Kamera& kamera); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /doc/produktion.md: -------------------------------------------------------------------------------- 1 | Ablauf der Produktion 2 | ===================== 3 | 4 | Notizen zu Änderungen in den Prodlist-Daten zwischen unmittelbar nacheinander gespeicherten Spielständen 5 | 6 | 0e 05 29 7 | aktives Gebäude ohne Rohstoffe: warteschritt 3 wahrscheinlich um 4 auf 10 reduziert => ani von 3 auf 4 erhöht und auslastung_nenner von 179 auf 190 8 | 9 | 0e 28 10 10 | auslastung_nenner = 231 => auslastung_nenner = 121 (= (231+11)/2 ) 11 | 0e 0b 18 12 | 229 => 120 13 | 14 | 15 | 16 | Vermutung für ani: Anzahl der Nulldurchgänge von warteschritt ohne Produktion 17 | 18 | 19 | 20 | 21 | Mit Produktion 22 | 23 | 0e 0c 25 24 | 0e 13 16 25 | 0e 13 1e 26 | 27 | 28 | 29 | Vermuteter Ablauf 30 | 31 | warteschritt wird sekündlich um 1 verringert. 32 | Bei Nulldurchgang wird 33 | - ein vom Gebäudetyp abhängiger Modulo zu warteschritt addiert. 34 | - der Modulo zu auslastung_nenner addiert 35 | - wenn das Gebäude gerade produziert (d.h. wenn genug Rohstoffe da sind) 36 | - ein anderer typabhängiger Wert zu auslastung_zaehler addiert 37 | - ani auf 0 gesetzt 38 | - ein typabhängiger Wert von rohstoff (und rohstoff2) abgezogen 39 | - ein typabhängiger Wert zu produkt addiert 40 | - sonst 41 | - ani um 1 erhöht (nicht über 0x0f) 42 | 43 | Übersteigt auslastung_nenner einen bestimmten Wert, werden auslastung_nenner und auslastung_zaehler halbiert. 44 | -------------------------------------------------------------------------------- /src/bebauung.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BEBAUUNG_HPP 20 | #define BEBAUUNG_HPP 21 | 22 | #include 23 | #include 24 | 25 | struct Bebauungsinfo 26 | { 27 | uint8_t breite; 28 | uint8_t hoehe; 29 | uint8_t richtungen; 30 | uint8_t ani_schritte; 31 | uint8_t grundhoehe; 32 | uint8_t bauhoehe; 33 | uint8_t lagerstaende; 34 | uint8_t kategorie; 35 | }; 36 | 37 | class Bebauung 38 | { 39 | std::map index; 40 | 41 | public: 42 | Bebauung(std::string dateiname); 43 | Bebauungsinfo* info_zu(uint16_t i); 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MDCII Game Engine 2 | ================= 3 | 4 | Ziel des MDCII-Projekts ist eine unabhängige Neuimplementierung der Engine des PC-Spiels **ANNO 1602** unter freier Lizenz. 5 | 6 | Gegenwärtig enthält das Projekt die Programme [`mdcii-bshdump`](doc/mdcii-bshdump.md), [`mdcii-bshpacker`](doc/mdcii-bshpacker.md), `mdcii-codcat`, `mdcii-inselbmp`, [`mdcii-sdltest`](doc/mdcii-sdltest.md) und `mdcii-weltbmp`. 7 | 8 | Das komplexeste dieser Programme ist [`mdcii-sdltest`](doc/mdcii-sdltest.md), das Spielstände von ANNO 1602 animiert und navigierbar darstellen kann. 9 | 10 | 11 | Installation 12 | ------------ 13 | 14 | Die Programme erwarten in ihrem Ordner bestimmte Ordner und Dateien aus der ANNO-1602-Installation beziehungsweise vom ANNO-1602-Datenträger. 15 | 16 | Die erforderlichen Ordner sind: 17 | 18 | - Grafikordner 19 | - `sgfx`: Grafiken der kleinsten Vergrößerungsstufe 20 | - `mgfx`: Grafiken der mittleren Vergrößerungsstufe 21 | - `gfx`: Grafiken der höchsten Vergrößerungsstufe 22 | - `toolgfx`: Schriftarten und Menügrafiken (letztere ungenutzt) 23 | - Inselordner 24 | - `nord`: Nördliche Inseln 25 | - `sued`: Südliche Inseln 26 | 27 | Stammen die Dateien von der unerweiterten Originalversion oder der Demoversion, muss `grafiken_1602.txt`, umbennant zu `grafiken.txt`, als Index benutzt werden. 28 | Die üblicherweise in den Ausgabeordner kopierte `grafiken.txt` indiziert die Grafikdateien der NINA-Erweiterung. 29 | 30 | 31 | Lizenz 32 | ------ 33 | 34 | GPL Version 2 oder neuer, siehe [COPYING](COPYING). 35 | -------------------------------------------------------------------------------- /src/strukturen.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "strukturen.hpp" 20 | 21 | char inselhaus_kennung[] = "INSELHAUS"; 22 | char wiff_kennung[] = "WIFF"; 23 | 24 | constexpr char Insel3::kennung[]; 25 | constexpr char Insel5::kennung[]; 26 | constexpr char Hirsch2::kennung[]; 27 | constexpr char Siedler::kennung[]; 28 | constexpr char Rohwachs::kennung[]; 29 | constexpr char Prodlist::kennung[]; 30 | constexpr char Werft::kennung[]; 31 | constexpr char Militar::kennung[]; 32 | constexpr char Stadt::kennung[]; 33 | constexpr char Kontor::kennung[]; 34 | constexpr char Markt::kennung[]; 35 | constexpr char Player::kennung[]; 36 | constexpr char Auftrag::kennung[]; 37 | constexpr char Handler::kennung[]; 38 | constexpr char Ship::kennung[]; 39 | constexpr char Soldat::kennung[]; 40 | constexpr char Turm::kennung[]; 41 | -------------------------------------------------------------------------------- /src/bildspeicher_rgb24.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BILDSPEICHER_RGB24_HPP 20 | #define BILDSPEICHER_RGB24_HPP 21 | 22 | #include 23 | #include "bsh_leser.hpp" 24 | #include "bildspeicher.hpp" 25 | 26 | class Bildspeicher_rgb24 : public Bildspeicher 27 | { 28 | void zeichne_bsh_bild_ganz(Bsh_bild& bild, int x, int y); 29 | void zeichne_bsh_bild_partiell(Bsh_bild& bild, int x, int y); 30 | 31 | public: 32 | Bildspeicher_rgb24(uint32_t breite, uint32_t hoehe, uint32_t farbe = 0, uint8_t* puffer = NULL, uint32_t pufferbreite = 0); 33 | void zeichne_bsh_bild(Bsh_bild& bild, int x, int y); 34 | void zeichne_pixel(int x, int y, uint8_t farbe); 35 | void exportiere_pnm(const char* pfadname); 36 | void exportiere_bmp(const char* pfadname); 37 | void bild_loeschen(); 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/grafiken.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | 22 | #include "grafiken.hpp" 23 | 24 | Grafiken::Grafiken(std::string dateiname) 25 | { 26 | std::ifstream datei(dateiname.c_str()); 27 | std::string zeile; 28 | while (datei.good()) 29 | { 30 | std::getline(datei, zeile); 31 | if (!zeile.empty() && zeile[0] != ';') 32 | { 33 | std::stringstream ss(zeile, std::ios_base::in); 34 | uint16_t bebauung; 35 | uint32_t grafikindex; 36 | ss >> bebauung >> grafikindex; 37 | if (datei.good()) 38 | index[bebauung] = grafikindex; 39 | } 40 | } 41 | } 42 | 43 | int Grafiken::grafik_zu(uint16_t i) 44 | { 45 | auto grafik = index.find(i); 46 | if (grafik != index.end()) 47 | return grafik->second; 48 | else 49 | return -1; 50 | } 51 | -------------------------------------------------------------------------------- /src/bildspeicher_pal8.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BILDSPEICHER_PAL8_HPP 20 | #define BILDSPEICHER_PAL8_HPP 21 | 22 | #include 23 | #include "bsh_leser.hpp" 24 | #include "bildspeicher.hpp" 25 | 26 | class Bildspeicher_pal8 : public Bildspeicher 27 | { 28 | uint8_t dunkel[256]; 29 | 30 | void zeichne_bsh_bild_ganz(Bsh_bild& bild, int x, int y); 31 | void zeichne_bsh_bild_partiell(Bsh_bild& bild, int x, int y); 32 | 33 | public: 34 | Bildspeicher_pal8(uint32_t breite, uint32_t hoehe, uint32_t farbe = 0, uint8_t* puffer = NULL, uint32_t pufferbreite = 0); 35 | void zeichne_bsh_bild(Bsh_bild& bild, int x, int y); 36 | void zeichne_pixel(int x, int y, uint8_t farbe); 37 | void exportiere_pnm(const char* pfadname); 38 | void exportiere_bmp(const char* pfadname); 39 | void bild_loeschen(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/bsh_schreiber.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2017 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BSH_SCHREIBER_HPP 20 | #define BSH_SCHREIBER_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | class Bsh_schreiber 27 | { 28 | int transp_farbe; 29 | int extra_spalten; 30 | bool ist_zei; 31 | 32 | struct Bild_und_meta 33 | { 34 | uint32_t breite, hoehe, typ, laenge, crc, versatz; 35 | int duplikat_von; 36 | std::vector daten; 37 | }; 38 | std::vector bilder; 39 | 40 | public: 41 | Bsh_schreiber(int transp_farbe = 0, int extra_spalten = 0, bool ist_zei = false); 42 | ~Bsh_schreiber(); 43 | void schreib_bsh(uint8_t* bild, int breite, int hoehe, std::vector& ziel); 44 | void lies_pgm(const char* pfadname, uint8_t*& bild, int& breite, int& hoehe); 45 | void pgm_anhaengen(const char* pfadname); 46 | void datei_schreiben(const char* pfadname); 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/codcat.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2018 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | // #include 22 | #include 23 | 24 | using namespace std; 25 | using namespace boost::iostreams; 26 | 27 | struct bytewise_2s_complement_input_filter 28 | { 29 | typedef char char_type; 30 | typedef input_filter_tag category; 31 | 32 | template 33 | int get(Source& src) 34 | { 35 | int c = boost::iostreams::get(src); 36 | if (c != EOF && c != WOULD_BLOCK) 37 | c = -c & 0xff; 38 | return c; 39 | } 40 | }; 41 | 42 | int main(int argc, char** argv) 43 | { 44 | if (argc != 2) 45 | exit(EXIT_FAILURE); 46 | 47 | filtering_istream in; 48 | // in.push(newline_filter(newline::dos)); 49 | in.push(bytewise_2s_complement_input_filter()); 50 | in.push(file_source(argv[1])); 51 | 52 | while (in.good()) 53 | { 54 | char c = in.get(); 55 | cout.put(c); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/bebauung.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | 22 | #include "bebauung.hpp" 23 | 24 | Bebauung::Bebauung(std::string dateiname) 25 | { 26 | std::ifstream datei(dateiname.c_str()); 27 | std::string zeile; 28 | while (datei.good()) 29 | { 30 | std::getline(datei, zeile); 31 | if (!zeile.empty() && zeile[0] != ';') 32 | { 33 | std::stringstream ss(zeile, std::ios_base::in); 34 | uint16_t bebauung, breite, hoehe, richtungen, ani_schritte, grundhoehe, bauhoehe, lagerstaende, kategorie; 35 | ss >> bebauung >> breite >> hoehe >> richtungen >> ani_schritte >> grundhoehe >> bauhoehe >> lagerstaende >> kategorie; 36 | if (datei.good()) 37 | index[bebauung] = {(uint8_t)breite, (uint8_t)hoehe, (uint8_t)richtungen, (uint8_t)ani_schritte, (uint8_t)grundhoehe, (uint8_t)bauhoehe, 38 | (uint8_t)lagerstaende, (uint8_t)kategorie}; 39 | } 40 | } 41 | } 42 | 43 | Bebauungsinfo* Bebauung::info_zu(uint16_t i) 44 | { 45 | auto info = index.find(i); 46 | if (info != index.end()) 47 | return &info->second; 48 | else 49 | return nullptr; 50 | } 51 | -------------------------------------------------------------------------------- /src/welt.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef WELT_HPP 20 | #define WELT_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "insel.hpp" 27 | #include "block.hpp" 28 | #include "strukturen.hpp" 29 | #include "bebauung.hpp" 30 | #include "animation.hpp" 31 | 32 | class Welt 33 | { 34 | int ani; 35 | 36 | public: 37 | enum 38 | { 39 | KARTENBREITE = 500 40 | }; 41 | enum 42 | { 43 | KARTENHOEHE = 350 44 | }; 45 | 46 | Bebauung* bebauung; 47 | std::map, Animation> animationen; 48 | 49 | int inselnummer_an_pos(uint16_t x, uint16_t y); 50 | Insel* insel_an_pos(uint16_t x, uint16_t y); 51 | std::vector bloecke; 52 | std::vector inseln; 53 | std::vector kontore; 54 | std::vector schiffe; 55 | std::vector soldaten; 56 | std::vector prodlist; 57 | std::vector spieler; 58 | Welt(std::istream& f); 59 | void simulationsschritt(); 60 | void feld_an_pos(inselfeld_t& feld, int x, int y); 61 | Prodlist* prodlist_an_pos(uint8_t insel, uint8_t x, uint8_t y); 62 | Ship* schiff_an_pos(uint16_t x, uint16_t y); 63 | uint8_t spielerfarbe(uint8_t spieler); 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/files.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2019 Armin Schlegel 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef FILES_HPP 20 | #define FILES_HPP 21 | #include 22 | #include 23 | #include 24 | 25 | class Files 26 | { 27 | public: 28 | static Files* create_instance(std::string path); 29 | static Files* instance(); 30 | void init(); 31 | void init(std::string path); 32 | 33 | std::string get_file(std::string key); 34 | bool check_file(const std::string& filename); 35 | bool check_all_files(); 36 | std::map create_file_map(const std::string& path, std::map map); 37 | std::string find_path_for_file(std::string file); 38 | 39 | private: 40 | static Files* _instance; 41 | ~Files() {} 42 | Files(std::string path) { init(path); } 43 | 44 | Files(const Files&); 45 | 46 | std::vector get_directory_tree(const std::string& path); 47 | std::string string_to_lower_case(const std::string& str); 48 | 49 | std::map files; 50 | std::vector tree; 51 | 52 | class CGuard 53 | { 54 | public: 55 | ~CGuard() 56 | { 57 | if (NULL != Files::_instance) 58 | { 59 | delete Files::_instance; 60 | Files::_instance = NULL; 61 | } 62 | } 63 | }; 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | add_definitions(-std=c++11) 4 | find_package(Boost REQUIRED COMPONENTS iostreams program_options filesystem) 5 | find_package(SDL REQUIRED) 6 | 7 | add_compile_options(-mno-ms-bitfields) 8 | 9 | add_executable(mdcii-inselbmp inselbmp.cpp bildspeicher.cpp bildspeicher_pal8.cpp block.cpp insel.cpp strukturen.cpp bebauung.cpp grafiken.cpp files.cpp) 10 | target_link_libraries(mdcii-inselbmp boost_system boost_iostreams boost_filesystem) 11 | 12 | add_executable(mdcii-weltbmp weltbmp.cpp bildspeicher.cpp bildspeicher_pal8.cpp block.cpp insel.cpp strukturen.cpp welt.cpp bebauung.cpp grafiken.cpp files.cpp) 13 | target_link_libraries(mdcii-weltbmp boost_system boost_iostreams boost_filesystem) 14 | 15 | add_executable(mdcii-sdltest sdltest.cpp bildspeicher.cpp bildspeicher_pal8.cpp block.cpp insel.cpp strukturen.cpp welt.cpp kamera.cpp karte.cpp spielbildschirm.cpp bebauung.cpp grafiken.cpp files.cpp) 16 | target_link_libraries(mdcii-sdltest SDL boost_system boost_iostreams boost_program_options boost_filesystem) 17 | if(WIN32) 18 | target_link_libraries(mdcii-sdltest mingw32 winmm dxguid SDLmain) 19 | endif(WIN32) 20 | add_custom_command(TARGET mdcii-sdltest POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bebauung.txt ${CMAKE_CURRENT_BINARY_DIR}/bebauung.txt) 21 | add_custom_command(TARGET mdcii-sdltest POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/grafiken.txt ${CMAKE_CURRENT_BINARY_DIR}/grafiken.txt) 22 | 23 | add_executable(mdcii-bshdump bshdump.cpp bildspeicher.cpp bildspeicher_pal8.cpp bildspeicher_rgb24.cpp) 24 | target_link_libraries(mdcii-bshdump boost_iostreams boost_program_options) 25 | 26 | add_executable(mdcii-bshpacker bshpacker.cpp bsh_schreiber.cpp) 27 | target_link_libraries(mdcii-bshpacker boost_iostreams boost_program_options) 28 | 29 | add_executable(mdcii-zeitext zeitext.cpp bildspeicher.cpp bildspeicher_pal8.cpp bildspeicher_rgb24.cpp) 30 | target_link_libraries(mdcii-zeitext boost_iostreams boost_program_options) 31 | 32 | add_executable(mdcii-codcat codcat.cpp) 33 | target_link_libraries(mdcii-codcat boost_iostreams) 34 | -------------------------------------------------------------------------------- /src/bildspeicher.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BILDSPEICHER_HPP 20 | #define BILDSPEICHER_HPP 21 | 22 | #include 23 | #include "bsh_leser.hpp" 24 | #include "zei_leser.hpp" 25 | 26 | class Bildspeicher 27 | { 28 | protected: 29 | uint8_t* puffer; 30 | uint8_t puffer_freigeben; 31 | uint32_t pufferbreite; 32 | uint32_t format; 33 | uint32_t farbe; 34 | 35 | uint8_t indextabelle_schriftfarbe[256]; 36 | 37 | public: 38 | uint32_t breite; 39 | uint32_t hoehe; 40 | 41 | Bildspeicher(uint32_t breite, uint32_t hoehe, uint32_t format = 1, uint32_t farbe = 0, uint8_t* puffer = NULL, uint32_t pufferbreite = 0); 42 | ~Bildspeicher(); 43 | virtual void zeichne_bsh_bild(Bsh_bild& bild, int x, int y); 44 | void zeichne_bsh_bild_oz(Bsh_bild& bild, int x, int y); 45 | virtual void zeichne_bsh_bild_sp(Bsh_bild& bild, int x, int y, int sx, int sy, bool& schnitt); 46 | void zeichne_bsh_bild_sp_oz(Bsh_bild& bild, int x, int y, int sx, int sy, bool& schnitt); 47 | virtual void zeichne_pixel(int x, int y, uint8_t farbe) = 0; 48 | virtual void zeichne_rechteck(int x1, int y1, int x2, int y2, uint8_t farbe); 49 | virtual void zeichne_linie(int x1, int y1, int x2, int y2, uint8_t farbe, uint8_t muster = 0xff); 50 | virtual void zeichne_zei_zeichen(Zei_zeichen& zeichen, int x, int y); 51 | void zeichne_string(Zei_leser& zei_leser, std::string s, int x, int y); 52 | void setze_schriftfarbe(uint8_t schrift, uint8_t schatten); 53 | virtual void exportiere_pnm(const char* pfadname); 54 | virtual void exportiere_bmp(const char* pfadname); 55 | virtual void bild_loeschen(); 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/insel.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef INSEL_HPP 20 | #define INSEL_HPP 21 | 22 | #include 23 | #include "block.hpp" 24 | 25 | class Grafiken; 26 | class Bebauung; 27 | 28 | typedef struct 29 | { 30 | uint16_t bebauung; 31 | uint8_t x_pos; 32 | uint8_t y_pos; 33 | uint32_t rot : 2; 34 | uint32_t ani : 4; 35 | uint32_t unbekannt : 8; // Werte zwischen 0 und ca. 17, pro Insel konstant, mehrere Inseln können den gleichen Wert haben 36 | uint32_t status : 3; // 7: frei, 0: von spieler besiedelt, 1: von spieler erobert (?) 37 | uint32_t zufall : 5; 38 | uint32_t spieler : 3; 39 | uint32_t leer : 7; 40 | } inselfeld_t; 41 | 42 | typedef struct 43 | { 44 | int16_t index; 45 | uint8_t grundhoehe; 46 | } feld_t; 47 | 48 | class Insel 49 | { 50 | inselfeld_t* schicht1; 51 | inselfeld_t* schicht2; 52 | Bebauung& bebauung; 53 | 54 | public: 55 | uint8_t breite; 56 | uint8_t hoehe; 57 | uint16_t xpos; 58 | uint16_t ypos; 59 | void insel_rastern(inselfeld_t* a, uint32_t laenge, inselfeld_t* b, uint8_t breite, uint8_t hoehe); 60 | std::string basisname(uint8_t breite, uint8_t num, uint8_t sued); 61 | Block* inselX; 62 | Insel(Block* inselX, Block* inselhaus, Bebauung& bebauung); 63 | void grafik_boden(feld_t& ziel, uint8_t x, uint8_t y, uint8_t r, Grafiken& grafiken); 64 | void inselfeld_bebauung(inselfeld_t& ziel, uint8_t x, uint8_t y); 65 | static void grafik_bebauung_inselfeld(feld_t& ziel, inselfeld_t& feld, uint8_t r, Bebauung& bebauung, Grafiken& grafiken); 66 | void grafik_bebauung(feld_t& ziel, uint8_t x, uint8_t y, uint8_t r, Grafiken& grafiken); 67 | void bewege_wasser(); 68 | void animiere_gebaeude(uint8_t x, uint8_t y); 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/inselbmp.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include "bsh_leser.hpp" 27 | #include "bildspeicher_pal8.hpp" 28 | #include "insel.hpp" 29 | #include "bebauung.hpp" 30 | #include "grafiken.hpp" 31 | #include "files.hpp" 32 | 33 | 34 | #define XRASTER 32 35 | #define YRASTER 16 36 | #define ELEVATION 20 37 | 38 | 39 | int main(int argc, char** argv) 40 | { 41 | if (argc < 2) 42 | exit(EXIT_FAILURE); 43 | 44 | std::ifstream f; 45 | f.open(argv[1], std::ios_base::in | std::ios_base::binary); 46 | 47 | Block inselX = Block(f); 48 | Block inselhaus = Block(f); 49 | 50 | f.close(); 51 | 52 | auto files = Files::create_instance("."); 53 | 54 | Bebauung bebauung(files->instance()->get_file("bebauung.txt")); 55 | Grafiken stadtfld_grafiken(files->instance()->get_file("grafiken.txt")); 56 | 57 | Insel insel = Insel(&inselX, &inselhaus, bebauung); 58 | uint8_t width = insel.breite; 59 | uint8_t height = insel.hoehe; 60 | 61 | Bsh_leser bsh_leser(files->instance()->get_file("gfx/stadtfld.bsh")); 62 | 63 | Bildspeicher_pal8 bs((width + height) * XRASTER, (width + height) * YRASTER, 0); 64 | 65 | int x, y; 66 | for (y = 0; y < height; y++) 67 | { 68 | for (x = 0; x < width; x++) 69 | { 70 | feld_t feld; 71 | insel.grafik_bebauung(feld, x, y, 0, stadtfld_grafiken); 72 | if (feld.index != -1) 73 | { 74 | Bsh_bild& bsh = bsh_leser.gib_bsh_bild(feld.index); 75 | bs.zeichne_bsh_bild_oz(bsh, (x - y + height) * XRASTER, (x + y) * YRASTER + 2 * YRASTER - feld.grundhoehe * ELEVATION); 76 | } 77 | } 78 | } 79 | 80 | bs.exportiere_bmp(argv[2]); 81 | } 82 | -------------------------------------------------------------------------------- /src/kamera.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef KAMERA_HPP 20 | #define KAMERA_HPP 21 | 22 | #include 23 | #include "bsh_leser.hpp" 24 | #include "bildspeicher.hpp" 25 | #include "welt.hpp" 26 | 27 | class Grafiken; 28 | 29 | /* GFX/ MGFX/ Sgfx/ EFFEKTE.BSH MAEHER.BSH NUMBERS.BSH SHIP.BSH SOLDAT.BSH STADTFLD.BSH TIERE.BSH TRAEGER.BSH */ 30 | 31 | class Kamera 32 | { 33 | uint16_t xpos, ypos; 34 | uint8_t drehung, vergroesserung; 35 | 36 | static const int x_raster[3]; 37 | static const int y_raster[3]; 38 | static const int grundhoehe[3]; 39 | 40 | Bsh_leser* effekte_bsh[3]; 41 | Bsh_leser* maeher_bsh[3]; 42 | Bsh_leser* numbers_bsh[3]; 43 | Bsh_leser* ship_bsh[3]; 44 | Bsh_leser* soldat_bsh[3]; 45 | Bsh_leser* stadtfld_bsh[3]; 46 | Bsh_leser* tiere_bsh[3]; 47 | Bsh_leser* traeger_bsh[3]; 48 | Zei_leser* zei; 49 | 50 | Grafiken* stadtfld_grafiken; 51 | 52 | public: 53 | Kamera(); 54 | void gehe_zu(uint16_t x, uint16_t y); 55 | void nach_rechts(); 56 | void nach_links(); 57 | void nach_oben(); 58 | void nach_unten(); 59 | void vergroessern(); 60 | void verkleinern(); 61 | void setze_vergroesserung(uint8_t vergroesserung); 62 | void rechts_drehen(); 63 | void links_drehen(); 64 | 65 | void auf_bildschirm(Bildspeicher& bs, int karte_x, int karte_y, int& bildschirm_x, int& bildschirm_y); 66 | void auf_bildschirm(Bildspeicher& bs, int karte_x, int karte_y, int karte_z, int& bildschirm_x, int& bildschirm_y, int& bildschirm_z); 67 | void auf_bildschirm_256(Bildspeicher& bs, int karte_x, int karte_y, int karte_z, int& bildschirm_x, int& bildschirm_y, int& bildschirm_z); 68 | void auf_karte(Bildspeicher& bs, int bildschirm_x, int bildschirm_y, int& karte_x, int& karte_y); 69 | 70 | void zeichne_bild(Bildspeicher& bs, Welt& welt, int maus_x, int maus_y); 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/weltbmp.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #include "bsh_leser.hpp" 28 | #include "bildspeicher_pal8.hpp" 29 | #include "insel.hpp" 30 | #include "welt.hpp" 31 | #include "grafiken.hpp" 32 | #include "files.hpp" 33 | 34 | #include 35 | #define foreach BOOST_FOREACH 36 | 37 | #define XRASTER 16 38 | #define YRASTER 8 39 | #define ELEVATION 10 40 | 41 | 42 | int main(int argc, char** argv) 43 | { 44 | if (argc < 3) 45 | exit(EXIT_FAILURE); 46 | 47 | std::ifstream f; 48 | f.open(argv[1], std::ios_base::in | std::ios_base::binary); 49 | 50 | Welt welt = Welt(f); 51 | 52 | f.close(); 53 | auto files = Files::create_instance("."); 54 | Bsh_leser bsh_leser(files->instance()->get_file("mgfx/stadtfld.bsh")); 55 | Grafiken stadtfld_grafiken(files->instance()->get_file("grafiken.txt")); 56 | 57 | Bildspeicher_pal8 bs((Welt::KARTENBREITE + Welt::KARTENHOEHE) * XRASTER, (Welt::KARTENBREITE + Welt::KARTENHOEHE) * YRASTER, 0); 58 | 59 | for (int y = 0; y < Welt::KARTENHOEHE; y++) 60 | { 61 | for (int x = 0; x < Welt::KARTENBREITE; x++) 62 | { 63 | Insel* insel = welt.insel_an_pos(x, y); 64 | feld_t feld; 65 | if (insel != NULL) 66 | insel->grafik_bebauung(feld, x - insel->xpos, y - insel->ypos, 0, stadtfld_grafiken); 67 | else 68 | { 69 | feld.index = stadtfld_grafiken.grafik_zu(1201) + (y + x * 3) % 12; 70 | feld.grundhoehe = 0; 71 | } 72 | /*feld_t feld2; 73 | insel->grafik_boden(&feld2, x, y, 0);*/ 74 | if (feld.index != -1) 75 | { 76 | Bsh_bild& bsh = bsh_leser.gib_bsh_bild(feld.index); 77 | uint16_t x_auf_karte = x /*- insel->breite / 2*/; 78 | uint16_t y_auf_karte = y /*- insel->hoehe / 2*/; 79 | bs.zeichne_bsh_bild_oz( 80 | bsh, (x_auf_karte - y_auf_karte + Welt::KARTENHOEHE) * XRASTER, (x_auf_karte + y_auf_karte) * YRASTER + 2 * YRASTER - feld.grundhoehe * ELEVATION); 81 | } 82 | /*else 83 | std::cout << insel->schicht2[y * insel->breite + x].bebauung << " ";*/ 84 | } 85 | } 86 | 87 | bs.exportiere_bmp(argv[2]); 88 | } 89 | -------------------------------------------------------------------------------- /src/karte.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "karte.hpp" 20 | 21 | Karte::Karte(int xpos, int ypos, int breite, int hoehe) 22 | { 23 | this->xpos = xpos; 24 | this->ypos = ypos; 25 | this->breite = breite; 26 | this->hoehe = hoehe; 27 | } 28 | 29 | void Karte::zeichne_bild(Bildspeicher& bs, Welt& welt) 30 | { 31 | for (Insel* insel : welt.inseln) 32 | { 33 | for (int y = 0; y < insel->hoehe; y++) 34 | { 35 | for (int x = 0; x < insel->breite; x++) 36 | { 37 | inselfeld_t feld; 38 | insel->inselfeld_bebauung(feld, x, y); 39 | uint8_t farbe = 0; 40 | uint8_t nummer = (feld.spieler < 4) ? welt.spielerfarbe(feld.spieler) : feld.spieler; 41 | switch (nummer) 42 | { 43 | case 0: farbe = 183; break; // rot 44 | case 1: farbe = 97; break; // blau 45 | case 2: farbe = 71; break; // gelb 46 | case 3: farbe = 7; break; // grau 47 | case 6: farbe = 2; break; // Eingeborene 48 | case 7: farbe = 182; break; // frei 49 | } 50 | // FIXME: Ineffizient! Zu viele Divisionen 51 | if (!(feld.bebauung >= 1201 && feld.bebauung <= 1221 || feld.bebauung >= 1251 && feld.bebauung <= 1259)) 52 | bs.zeichne_pixel(xpos + (insel->xpos + x) * breite / Welt::KARTENBREITE, ypos + (insel->ypos + y) * hoehe / Welt::KARTENHOEHE, farbe); 53 | } 54 | } 55 | } 56 | 57 | for (Ship& schiff : welt.schiffe) 58 | { 59 | int x = xpos + schiff.x_pos * breite / Welt::KARTENBREITE; 60 | int y = ypos + schiff.y_pos * hoehe / Welt::KARTENHOEHE; 61 | bs.zeichne_rechteck(x, y, x + 1, y + 1, 252); 62 | } 63 | } 64 | 65 | void Karte::zeichne_kameraposition(Bildspeicher& bs, Kamera& kamera) 66 | { 67 | int x00, y00, x01, y01, x10, y10, x11, y11; 68 | 69 | kamera.auf_karte(bs, 0, 0, x00, y00); 70 | kamera.auf_karte(bs, bs.breite, 0, x01, y01); 71 | kamera.auf_karte(bs, 0, bs.hoehe, x10, y10); 72 | kamera.auf_karte(bs, bs.breite, bs.hoehe, x11, y11); 73 | 74 | x00 = xpos + x00 * breite / Welt::KARTENBREITE; 75 | y00 = ypos + y00 * hoehe / Welt::KARTENHOEHE; 76 | x01 = xpos + x01 * breite / Welt::KARTENBREITE; 77 | y01 = ypos + y01 * hoehe / Welt::KARTENHOEHE; 78 | x10 = xpos + x10 * breite / Welt::KARTENBREITE; 79 | y10 = ypos + y10 * hoehe / Welt::KARTENHOEHE; 80 | x11 = xpos + x11 * breite / Welt::KARTENBREITE; 81 | y11 = ypos + y11 * hoehe / Welt::KARTENHOEHE; 82 | 83 | bs.zeichne_linie(x00, y00 + 1, x01, y01 + 1, 252, 0x33); 84 | bs.zeichne_linie(x01, y01 + 1, x11, y11 + 1, 252, 0x33); 85 | bs.zeichne_linie(x00, y00 + 1, x10, y10 + 1, 252, 0x33); 86 | bs.zeichne_linie(x10, y10 + 1, x11, y11 + 1, 252, 0x33); 87 | 88 | bs.zeichne_linie(x00, y00, x01, y01, 255, 0x33); 89 | bs.zeichne_linie(x01, y01, x11, y11, 255, 0x33); 90 | bs.zeichne_linie(x00, y00, x10, y10, 255, 0x33); 91 | bs.zeichne_linie(x10, y10, x11, y11, 255, 0x33); 92 | } 93 | -------------------------------------------------------------------------------- /src/bshdump.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "bsh_leser.hpp" 24 | #include "bildspeicher_rgb24.hpp" 25 | #include "bildspeicher_pal8.hpp" 26 | 27 | namespace po = boost::program_options; 28 | 29 | int main(int argc, char** argv) 30 | { 31 | std::string input_name; 32 | std::string file_format; 33 | std::string prefix; 34 | int color; 35 | int bpp; 36 | 37 | // clang-format off 38 | po::options_description desc("Zulässige Optionen"); 39 | desc.add_options() 40 | ("input,i", po::value(&input_name), "Eingabedatei (*.bsh)") 41 | ("format,f", po::value(&file_format)->default_value("pnm"), "Format (bmp oder pnm)") 42 | ("bpp,b", po::value(&bpp)->default_value(24), "Bits pro Pixel (8 oder 24)") 43 | ("prefix,p", po::value(&prefix)->default_value("g_"), "Präfix (inklusive Pfad) für die Zieldateinamen") 44 | ("color,c", po::value(&color)->default_value(0), "Hintergrundfarbe für transparente Bereiche") 45 | ("help,h", "Gibt diesen Hilfetext aus") 46 | ; 47 | // clang-format on 48 | 49 | po::variables_map vm; 50 | po::store(po::parse_command_line(argc, argv, desc), vm); 51 | po::notify(vm); 52 | 53 | if (vm.count("help")) 54 | { 55 | std::cout << desc << std::endl; 56 | exit(EXIT_SUCCESS); 57 | } 58 | 59 | if (vm.count("input") != 1) 60 | { 61 | std::cout << "Keine Eingabedatei angegeben" << std::endl; 62 | exit(EXIT_FAILURE); 63 | } 64 | 65 | if (bpp != 8 && bpp != 24) 66 | { 67 | std::cout << "Ungültige Angabe für die Anzahl an Bits pro Pixel" << std::endl; 68 | exit(EXIT_FAILURE); 69 | } 70 | 71 | if (file_format != "bmp" && file_format != "pnm") 72 | { 73 | std::cout << "Gültige Werte für --format sind bmp und pnm" << std::endl; 74 | exit(EXIT_FAILURE); 75 | } 76 | 77 | Bsh_leser bsh(input_name); 78 | if (bpp == 24) 79 | { 80 | for (uint32_t i = 0; i < bsh.anzahl(); i++) 81 | { 82 | Bsh_bild& bild = bsh.gib_bsh_bild(i); 83 | Bildspeicher_rgb24 bs(bild.breite, bild.hoehe, color); 84 | bs.bild_loeschen(); 85 | bs.zeichne_bsh_bild(bild, 0, 0); 86 | 87 | if (file_format == "pnm") 88 | bs.exportiere_pnm((prefix + boost::str(boost::format("%04d.ppm") % i)).c_str()); 89 | else if (file_format == "bmp") 90 | bs.exportiere_bmp((prefix + boost::str(boost::format("%04d.bmp") % i)).c_str()); 91 | } 92 | } 93 | else if (bpp == 8) 94 | { 95 | for (uint32_t i = 0; i < bsh.anzahl(); i++) 96 | { 97 | Bsh_bild& bild = bsh.gib_bsh_bild(i); 98 | Bildspeicher_pal8 bs(bild.breite, bild.hoehe, color); 99 | bs.bild_loeschen(); 100 | bs.zeichne_bsh_bild(bild, 0, 0); 101 | 102 | if (file_format == "pnm") 103 | bs.exportiere_pnm((prefix + boost::str(boost::format("%04d.pgm") % i)).c_str()); 104 | else if (file_format == "bmp") 105 | bs.exportiere_bmp((prefix + boost::str(boost::format("%04d.bmp") % i)).c_str()); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/bshpacker.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2017 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "bsh_schreiber.hpp" 24 | 25 | namespace po = boost::program_options; 26 | 27 | using namespace std; 28 | 29 | int main(int argc, char** argv) 30 | { 31 | string output_name; 32 | string file_format; 33 | string prefix; 34 | string signature; 35 | int number; 36 | int color; 37 | int bpp; 38 | int extra; 39 | 40 | // clang-format off 41 | po::options_description desc("Zulässige Optionen"); 42 | desc.add_options() 43 | ("output,o", po::value(&output_name), "Zieldatei (*.bsh, *.zei)") 44 | ("signature,s", po::value(&signature)->default_value("BSH"), "Signatur (BSH oder ZEI)") 45 | ("format,f", po::value(&file_format)->default_value("pnm"), "Format (bmp oder pnm)") 46 | ("bpp,b", po::value(&bpp)->default_value(8), "Bits pro Pixel (8 oder 24)") 47 | ("prefix,p", po::value(&prefix)->default_value("g_"), "Präfix (inklusive Pfad) für die Namen der Ausgangsdateien") 48 | ("number,n", po::value(&number)->default_value(1), "Anzahl zu verarbeitenden Bilder (mit Nummern 0 bis n-1)") 49 | ("color,c", po::value(&color)->default_value(0), "Hintergrundfarbe für transparente Bereiche") 50 | ("extra,e", po::value(&extra)->default_value(0), "Extraspalten in den Ausgangsdateien") 51 | ("help,h", "Gibt diesen Hilfetext aus") 52 | ; 53 | // clang-format on 54 | 55 | po::variables_map vm; 56 | po::store(po::parse_command_line(argc, argv, desc), vm); 57 | po::notify(vm); 58 | 59 | if (vm.count("help")) 60 | { 61 | cout << desc << endl; 62 | exit(EXIT_SUCCESS); 63 | } 64 | 65 | if (vm.count("output") != 1) 66 | { 67 | cout << "Keine Zieldatei angegeben" << endl; 68 | exit(EXIT_FAILURE); 69 | } 70 | 71 | if (bpp != 8 && bpp != 24) 72 | { 73 | cout << "Ungültige Angabe für die Anzahl an Bits pro Pixel" << endl; 74 | exit(EXIT_FAILURE); 75 | } 76 | 77 | if (number < 1) 78 | { 79 | cout << "Der Wert für --number muss größer als oder gleich 1 sein" << endl; 80 | exit(EXIT_FAILURE); 81 | } 82 | 83 | if (file_format != "bmp" && file_format != "pnm") 84 | { 85 | cout << "Gültige Werte für --format sind bmp und pnm" << endl; 86 | exit(EXIT_FAILURE); 87 | } 88 | 89 | if (signature != "BSH" && signature != "ZEI") 90 | { 91 | cout << "Gültige Werte für die --signature sind BSH und ZEI" << endl; 92 | exit(EXIT_FAILURE); 93 | } 94 | 95 | Bsh_schreiber bsh(color, extra, signature == "ZEI"); 96 | if (bpp == 24) 97 | { 98 | for (uint32_t i = 0; i < number; i++) 99 | { 100 | // TODO 101 | } 102 | } 103 | else if (bpp == 8) 104 | { 105 | for (uint32_t i = 0; i < number; i++) 106 | { 107 | if (file_format == "pnm") 108 | bsh.pgm_anhaengen((prefix + boost::str(boost::format("%04d.pgm") % i)).c_str()); 109 | // else if (file_format == "bmp") 110 | // bsh.bmp_anhaengen((prefix + boost::str(boost::format("%04d.bmp") % i)).c_str()); 111 | } 112 | } 113 | bsh.datei_schreiben(output_name.c_str()); 114 | } 115 | -------------------------------------------------------------------------------- /src/zeitext.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015-2018 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | 22 | #include "zei_leser.hpp" 23 | #include "bildspeicher_rgb24.hpp" 24 | #include "bildspeicher_pal8.hpp" 25 | 26 | namespace po = boost::program_options; 27 | 28 | using namespace std; 29 | 30 | int main(int argc, char** argv) 31 | { 32 | string input_name; 33 | string file_format; 34 | string output; 35 | string text; 36 | int color; 37 | int bpp; 38 | 39 | // clang-format off 40 | po::options_description desc("Zulässige Optionen"); 41 | desc.add_options() 42 | ("input,i", po::value(&input_name), "Eingabedatei (*.zei)") 43 | ("format,f", po::value(&file_format)->default_value("pnm"), "Format (bmp oder pnm)") 44 | ("bpp,b", po::value(&bpp)->default_value(24), "Bits pro Pixel (8 oder 24)") 45 | ("output,o", po::value(&output), "Name der Ausgabedatei") 46 | ("color,c", po::value(&color)->default_value(128), "Hintergrundfarbe für transparente Bereiche") 47 | ("text,t", po::value(&text), "Text, der Ausgegeben werden soll") 48 | ("help,h", "Gibt diesen Hilfetext aus") 49 | ; 50 | // clang-format on 51 | 52 | po::variables_map vm; 53 | po::store(po::parse_command_line(argc, argv, desc), vm); 54 | po::notify(vm); 55 | 56 | if (vm.count("help")) 57 | { 58 | cout << desc << endl; 59 | exit(EXIT_SUCCESS); 60 | } 61 | 62 | if (vm.count("input") != 1) 63 | { 64 | cout << "Keine Eingabedatei angegeben" << endl; 65 | exit(EXIT_FAILURE); 66 | } 67 | 68 | if (vm.count("output") != 1) 69 | { 70 | cout << "Keine Ausgabedatei angegeben" << endl; 71 | exit(EXIT_FAILURE); 72 | } 73 | 74 | if (bpp != 8 && bpp != 24) 75 | { 76 | cout << "Ungültige Angabe für die Anzahl an Bits pro Pixel" << endl; 77 | exit(EXIT_FAILURE); 78 | } 79 | 80 | if (file_format != "bmp" && file_format != "pnm") 81 | { 82 | cout << "Gültige Werte für --format sind bmp und pnm" << endl; 83 | exit(EXIT_FAILURE); 84 | } 85 | 86 | Zei_leser zei(input_name); 87 | vector zeichen; 88 | int breite = 0; 89 | int hoehe = 0; 90 | for (char c : text) 91 | { 92 | Zei_zeichen& z = zei.gib_bsh_bild(c - ' '); 93 | zeichen.push_back(&z); 94 | breite += z.breite; 95 | if (z.hoehe > hoehe) 96 | hoehe = z.hoehe; 97 | } 98 | int position = 0; 99 | if (bpp == 24) 100 | { 101 | Bildspeicher_rgb24 bs(breite, hoehe, color); 102 | bs.setze_schriftfarbe(255, 0); 103 | bs.bild_loeschen(); 104 | bs.zeichne_string(zei, text, 0, 0); 105 | 106 | if (file_format == "pnm") 107 | bs.exportiere_pnm((output + ".ppm").c_str()); 108 | else if (file_format == "bmp") 109 | bs.exportiere_bmp((output + ".bmp").c_str()); 110 | } 111 | else if (bpp == 8) 112 | { 113 | Bildspeicher_pal8 bs(breite, hoehe, color); 114 | bs.setze_schriftfarbe(255, 0); 115 | bs.bild_loeschen(); 116 | bs.zeichne_string(zei, text, 0, 0); 117 | 118 | if (file_format == "pnm") 119 | bs.exportiere_pnm((output + ".pgm").c_str()); 120 | else if (file_format == "bmp") 121 | bs.exportiere_bmp((output + ".bmp").c_str()); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /doc/bitflags.md: -------------------------------------------------------------------------------- 1 | Bitflags 2 | ======== 3 | 4 | Bits im `flags`-Attribut der `Siedler`-Struktur 5 | ----------------------------------------------- 6 | 7 | Noch einzuordnen sind: 8 | - Gesundheit/Krankheit 9 | - Nahrung 10 | - Alkohol 11 | - Tabakwaren 12 | - Gewürze 13 | - Kleidung 14 | - Kakao 15 | - Schmuck 16 | 17 | Unbekannte benutzte Bits sind: 6, 8, 9, 11, 16, 17, 19 18 | 19 | | Bit | Bedeutung | 20 | |----:|:------------------| 21 | | 0 | | 22 | | 1 | | 23 | | 2 | | 24 | | 3 | | 25 | | 4 | | 26 | | 5 | | 27 | | 6 | | 28 | | 7 | Stoffe | 29 | | 8 | | 30 | | 9 | | 31 | | 10 | | 32 | | 11 | | 33 | | 12 | | 34 | | 13 | | 35 | | 14 | | 36 | | 15 | | 37 | | 16 | | 38 | | 17 | | 39 | | 18 | | 40 | | 19 | | 41 | | 20 | | 42 | | 21 | Zufrieden | 43 | | 22 | Markt | 44 | | 23 | Kirche/Kathedrale | 45 | | 24 | Wirtshaus | 46 | | 25 | Badehaus | 47 | | 26 | Theater | 48 | | 27 | | 49 | | 28 | Schule | 50 | | 29 | Hochschule | 51 | | 30 | Kapelle | 52 | | 31 | Arzt | 53 | 54 | Bits im `modus`-Attribut der `Prodlist`-Struktur 55 | ------------------------------------------------ 56 | 57 | - bit 0 = aktiv 58 | - bit 6 = nicht abholen 59 | 60 | Bits im `fruchtbarkeit`-Attribut der `Insel5`-Struktur 61 | ------------------------------------------------------ 62 | 63 | Die Bits geben an, was zu 100% statt zu 50% wächst. 64 | 65 | | Bit | Bedeutung | 66 | |----:|:----------------| 67 | | 0 | (immer 1) | 68 | | 1 | 100% Tabak | 69 | | 2 | 100% Gewürze | 70 | | 3 | 100% Zuckerrohr | 71 | | 4 | 100% Baumwolle | 72 | | 5 | 100% Wein | 73 | | 6 | 100% Kakao | 74 | | 7 | (immer 1) | 75 | 76 | Bits im `freigeschaltet`-Attribut der `Player`-Struktur 77 | ------------------------------------------------------- 78 | 79 | Ein gesetztes Bit bedeutet, dass die entsprechenden Gebäude gebaut werden können. 80 | 81 | | Bit | Bedingung¹ | Bedeutung 82 | |----:|:------------------|:------------------ 83 | | 0 | | (ignoriert) 84 | | 1 | | (ignoriert) 85 | | 2 | 100 Siedler | Schule 86 | | 3 | 50 Siedler | Wirtshaus 87 | | 4 | 150 Bürger | Kirche 88 | | 5 | 210 Bürger | Badehaus 89 | | 6 | 300 Kaufleute | Theater 90 | | 7 | 250 Kaufleute | Hochschule 91 | | 8 | 50 Bürger | Arzt 92 | | 9 | 100 Bürger | Galgen 93 | | 10 | 1500 Aristokraten | Schloss 94 | | 11 | 2500 Aristokraten | Kathedrale 95 | | 12 | | (nichts) 96 | | 13 | | (nichts) 97 | | 14 | 30 Pioniere | Fleischerei, Rinderfarm 98 | | 15 | 15 Siedler | Pflasterstraße, Steinbrücke, Steinbruch, Steinmetz, Feuerwehr 99 | | 16 | 30 Siedler | Palisade, Holztor, Kontor II 100 | | 17 | 40 Siedler | Tabakwarenladen, Rumbrennerei, Weingut, Weinstöcke, Zuckerrohrplantage, Zuckerrohrfeld, Tabakplantage, Tabakfeld, Gewürzplantage, Gewürzfeld 101 | | 18 | 75 Siedler | Windmühle, Bäckerei, Getreidefarm, Getreidefeld 102 | | 19 | 100 Siedler | Werkzeugschmiede 103 | | 20 | 120 Siedler | Erzmine, Werft, Erzschmelze 104 | | 21 | 200 Siedler | kleine Burg, Steinwall, Steintor, Wachturm, Stadttor, Platz I, Schwertschmiede 105 | | 22 | 100 Bürger | Kontor III 106 | | 23 | 150 Bürger | Goldmine 107 | | 24 | 200 Bürger | Schneiderei, Weberei, Baumwollplantage, Baumwollfeld, Kakaoplantage, Kakaofeld 108 | | 25 | | (nichts) 109 | | 26 | 400 Bürger | Kanonengießerei 110 | | 27 | 450 Bürger | tiefe Erzmine 111 | | 28 | 250 Kaufleute | Platz II, Platz III, Zierbaum, Goldschmiede, Kontor IV 112 | | 29 | 400 Kaufleute | große Burg, Musketenbauer 113 | | 30 | 500 Kaufleute | große Werft 114 | | 31 | 600 Aristokraten | Festung 115 | 116 | 1) Quelle: [AnnoWiki 1602](http://1602.annowiki.de/). Die Bedingung muss nur einmal erfüllt gewesen sein. 117 | -------------------------------------------------------------------------------- /src/generischer_bsh_leser.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef GENERISCHER_BSH_LESER_HPP 20 | #define GENERISCHER_BSH_LESER_HPP 21 | 22 | #include 23 | #include 24 | 25 | #include "block.hpp" 26 | 27 | template 28 | struct Generisches_bsh_bild 29 | { 30 | unsigned int breite; 31 | unsigned int hoehe; 32 | unsigned int typ; 33 | unsigned int laenge; 34 | unsigned char puffer[1]; 35 | 36 | enum 37 | { 38 | extraspalten = N 39 | }; 40 | }; 41 | 42 | template 43 | class Generischer_bsh_leser 44 | { 45 | boost::iostreams::mapped_file_source bsh; 46 | uint32_t anzahl_bilder; 47 | uint32_t* bilderindex; 48 | 49 | bool ist_bild_fehlerfrei(uint32_t index) 50 | { 51 | BILD_T& bild = gib_bsh_bild(index); 52 | 53 | if (bild.breite == 0 || bild.hoehe == 0) 54 | return false; 55 | 56 | uint32_t breite = bild.breite + BILD_T::extraspalten; 57 | 58 | uint8_t ch; 59 | int i = 0; 60 | int x = 0; 61 | int y = 0; 62 | 63 | while (i < bild.laenge - 16) 64 | { 65 | ch = bild.puffer[i++]; 66 | 67 | if (ch == 0xff) 68 | { 69 | return true; 70 | } 71 | else if (ch == 0xfe) 72 | { 73 | x = 0; 74 | y++; 75 | if (y == bild.hoehe) 76 | return false; 77 | } 78 | else 79 | { 80 | x += ch; 81 | if (x > breite) 82 | return false; 83 | 84 | if (i >= bild.laenge - 16) 85 | return false; 86 | ch = bild.puffer[i++]; 87 | 88 | x += ch; 89 | if (x > breite) 90 | return false; 91 | i += ch; 92 | if (i > bild.laenge - 16) 93 | return false; 94 | } 95 | } 96 | return false; 97 | } 98 | 99 | protected: 100 | Generischer_bsh_leser(std::string pfadname, std::string signatur) 101 | { 102 | bsh = boost::iostreams::mapped_file_source(pfadname); 103 | 104 | // Ist die Datei groß genug für einen BSH-Header? 105 | if (bsh.size() < 20) 106 | throw std::range_error("bsh header too small"); 107 | 108 | Block* bsh_header = (Block*)bsh.data(); 109 | 110 | // Trägt der Header die Kennung "BSH"? 111 | if (strcmp(bsh_header->kennung, signatur.substr(0, 15).c_str()) != 0) 112 | throw std::invalid_argument("not a bsh file"); 113 | 114 | // Ist die Datei groß genug? 115 | if (bsh.size() < bsh_header->laenge + 20) 116 | throw std::range_error("bsh structure exceeds end of file"); 117 | 118 | // Enthält die Datei überhaupt Bilder? 119 | if (bsh_header->laenge < 4) 120 | { 121 | anzahl_bilder = 0; 122 | return; 123 | } 124 | 125 | bilderindex = (uint32_t*)(bsh.data() + 20); 126 | anzahl_bilder = bilderindex[0] / 4; 127 | 128 | // prüfe, ob der Indexblock groß genug ist 129 | if (bsh.size() < anzahl_bilder * 4 + 20) 130 | throw std::range_error("bsh index block exceeds end of file"); 131 | 132 | // Der erste Indexeintrag gibt indirekt die Größe des Index an. 133 | for (uint32_t i = 1; i < anzahl_bilder; i++) 134 | { 135 | if (bilderindex[i] < bilderindex[0]) 136 | throw std::logic_error("bsh: first index entry does not have smallest offset"); 137 | } 138 | 139 | // Liegen alle Bilder innerhalb der Datei? 140 | const char* ptr = bsh.data(); 141 | for (uint32_t i = 0; i < anzahl_bilder; i++) 142 | { 143 | uint32_t offs = bilderindex[i] + 20; 144 | if (offs + 16 > bsh.size() || offs + ((BILD_T*)(ptr + offs))->laenge > bsh.size()) 145 | throw std::range_error("picture exceeds end of file"); 146 | } 147 | 148 | // prüfe Integrität der einzelnen Bilder 149 | for (uint32_t i = 0; i < anzahl_bilder; i++) 150 | { 151 | if (!ist_bild_fehlerfrei(i)) 152 | throw std::logic_error("picture bytestream contains errors"); 153 | } 154 | } 155 | 156 | public: 157 | BILD_T& gib_bsh_bild(uint32_t index) 158 | { 159 | if (index >= anzahl_bilder) 160 | throw std::range_error("index out of range"); 161 | const char* ptr = bsh.data(); 162 | uint32_t offs = bilderindex[index] + 20; 163 | return *((BILD_T*)(ptr + offs)); 164 | } 165 | 166 | uint32_t anzahl() { return anzahl_bilder; } 167 | }; 168 | 169 | 170 | #endif 171 | -------------------------------------------------------------------------------- /src/files.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2019 Armin Schlegel 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "files.hpp" 25 | 26 | Files* Files::_instance = 0; 27 | 28 | Files* Files::instance() 29 | { 30 | return _instance; 31 | } 32 | 33 | Files* Files::create_instance(std::string path) 34 | { 35 | static CGuard g; 36 | if (!_instance) 37 | { 38 | _instance = new Files(path); 39 | } 40 | return _instance; 41 | } 42 | 43 | void Files::init() 44 | { 45 | // Defaults to current location 46 | init("."); 47 | } 48 | 49 | void Files::init(std::string path) 50 | { 51 | files = { 52 | {"sgfx/effekte.bsh", "sgfx/effekte.bsh"}, 53 | 54 | {"mgfx/effekte.bsh", "mgfx/effekte.bsh"}, 55 | 56 | {"gfx/effekte.bsh", "gfx/effekte.bsh"}, 57 | 58 | {"sgfx/ship.bsh", "sgfx/ship.bsh"}, 59 | 60 | {"mgfx/ship.bsh", "mgfx/ship.bsh"}, 61 | 62 | {"gfx/ship.bsh", "gfx/ship.bsh"}, 63 | 64 | {"sgfx/soldat.bsh", "sgfx/soldat.bsh"}, 65 | 66 | {"mgfx/soldat.bsh", "mgfx/soldat.bsh"}, 67 | 68 | {"gfx/soldat.bsh", "gfx/soldat.bsh"}, 69 | 70 | {"sgfx/stadtfld.bsh", "sgfx/stadtfld.bsh"}, 71 | 72 | {"mgfx/stadtfld.bsh", "mgfx/stadtfld.bsh"}, 73 | 74 | {"gfx/stadtfld.bsh", "gfx/stadtfld.bsh"}, 75 | 76 | {"toolgfx/zeig16g_zei", "toolgfx/zei16g.zei"}, 77 | 78 | {"grafiken.txt", "grafiken.txt"}, 79 | 80 | {"bebauung.txt", "bebauung.txt"}, 81 | 82 | // those are not used at the moment 83 | // {"sgfx/numbers.bsh", "sgfx/numbers.bsh"}, 84 | // {"mgfx/numbers.bsh", "mgfx/numbers.bsh"}, 85 | // {"gfx/numbers.bsh", "gfx/numbers.bsh"}, 86 | 87 | // {"sgfx/tiere.bsh", "sgfx/tiere.bsh"}, 88 | // {"mgfx/tiere.bsh", "mgfx/tiere.bsh"}, 89 | // {"gfx/tiere.bsh", "gfx/tiere.bsh"}, 90 | 91 | // {"sgfx/traeger.bsh", "sgfx/traeger.bsh"}, 92 | // {"mgfx/traeger.bsh", "mgfx/traeger.bsh"}, 93 | // {"gfx/traeger.bsh", "gfx/traeger.bsh"}, 94 | 95 | // {"sgfx/maeher.bsh", "sgfx/maeher.bsh"}, 96 | // {"mgfx/maeher.bsh", "mgfx/maeher.bsh"}, 97 | // {"gfx/maeher.bsh", "gfx/maeher.bsh"}, 98 | }; 99 | tree = get_directory_tree(path); 100 | files = create_file_map(path, files); 101 | } 102 | 103 | bool Files::check_file(const std::string& filename) 104 | { 105 | std::ifstream f(filename.c_str()); 106 | return f.good(); 107 | } 108 | 109 | bool Files::check_all_files() 110 | { 111 | bool failed = false; 112 | for (auto const& f : files) 113 | { 114 | std::cout << "[INFO] Checking for file: " << f.second << std::endl; 115 | if (check_file(f.second) == false) 116 | { 117 | failed = true; 118 | std::cout << "[ERR] File not found: " << f.second << std::endl; 119 | } 120 | } 121 | if (failed == true) 122 | { 123 | return false; 124 | } 125 | return true; 126 | } 127 | 128 | std::string Files::find_path_for_file(std::string file) 129 | { 130 | // Search for the file as substring in the lowercased directory tree 131 | std::cout << "[INFO] Searching path for file: " << file << std::endl; 132 | for (auto t : tree) 133 | { 134 | std::string tree_file = string_to_lower_case(t); 135 | if (tree_file.find(boost::filesystem::path::preferred_separator + file) != std::string::npos) 136 | { 137 | std::cout << "[INFO] Path found [" << file << "]: " << t << std::endl; 138 | return t; 139 | } 140 | } 141 | return file; 142 | } 143 | 144 | std::map Files::create_file_map(const std::string& path, std::map map) 145 | { 146 | std::map modified_map = map; 147 | 148 | for (auto e : map) 149 | { 150 | modified_map[e.first] = find_path_for_file(e.second); 151 | } 152 | return modified_map; 153 | } 154 | 155 | std::string Files::get_file(std::string key) 156 | { 157 | std::cout << "Loading: files[" << key << "]: " << files[key] << std::endl; 158 | return files[key]; 159 | } 160 | 161 | std::string Files::string_to_lower_case(const std::string& str) 162 | { 163 | std::locale loc; 164 | std::string modified_str = str; 165 | 166 | for (auto& c : modified_str) 167 | { 168 | c = std::tolower(c); 169 | } 170 | return modified_str; 171 | } 172 | 173 | std::vector Files::get_directory_tree(const std::string& path) 174 | { 175 | std::vector tree; 176 | boost::filesystem::symlink_option options = boost::filesystem::symlink_option::recurse; 177 | for (auto& p : boost::filesystem::recursive_directory_iterator(path, options)) 178 | { 179 | tree.push_back(p.path().string()); 180 | } 181 | return tree; 182 | } 183 | -------------------------------------------------------------------------------- /src/bildspeicher_rgb24.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include "bildspeicher_rgb24.hpp" 22 | #include "palette.hpp" 23 | 24 | Bildspeicher_rgb24::Bildspeicher_rgb24(uint32_t breite, uint32_t hoehe, uint32_t farbe, uint8_t* puffer, uint32_t pufferbreite) 25 | : Bildspeicher(breite, hoehe, 3, farbe, puffer, pufferbreite) 26 | { 27 | // leer 28 | } 29 | 30 | void Bildspeicher_rgb24::zeichne_bsh_bild_ganz(Bsh_bild& bild, int x, int y) 31 | { 32 | uint8_t ch; 33 | uint8_t* quelle = bild.puffer; 34 | uint8_t* zielzeile; 35 | uint8_t* ziel; 36 | 37 | ziel = zielzeile = this->puffer + y * this->pufferbreite + x * 3; 38 | int restbreite = this->pufferbreite; 39 | 40 | while ((ch = *(quelle++)) != 0xff) 41 | { 42 | if (ch == 0xfe) 43 | { 44 | ziel = zielzeile += restbreite; 45 | } 46 | else 47 | { 48 | ziel += ((int)ch) * 3; 49 | 50 | for (ch = *(quelle++); ch > 0; ch--) 51 | { 52 | int index = ((int)*(quelle++)) * 3; 53 | *(ziel++) = palette[index++]; 54 | *(ziel++) = palette[index++]; 55 | *(ziel++) = palette[index]; 56 | } 57 | } 58 | } 59 | } 60 | 61 | void Bildspeicher_rgb24::zeichne_bsh_bild_partiell(Bsh_bild& bild, int x, int y) 62 | { 63 | int u = 0; 64 | int v = 0; 65 | int i = 0; 66 | unsigned char ch; 67 | 68 | while ((ch = bild.puffer[i++]) != 0xff) 69 | { 70 | if (ch == 0xfe) 71 | { 72 | u = 0; 73 | v++; 74 | } 75 | else 76 | { 77 | u += ch; 78 | 79 | for (ch = bild.puffer[i++]; ch > 0; ch--, u++, i++) 80 | { 81 | if (y + v >= 0 && y + v < this->hoehe && x + u >= 0 && x + u < this->breite) 82 | { 83 | unsigned char a = bild.puffer[i]; 84 | this->puffer[(y + v) * this->pufferbreite + (x + u) * 3] = palette[a * 3]; 85 | this->puffer[(y + v) * this->pufferbreite + (x + u) * 3 + 1] = palette[a * 3 + 1]; 86 | this->puffer[(y + v) * this->pufferbreite + (x + u) * 3 + 2] = palette[a * 3 + 2]; 87 | } 88 | } 89 | } 90 | } 91 | } 92 | 93 | void Bildspeicher_rgb24::zeichne_bsh_bild(Bsh_bild& bild, int x, int y) 94 | { 95 | if (x >= (int)this->breite || y >= (int)this->hoehe || x + (int)bild.breite < 0 || y + (int)bild.hoehe < 0) 96 | return; 97 | if ((x < 0) || (y < 0) || (x + (int)bild.breite > (int)this->breite) || (y + (int)bild.hoehe > (int)this->hoehe)) 98 | zeichne_bsh_bild_partiell(bild, x, y); 99 | else 100 | zeichne_bsh_bild_ganz(bild, x, y); 101 | } 102 | 103 | void Bildspeicher_rgb24::zeichne_pixel(int x, int y, uint8_t farbe) 104 | { 105 | if (x < 0 || y < 0 || x >= breite || y >= hoehe) 106 | return; 107 | puffer[y * pufferbreite + 3 * x] = palette[3 * farbe]; 108 | puffer[y * pufferbreite + 3 * x + 1] = palette[3 * farbe + 1]; 109 | puffer[y * pufferbreite + 3 * x + 2] = palette[3 * farbe + 2]; 110 | } 111 | 112 | void Bildspeicher_rgb24::exportiere_pnm(const char* pfadname) 113 | { 114 | std::ofstream pnm; 115 | pnm.open(pfadname, std::ios_base::out | std::ios_base::binary); 116 | pnm << "P6\n" << breite << " " << hoehe << "\n255\n"; 117 | pnm.write((char*)puffer, breite * hoehe * format); 118 | pnm.close(); 119 | } 120 | 121 | void Bildspeicher_rgb24::exportiere_bmp(const char* pfadname) 122 | { 123 | uint32_t bytes_pro_zeile = (breite * 3 + 3) & 0xfffffffc; 124 | struct tagBITMAPFILEHEADER 125 | { 126 | uint16_t bfType; 127 | uint32_t bfSize; 128 | uint16_t bfReserved1; 129 | uint16_t bfReserved2; 130 | uint32_t bfOffBits; 131 | } __attribute__((packed)) bmfh = {19778, bytes_pro_zeile * hoehe + 54, 0, 0, 54}; 132 | struct tagBITMAPINFOHEADER 133 | { 134 | uint32_t biSize; 135 | int32_t biWidth; 136 | int32_t biHeight; 137 | uint16_t biPlanes; 138 | uint16_t biBitCount; 139 | uint32_t biCompression; 140 | uint32_t biSizeImage; 141 | int32_t biXPelsPerMeter; 142 | int32_t biYPelsPerMeter; 143 | uint32_t biClrUsed; 144 | uint32_t biClrImportant; 145 | } __attribute__((packed)) bmih = {40, (int32_t)breite, (int32_t)hoehe, 1, 24, 0, 0, 0, 0, 0, 0}; 146 | 147 | std::ofstream bmp; 148 | bmp.open(pfadname, std::ios_base::out | std::ios_base::binary); 149 | bmp.write((char*)&bmfh, sizeof(struct tagBITMAPFILEHEADER)); 150 | bmp.write((char*)&bmih, sizeof(struct tagBITMAPINFOHEADER)); 151 | 152 | uint8_t* zeile = new uint8_t[bytes_pro_zeile]; 153 | for (int i = hoehe - 1; i >= 0; i--) 154 | { 155 | for (int x = 0; x < breite; x++) 156 | { 157 | zeile[x * 3] = puffer[breite * 3 * i + x * 3 + 2]; 158 | zeile[x * 3 + 1] = puffer[breite * 3 * i + x * 3 + 1]; 159 | zeile[x * 3 + 2] = puffer[breite * 3 * i + x * 3]; 160 | } 161 | bmp.write((char*)zeile, bytes_pro_zeile); 162 | } 163 | delete[] zeile; 164 | 165 | bmp.close(); 166 | } 167 | 168 | void Bildspeicher_rgb24::bild_loeschen() 169 | { 170 | for (int i = 0; i < breite * hoehe * 3; i += 3) 171 | { 172 | puffer[i] = farbe; 173 | puffer[i + 1] = farbe >> 8; 174 | puffer[i + 2] = farbe >> 16; 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /src/bildspeicher.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "bildspeicher.hpp" 20 | 21 | Bildspeicher::Bildspeicher(uint32_t breite, uint32_t hoehe, uint32_t format, uint32_t farbe, uint8_t* puffer, uint32_t pufferbreite) 22 | { 23 | this->breite = breite; 24 | this->hoehe = hoehe; 25 | this->format = format; 26 | this->farbe = farbe; 27 | this->pufferbreite = (pufferbreite >= breite * format) ? pufferbreite : (breite * format); 28 | if (puffer == NULL) 29 | { 30 | this->puffer = new uint8_t[this->pufferbreite * hoehe]; 31 | puffer_freigeben = 1; 32 | } 33 | else 34 | { 35 | this->puffer = puffer; 36 | puffer_freigeben = 0; 37 | } 38 | // memset 39 | 40 | // initialisiere die Indextabelle, in der an Positionen 1 und 7 die Schrift- bzw. Schattenfarbe erwartet wird 41 | for (int i = 0; i < 256; i++) 42 | indextabelle_schriftfarbe[i] = i; 43 | } 44 | 45 | Bildspeicher::~Bildspeicher() 46 | { 47 | if (puffer_freigeben) 48 | delete puffer; 49 | } 50 | 51 | void Bildspeicher::zeichne_bsh_bild(Bsh_bild& bild, int x, int y) 52 | { 53 | // in einer Unterklasse implementiert 54 | } 55 | 56 | void Bildspeicher::zeichne_bsh_bild_oz(Bsh_bild& bild, int x, int y) 57 | { 58 | zeichne_bsh_bild(bild, x - bild.breite / 2, y - bild.hoehe); 59 | } 60 | 61 | void Bildspeicher::zeichne_bsh_bild_sp(Bsh_bild& bild, int x, int y, int sx, int sy, bool& schnitt) 62 | { 63 | schnitt = false; 64 | sx -= x; 65 | sy -= y; 66 | 67 | if (sx < 0 || sy < 0 || sx >= bild.breite || sy >= bild.hoehe) 68 | { 69 | zeichne_bsh_bild(bild, x, y); 70 | } 71 | else 72 | { 73 | int u = 0; 74 | int v = 0; 75 | int i = 0; 76 | unsigned char ch; 77 | 78 | while ((ch = bild.puffer[i++]) != 0xff) 79 | { 80 | if (ch == 0xfe) 81 | { 82 | u = 0; 83 | v++; 84 | } 85 | else 86 | { 87 | u += ch; 88 | 89 | for (ch = bild.puffer[i++]; ch > 0; ch--, u++, i++) 90 | { 91 | zeichne_pixel(x + u, y + v, bild.puffer[i]); 92 | if (u == sx && v == sy) 93 | schnitt = true; 94 | } 95 | } 96 | } 97 | } 98 | } 99 | 100 | void Bildspeicher::zeichne_bsh_bild_sp_oz(Bsh_bild& bild, int x, int y, int sx, int sy, bool& schnitt) 101 | { 102 | zeichne_bsh_bild_sp(bild, x - bild.breite / 2, y - bild.hoehe, sx, sy, schnitt); 103 | } 104 | 105 | void Bildspeicher::zeichne_rechteck(int x1, int y1, int x2, int y2, uint8_t farbe) 106 | { 107 | if (x1 < 0) 108 | x1 = 0; 109 | if (y1 < 0) 110 | y1 = 0; 111 | if (x2 >= breite) 112 | x2 = breite - 1; 113 | if (y2 >= hoehe) 114 | y2 = hoehe - 1; 115 | 116 | for (int y = y1; y <= y2; y++) 117 | { 118 | for (int x = x1; x <= x2; x++) 119 | { 120 | zeichne_pixel(x, y, farbe); 121 | } 122 | } 123 | } 124 | 125 | void Bildspeicher::zeichne_linie(int x1, int y1, int x2, int y2, uint8_t farbe, uint8_t muster) 126 | { 127 | int xdiff = abs(x2 - x1); 128 | int ydiff = abs(y2 - y1); 129 | 130 | int ix = (x2 > x1) - (x2 < x1); 131 | int iy = (y2 > y1) - (y2 < y1); 132 | 133 | int cx = x1; 134 | int cy = y1; 135 | 136 | if (xdiff >= ydiff) 137 | { 138 | int s = xdiff >> 1; 139 | do 140 | { 141 | if ((muster = muster >> 1 | muster << 7) & 0x80) 142 | zeichne_pixel(cx, cy, farbe); 143 | cx += ix; 144 | s -= ydiff; 145 | if (s <= 0) 146 | { 147 | s += xdiff; 148 | cy += iy; 149 | } 150 | } while (cx != x2); 151 | } 152 | else 153 | { 154 | int s = ydiff >> 1; 155 | do 156 | { 157 | if ((muster = muster >> 1 | muster << 7) & 0x80) 158 | zeichne_pixel(cx, cy, farbe); 159 | cy += iy; 160 | s -= xdiff; 161 | if (s <= 0) 162 | { 163 | s += ydiff; 164 | cx += ix; 165 | } 166 | } while (cy != y2); 167 | } 168 | 169 | if ((muster = muster >> 1 | muster << 7) & 0x80) 170 | zeichne_pixel(x2, y2, farbe); 171 | } 172 | 173 | void Bildspeicher::zeichne_zei_zeichen(Zei_zeichen& zeichen, int x, int y) 174 | { 175 | int u = 0; 176 | int v = 0; 177 | int i = 0; 178 | unsigned char ch; 179 | 180 | while ((ch = zeichen.puffer[i++]) != 0xff) 181 | { 182 | if (ch == 0xfe) 183 | { 184 | u = 0; 185 | v++; 186 | } 187 | else 188 | { 189 | u += ch; 190 | 191 | for (ch = zeichen.puffer[i++]; ch > 0; ch--, u++, i++) 192 | { 193 | zeichne_pixel(x + u, y + v, indextabelle_schriftfarbe[zeichen.puffer[i]]); 194 | } 195 | } 196 | } 197 | } 198 | 199 | void Bildspeicher::zeichne_string(Zei_leser& zei_leser, std::string s, int x, int y) 200 | { 201 | for (char ch : s) 202 | { 203 | if (ch - ' ' < 0 || ch - ' ' >= zei_leser.anzahl()) 204 | continue; 205 | Zei_zeichen& zz = zei_leser.gib_bsh_bild(ch - ' '); 206 | zeichne_zei_zeichen(zz, x, y); 207 | x += zz.breite; 208 | } 209 | } 210 | 211 | void Bildspeicher::setze_schriftfarbe(uint8_t schrift, uint8_t schatten) 212 | { 213 | indextabelle_schriftfarbe[1] = schrift; 214 | indextabelle_schriftfarbe[7] = schatten; 215 | } 216 | 217 | void Bildspeicher::exportiere_pnm(const char* pfadname) 218 | { 219 | // in einer Unterklasse implementiert 220 | } 221 | 222 | void Bildspeicher::exportiere_bmp(const char* pfadname) 223 | { 224 | // in einer Unterklasse implementiert 225 | } 226 | 227 | void Bildspeicher::bild_loeschen() 228 | { 229 | // in einer Unterklasse implementiert 230 | } 231 | -------------------------------------------------------------------------------- /src/sdltest.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "palette.hpp" 27 | #include "kamera.hpp" 28 | #include "bildspeicher_pal8.hpp" 29 | #include "spielbildschirm.hpp" 30 | #include "files.hpp" 31 | 32 | namespace po = boost::program_options; 33 | 34 | Uint32 timer_callback(Uint32 interval, void* param) 35 | { 36 | SDL_Event event; 37 | SDL_UserEvent userevent; 38 | 39 | // push an SDL_USEREVENT event into the queue 40 | 41 | userevent.type = SDL_USEREVENT; 42 | userevent.code = 0; 43 | userevent.data1 = NULL; 44 | userevent.data2 = NULL; 45 | 46 | event.type = SDL_USEREVENT; 47 | event.user = userevent; 48 | 49 | SDL_PushEvent(&event); 50 | return (interval); 51 | } 52 | 53 | int main(int argc, char** argv) 54 | { 55 | int screen_width; 56 | int screen_height; 57 | bool fullscreen; 58 | int rate; 59 | std::string gam_name; 60 | std::string files_path; 61 | 62 | // clang-format off 63 | po::options_description desc("Zulässige Optionen"); 64 | desc.add_options() 65 | ("width,W", po::value(&screen_width)->default_value(800), "Bildschirmbreite") 66 | ("height,H", po::value(&screen_height)->default_value(600), "Bildschirmhöhe") 67 | ("fullscreen,F", po::value(&fullscreen)->default_value(false), "Vollbildmodus (true/false)") 68 | ("rate,r", po::value(&rate)->default_value(10), "Bildrate") 69 | ("load,l", po::value(&gam_name)->default_value("game00.gam"), "Lädt den angegebenen Spielstand (*.gam)") 70 | ("path,p", po::value(&files_path)->default_value("."), "Pfad zur ANNO1602-Installation") 71 | ("help,h", "Gibt diesen Hilfetext aus") 72 | ; 73 | // clang-format on 74 | 75 | po::variables_map vm; 76 | po::store(po::parse_command_line(argc, argv, desc), vm); 77 | po::notify(vm); 78 | 79 | if (vm.count("help")) 80 | { 81 | std::cout << desc << std::endl; 82 | exit(EXIT_SUCCESS); 83 | } 84 | 85 | auto files = Files::create_instance(files_path); 86 | 87 | if (files->instance()->check_file(gam_name) == false) 88 | { 89 | std::cout << "[ERR] Could not load savegame: " << gam_name << std::endl; 90 | exit(EXIT_FAILURE); 91 | } 92 | 93 | if (files->instance()->check_all_files() == false) 94 | { 95 | exit(EXIT_FAILURE); 96 | } 97 | 98 | if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) 99 | { 100 | exit(EXIT_FAILURE); 101 | } 102 | atexit(SDL_Quit); 103 | 104 | SDL_Surface* screen; 105 | screen = SDL_SetVideoMode(screen_width, screen_height, 8, SDL_SWSURFACE | (fullscreen ? SDL_FULLSCREEN : 0)); 106 | 107 | SDL_Color colors[256]; 108 | int i, j; 109 | for (i = 0, j = 0; i < 256; i++) 110 | { 111 | colors[i].r = palette[j++]; 112 | colors[i].g = palette[j++]; 113 | colors[i].b = palette[j++]; 114 | } 115 | SDL_SetPalette(screen, SDL_LOGPAL | SDL_PHYSPAL, colors, 0, 256); 116 | 117 | 118 | std::ifstream f; 119 | f.open(gam_name, std::ios_base::in | std::ios_base::binary); 120 | 121 | Welt welt = Welt(f); 122 | 123 | f.close(); 124 | 125 | Bildspeicher_pal8 bs(screen_width, screen_height, 0, (uint8_t*)screen->pixels, screen->pitch); 126 | 127 | Spielbildschirm spielbildschirm(bs); 128 | spielbildschirm.zeichne_bild(welt, 0, 0); 129 | 130 | SDL_UpdateRect(screen, 0, 0, screen_width, screen_height); 131 | 132 | 133 | if (rate != 0) 134 | { 135 | SDL_TimerID timer_id = SDL_AddTimer(1000 / rate, timer_callback, NULL); 136 | } 137 | Uint8* keystate = SDL_GetKeyState(NULL); 138 | 139 | SDL_Event e; 140 | while (1) 141 | { 142 | SDL_WaitEvent(&e); 143 | switch (e.type) 144 | { 145 | case SDL_QUIT: exit(EXIT_SUCCESS); break; 146 | case SDL_USEREVENT: 147 | int x, y; 148 | SDL_GetMouseState(&x, &y); 149 | 150 | if (keystate[SDLK_LEFT] || (fullscreen && x == 0)) 151 | { 152 | spielbildschirm.kamera.nach_links(); 153 | } 154 | if (keystate[SDLK_RIGHT] || (fullscreen && x == screen_width - 1)) 155 | { 156 | spielbildschirm.kamera.nach_rechts(); 157 | } 158 | if (keystate[SDLK_UP] || (fullscreen && y == 0)) 159 | { 160 | spielbildschirm.kamera.nach_oben(); 161 | } 162 | if (keystate[SDLK_DOWN] || (fullscreen && y == screen_height - 1)) 163 | { 164 | spielbildschirm.kamera.nach_unten(); 165 | } 166 | 167 | welt.simulationsschritt(); 168 | spielbildschirm.zeichne_bild(welt, x, y); 169 | SDL_UpdateRect(screen, 0, 0, screen_width, screen_height); 170 | break; 171 | case SDL_KEYDOWN: 172 | if (e.key.keysym.sym == SDLK_F2) 173 | { 174 | spielbildschirm.kamera.setze_vergroesserung(0); 175 | } 176 | if (e.key.keysym.sym == SDLK_F3) 177 | { 178 | spielbildschirm.kamera.setze_vergroesserung(1); 179 | } 180 | if (e.key.keysym.sym == SDLK_F4) 181 | { 182 | spielbildschirm.kamera.setze_vergroesserung(2); 183 | } 184 | if (e.key.keysym.sym == SDLK_x) 185 | { 186 | spielbildschirm.kamera.rechts_drehen(); 187 | } 188 | if (e.key.keysym.sym == SDLK_y) 189 | { 190 | spielbildschirm.kamera.links_drehen(); 191 | } 192 | if (e.key.keysym.sym == SDLK_ESCAPE) 193 | { 194 | exit(EXIT_SUCCESS); 195 | } 196 | break; 197 | } 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /src/palette.hpp: -------------------------------------------------------------------------------- 1 | // clang-format off 2 | const unsigned char palette[768] = 3 | { 4 | 0x00, 0x00, 0x00, 5 | 0x80, 0x00, 0x00, 6 | 0x00, 0x80, 0x00, 7 | 0x80, 0x80, 0x00, 8 | 0x00, 0x00, 0x80, 9 | 0x6d, 0x1f, 0x6c, 10 | 0x00, 0x80, 0x80, 11 | 0xc0, 0xc0, 0xc0, 12 | 0xff, 0x00, 0xff, 13 | 0xff, 0x00, 0xff, 14 | 0x00, 0x00, 0x00, 15 | 0x00, 0x04, 0x04, 16 | 0x00, 0x08, 0x08, 17 | 0x00, 0x10, 0x00, 18 | 0x0b, 0x06, 0x03, 19 | 0x15, 0x08, 0x00, 20 | 0x25, 0x04, 0x00, 21 | 0x00, 0x14, 0x04, 22 | 0x06, 0x16, 0x06, 23 | 0x00, 0x21, 0x00, 24 | 0x03, 0x26, 0x03, 25 | 0x0e, 0x1c, 0x05, 26 | 0x08, 0x31, 0x04, 27 | 0x20, 0x18, 0x00, 28 | 0x1b, 0x2c, 0x00, 29 | 0x0a, 0x0c, 0x12, 30 | 0x08, 0x1c, 0x14, 31 | 0x18, 0x16, 0x10, 32 | 0x23, 0x17, 0x0c, 33 | 0x01, 0x29, 0x15, 34 | 0x0c, 0x2c, 0x13, 35 | 0x18, 0x2b, 0x11, 36 | 0x23, 0x29, 0x0f, 37 | 0x0a, 0x16, 0x25, 38 | 0x0a, 0x2c, 0x25, 39 | 0x24, 0x1f, 0x1f, 40 | 0x22, 0x31, 0x1d, 41 | 0x12, 0x24, 0x2c, 42 | 0x26, 0x2e, 0x29, 43 | 0x13, 0x22, 0x40, 44 | 0x04, 0x3d, 0x06, 45 | 0x10, 0x3b, 0x06, 46 | 0x15, 0x3e, 0x08, 47 | 0x25, 0x3d, 0x04, 48 | 0x0e, 0x3c, 0x28, 49 | 0x21, 0x3b, 0x23, 50 | 0x29, 0x3d, 0x20, 51 | 0x0e, 0x37, 0x40, 52 | 0x18, 0x3d, 0x3d, 53 | 0x21, 0x31, 0x3d, 54 | 0x25, 0x3d, 0x39, 55 | 0x11, 0x3a, 0x48, 56 | 0x29, 0x3d, 0x42, 57 | 0x11, 0x3c, 0x4e, 58 | 0x11, 0x3a, 0x5e, 59 | 0x0d, 0x4d, 0x00, 60 | 0x25, 0x4e, 0x00, 61 | 0x12, 0x4d, 0x08, 62 | 0x17, 0x4d, 0x25, 63 | 0x1c, 0x4d, 0x48, 64 | 0x19, 0x4d, 0x58, 65 | 0x16, 0x49, 0x6e, 66 | 0x11, 0x5f, 0x03, 67 | 0x25, 0x62, 0x00, 68 | 0x16, 0x5d, 0x3d, 69 | 0x16, 0x70, 0x2d, 70 | 0x15, 0x96, 0x24, 71 | 0x19, 0x7c, 0x6b, 72 | 0x1c, 0x94, 0x71, 73 | 0x00, 0x52, 0x8c, 74 | 0x08, 0x4a, 0x90, 75 | 0xf8, 0xc2, 0x30, 76 | 0x08, 0x52, 0x94, 77 | 0x08, 0x56, 0x94, 78 | 0x0c, 0x4e, 0x8c, 79 | 0x17, 0x52, 0x88, 80 | 0x00, 0x63, 0x8c, 81 | 0x18, 0x5e, 0x8c, 82 | 0x08, 0x5a, 0x9c, 83 | 0x0c, 0x5a, 0xa0, 84 | 0x12, 0x63, 0x94, 85 | 0x12, 0x65, 0x94, 86 | 0x0a, 0x75, 0x96, 87 | 0x08, 0x5a, 0xad, 88 | 0x08, 0x63, 0xa9, 89 | 0x0c, 0x67, 0xa5, 90 | 0x15, 0x68, 0xa5, 91 | 0x06, 0x79, 0xad, 92 | 0x13, 0x73, 0xab, 93 | 0x21, 0x73, 0xa5, 94 | 0x0a, 0x76, 0xb5, 95 | 0x18, 0x77, 0xb1, 96 | 0x21, 0x73, 0xad, 97 | 0x21, 0x7b, 0xb1, 98 | 0x18, 0x75, 0xbb, 99 | 0x08, 0x88, 0xbd, 100 | 0x0b, 0x88, 0xc4, 101 | 0x11, 0x88, 0xdc, 102 | 0x21, 0x9c, 0x84, 103 | 0x00, 0x9c, 0x94, 104 | 0x18, 0x9c, 0xb1, 105 | 0x00, 0x9c, 0xd6, 106 | 0x0c, 0x94, 0xce, 107 | 0xc4, 0x78, 0x5e, 108 | 0x0b, 0xad, 0xd8, 109 | 0x08, 0x94, 0xe7, 110 | 0x08, 0x94, 0xef, 111 | 0x0c, 0xa0, 0xe6, 112 | 0x1c, 0x98, 0xe2, 113 | 0x15, 0xb2, 0xe1, 114 | 0x10, 0xb1, 0xef, 115 | 0x18, 0xbd, 0xe7, 116 | 0x21, 0xbd, 0xde, 117 | 0x00, 0x94, 0xf7, 118 | 0x50, 0x96, 0xe2, 119 | 0x00, 0x9c, 0xff, 120 | 0xe0, 0x8a, 0x6c, 121 | 0xf2, 0x99, 0x7a, 122 | 0xe9, 0x71, 0x02, 123 | 0xff, 0x7d, 0x02, 124 | 0x08, 0xa5, 0xf7, 125 | 0xfb, 0xd8, 0x34, 126 | 0xf4, 0xaf, 0x2d, 127 | 0x10, 0x9c, 0xf7, 128 | 0x18, 0x94, 0xef, 129 | 0x14, 0x98, 0xfb, 130 | 0xff, 0xfc, 0x9d, 131 | 0x21, 0xa5, 0xf7, 132 | 0x36, 0x11, 0x04, 133 | 0x4a, 0x11, 0x04, 134 | 0x35, 0x2d, 0x0c, 135 | 0x46, 0x2c, 0x0b, 136 | 0x3c, 0x4a, 0x0b, 137 | 0x29, 0x63, 0x00, 138 | 0x3b, 0x5a, 0x13, 139 | 0x2d, 0x67, 0x00, 140 | 0x2e, 0x70, 0x00, 141 | 0x2d, 0x63, 0x08, 142 | 0x2c, 0x6a, 0x11, 143 | 0x37, 0x6d, 0x02, 144 | 0x37, 0x6a, 0x11, 145 | 0x42, 0x6a, 0x03, 146 | 0x44, 0x6c, 0x10, 147 | 0x3b, 0x2f, 0x26, 148 | 0x3e, 0x44, 0x29, 149 | 0x3b, 0x3d, 0x40, 150 | 0x3d, 0x4a, 0x3f, 151 | 0x3c, 0x61, 0x2d, 152 | 0x41, 0x5b, 0x44, 153 | 0x3f, 0x4d, 0x4b, 154 | 0x3c, 0x63, 0x4b, 155 | 0x31, 0x4c, 0x5a, 156 | 0x3f, 0x4b, 0x55, 157 | 0x2e, 0x62, 0x5a, 158 | 0x41, 0x65, 0x56, 159 | 0x3a, 0x5f, 0x68, 160 | 0x37, 0x62, 0x75, 161 | 0x37, 0x66, 0x8c, 162 | 0x5e, 0x16, 0x05, 163 | 0x59, 0x2a, 0x14, 164 | 0x5a, 0x40, 0x1a, 165 | 0x59, 0x60, 0x0b, 166 | 0x5a, 0x5e, 0x2d, 167 | 0x58, 0x50, 0x46, 168 | 0x57, 0x66, 0x44, 169 | 0x59, 0x4f, 0x50, 170 | 0x55, 0x67, 0x50, 171 | 0x5d, 0x6b, 0x4d, 172 | 0x5a, 0x58, 0x59, 173 | 0x56, 0x6f, 0x5a, 174 | 0x57, 0x63, 0x62, 175 | 0x58, 0x66, 0x75, 176 | 0x73, 0x21, 0x0a, 177 | 0x71, 0x41, 0x14, 178 | 0x6f, 0x5f, 0x11, 179 | 0x6f, 0x52, 0x39, 180 | 0x6c, 0x6f, 0x41, 181 | 0x6f, 0x6b, 0x5a, 182 | 0x6b, 0x68, 0x6b, 183 | 0x8f, 0x1d, 0x04, 184 | 0x89, 0x56, 0x0d, 185 | 0x8c, 0x58, 0x1f, 186 | 0x89, 0x63, 0x40, 187 | 0xac, 0x27, 0x05, 188 | 0xa6, 0x5d, 0x25, 189 | 0xc5, 0x31, 0x08, 190 | 0xcd, 0x54, 0x1e, 191 | 0x29, 0x7e, 0x02, 192 | 0x31, 0x7b, 0x00, 193 | 0x35, 0x7f, 0x00, 194 | 0x42, 0x7b, 0x00, 195 | 0x34, 0x7b, 0x0b, 196 | 0x36, 0x7b, 0x14, 197 | 0x36, 0x7a, 0x49, 198 | 0x31, 0x84, 0x04, 199 | 0x42, 0x84, 0x00, 200 | 0x31, 0x84, 0x14, 201 | 0x40, 0x84, 0x16, 202 | 0x35, 0x8c, 0x00, 203 | 0x35, 0x86, 0x37, 204 | 0x31, 0x8d, 0x32, 205 | 0x31, 0xa7, 0x1d, 206 | 0x53, 0x82, 0x09, 207 | 0x5b, 0x7e, 0x3e, 208 | 0x57, 0x79, 0x6b, 209 | 0x6c, 0x7b, 0x67, 210 | 0x52, 0xab, 0x06, 211 | 0x55, 0x91, 0x2f, 212 | 0x59, 0xb6, 0x29, 213 | 0x77, 0x7e, 0x3c, 214 | 0x77, 0x77, 0x69, 215 | 0x74, 0xb4, 0x30, 216 | 0xaa, 0x80, 0x2a, 217 | 0x91, 0x7d, 0x67, 218 | 0x85, 0xbb, 0x3a, 219 | 0xca, 0xac, 0x34, 220 | 0x2b, 0x85, 0x74, 221 | 0x53, 0x7f, 0x73, 222 | 0x7f, 0x7c, 0x73, 223 | 0x7d, 0x8e, 0x73, 224 | 0x4a, 0x7e, 0x7e, 225 | 0x49, 0x80, 0xa4, 226 | 0x76, 0x84, 0x7b, 227 | 0x76, 0x87, 0x8f, 228 | 0x2b, 0xa0, 0x7c, 229 | 0x5f, 0x9c, 0x84, 230 | 0x2d, 0xb5, 0x88, 231 | 0x3f, 0xc1, 0x8a, 232 | 0x5c, 0xa9, 0xbd, 233 | 0x3f, 0xde, 0xa7, 234 | 0x56, 0xed, 0xc8, 235 | 0x90, 0x89, 0x7b, 236 | 0x8d, 0x99, 0x85, 237 | 0x98, 0x95, 0x7f, 238 | 0xaf, 0x9a, 0x7c, 239 | 0x98, 0xa5, 0x8c, 240 | 0x98, 0xb2, 0x8d, 241 | 0xa9, 0xb0, 0x8c, 242 | 0xcc, 0xc2, 0x85, 243 | 0x9a, 0xb0, 0xad, 244 | 0xb9, 0xb6, 0xa0, 245 | 0xb3, 0xc8, 0xa7, 246 | 0xac, 0xd1, 0xcf, 247 | 0xdd, 0xda, 0xb5, 248 | 0xe1, 0xef, 0xe2, 249 | 0xfe, 0xfa, 0xe6, 250 | 0x00, 0x94, 0xff, 251 | 0xa0, 0xa0, 0xa4, 252 | 0x80, 0x80, 0x80, 253 | 0xff, 0x00, 0x00, 254 | 0x00, 0xff, 0x00, 255 | 0xff, 0xff, 0x00, 256 | 0x00, 0x00, 0xff, 257 | 0xff, 0x00, 0xff, 258 | 0x00, 0xff, 0xff, 259 | 0xff, 0xff, 0xff 260 | }; 261 | -------------------------------------------------------------------------------- /src/bildspeicher_pal8.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | #include "bildspeicher_pal8.hpp" 22 | #include "palette.hpp" 23 | 24 | Bildspeicher_pal8::Bildspeicher_pal8(uint32_t breite, uint32_t hoehe, uint32_t farbe, uint8_t* puffer, uint32_t pufferbreite) 25 | : Bildspeicher(breite, hoehe, 1, farbe, puffer, pufferbreite) 26 | { 27 | // erzeuge Index der Paletteneinträge mit der jeweils halben Helligkeit 28 | for (int i = 0; i < 256; i++) 29 | { 30 | uint8_t r = palette[3 * i] >> 1; 31 | uint8_t g = palette[3 * i + 1] >> 1; 32 | uint8_t b = palette[3 * i + 2] >> 1; 33 | 34 | int mindiff = 0x7fffffff; 35 | for (int j = 0; j < 256; j++) 36 | { 37 | int diff = abs((int)palette[3 * j] - r) + abs((int)palette[3 * j + 1] - g) + abs((int)palette[3 * j + 2] - b); 38 | if (diff < mindiff) 39 | { 40 | dunkel[i] = j; 41 | mindiff = diff; 42 | } 43 | } 44 | } 45 | } 46 | 47 | void Bildspeicher_pal8::zeichne_bsh_bild_ganz(Bsh_bild& bild, int x, int y) 48 | { 49 | uint8_t ch; 50 | uint8_t* quelle = bild.puffer; 51 | uint8_t* zielzeile; 52 | uint8_t* ziel; 53 | 54 | ziel = zielzeile = this->puffer + y * this->pufferbreite + x; 55 | int restbreite = this->pufferbreite; 56 | 57 | while ((ch = *(quelle++)) != 0xff) 58 | { 59 | if (ch == 0xfe) 60 | { 61 | ziel = zielzeile += restbreite; 62 | } 63 | else 64 | { 65 | ziel += ch; 66 | 67 | for (ch = *(quelle++); ch > 0; ch--) 68 | *(ziel++) = *(quelle++); 69 | } 70 | } 71 | } 72 | 73 | void Bildspeicher_pal8::zeichne_bsh_bild_partiell(Bsh_bild& bild, int x, int y) 74 | { 75 | int u = 0; 76 | int v = 0; 77 | int i = 0; 78 | unsigned char ch; 79 | 80 | uint8_t* quelle = bild.puffer; 81 | uint8_t* zielzeile; 82 | uint8_t* ziel = zielzeile = this->puffer + y * (int)this->pufferbreite + x; 83 | int restbreite = this->pufferbreite; 84 | 85 | if (x >= 0 && x + bild.breite < this->breite) 86 | { 87 | uint8_t* anfang = this->puffer; 88 | uint8_t* ende = this->puffer + this->pufferbreite * this->hoehe; 89 | 90 | while (ziel < anfang) 91 | { 92 | ch = *(quelle++); 93 | if (ch == 0xff) 94 | return; 95 | if (ch == 0xfe) 96 | { 97 | ziel = zielzeile += restbreite; 98 | if (ziel >= ende) 99 | return; 100 | } 101 | else 102 | { 103 | ziel += ch; 104 | 105 | ch = *(quelle++); 106 | quelle += ch; 107 | ziel += ch; 108 | } 109 | } 110 | while ((ch = *(quelle++)) != 0xff) 111 | { 112 | if (ch == 0xfe) 113 | { 114 | ziel = zielzeile += restbreite; 115 | if (ziel >= ende) 116 | return; 117 | } 118 | else 119 | { 120 | ziel += ch; 121 | 122 | for (ch = *(quelle++); ch > 0; ch--) 123 | *(ziel++) = *(quelle++); 124 | } 125 | } 126 | } 127 | else 128 | { 129 | while ((ch = *(quelle++)) != 0xff) 130 | { 131 | if (ch == 0xfe) 132 | { 133 | ziel = zielzeile += restbreite; 134 | u = 0; 135 | v++; 136 | if (y + v >= (int)this->hoehe) 137 | return; 138 | } 139 | else 140 | { 141 | u += ch; 142 | ziel += ch; 143 | 144 | ch = *(quelle++); 145 | if (y + v >= 0) 146 | { 147 | for (; ch > 0; ch--, u++, quelle++, ziel++) 148 | if (x + u >= 0 && x + u < this->breite) 149 | *ziel = *quelle; 150 | } 151 | else 152 | { 153 | u += ch; 154 | quelle += ch; 155 | ziel += ch; 156 | ch = 0; 157 | } 158 | } 159 | } 160 | } 161 | } 162 | 163 | void Bildspeicher_pal8::zeichne_bsh_bild(Bsh_bild& bild, int x, int y) 164 | { 165 | if (x >= (int)this->breite || y >= (int)this->hoehe || x + (int)bild.breite < 0 || y + (int)bild.hoehe < 0) 166 | return; 167 | if ((x < 0) || (y < 0) || (x + (int)bild.breite > (int)this->breite) || (y + (int)bild.hoehe > (int)this->hoehe)) 168 | zeichne_bsh_bild_partiell(bild, x, y); 169 | else 170 | zeichne_bsh_bild_ganz(bild, x, y); 171 | } 172 | 173 | void Bildspeicher_pal8::zeichne_pixel(int x, int y, uint8_t farbe) 174 | { 175 | if (x < 0 || y < 0 || x >= breite || y >= hoehe) 176 | return; 177 | puffer[y * pufferbreite + x] = farbe; 178 | } 179 | 180 | void Bildspeicher_pal8::exportiere_pnm(const char* pfadname) 181 | { 182 | std::ofstream pnm; 183 | pnm.open(pfadname, std::ios_base::out | std::ios_base::binary); 184 | pnm << "P5\n" << breite << " " << hoehe << "\n255\n"; 185 | pnm.write((char*)puffer, breite * hoehe * format); 186 | pnm.close(); 187 | } 188 | 189 | void Bildspeicher_pal8::exportiere_bmp(const char* pfadname) 190 | { 191 | uint32_t bytes_pro_zeile = (breite + 3) & 0xfffffffc; 192 | struct tagBITMAPFILEHEADER 193 | { 194 | uint16_t bfType; 195 | uint32_t bfSize; 196 | uint16_t bfReserved1; 197 | uint16_t bfReserved2; 198 | uint32_t bfOffBits; 199 | } __attribute__((packed)) bmfh = {19778, bytes_pro_zeile * hoehe + 1078, 0, 0, 1078}; 200 | struct tagBITMAPINFOHEADER 201 | { 202 | uint32_t biSize; 203 | int32_t biWidth; 204 | int32_t biHeight; 205 | uint16_t biPlanes; 206 | uint16_t biBitCount; 207 | uint32_t biCompression; 208 | uint32_t biSizeImage; 209 | int32_t biXPelsPerMeter; 210 | int32_t biYPelsPerMeter; 211 | uint32_t biClrUsed; 212 | uint32_t biClrImportant; 213 | } __attribute__((packed)) bmih = {40, (int32_t)breite, (int32_t)hoehe, 1, 8, 0, 0, 0, 0, 0, 0}; 214 | 215 | std::ofstream bmp; 216 | bmp.open(pfadname, std::ios_base::out | std::ios_base::binary); 217 | bmp.write((char*)&bmfh, sizeof(struct tagBITMAPFILEHEADER)); 218 | bmp.write((char*)&bmih, sizeof(struct tagBITMAPINFOHEADER)); 219 | 220 | for (int i = 0; i < 256; i++) 221 | { 222 | bmp << palette[i * 3 + 2] << palette[i * 3 + 1] << palette[i * 3] << (char)0; 223 | } 224 | 225 | for (int i = hoehe - 1; i >= 0; i--) 226 | { 227 | bmp.write((char*)&puffer[breite * i], breite); 228 | uint32_t null = 0; 229 | bmp.write((char*)&null, bytes_pro_zeile - breite); 230 | } 231 | 232 | bmp.close(); 233 | } 234 | 235 | void Bildspeicher_pal8::bild_loeschen() 236 | { 237 | for (int i = 0; i < breite * hoehe; i++) 238 | puffer[i] = farbe; 239 | } 240 | -------------------------------------------------------------------------------- /src/welt.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include "welt.hpp" 21 | #include "files.hpp" 22 | 23 | Welt::Welt(std::istream& f) 24 | { 25 | auto files = Files::instance(); 26 | bebauung = new Bebauung(files->instance()->get_file("bebauung.txt")); 27 | 28 | while (!f.eof()) 29 | { 30 | bloecke.push_back(new Block(f)); 31 | } 32 | std::vector::iterator i = bloecke.begin(); 33 | while (i < bloecke.end()) 34 | { 35 | if (strcmp((*i)->kennung, Insel5::kennung) == 0) 36 | { 37 | inseln.push_back(new Insel(*i, *(i + 1), *bebauung)); 38 | i++; 39 | } 40 | else if (strcmp((*i)->kennung, Kontor::kennung) == 0) 41 | { 42 | for (int j = 0; j < (*i)->laenge / sizeof(Kontor); j++) 43 | kontore.push_back((Kontor&)(*i)->daten[j * sizeof(Kontor)]); 44 | } 45 | else if (strcmp((*i)->kennung, Ship::kennung) == 0) 46 | { 47 | for (int j = 0; j < (*i)->laenge / sizeof(Ship); j++) 48 | schiffe.push_back((Ship&)(*i)->daten[j * sizeof(Ship)]); 49 | } 50 | else if (strcmp((*i)->kennung, Soldat::kennung) == 0) 51 | { 52 | for (int j = 0; j < (*i)->laenge / sizeof(Soldat); j++) 53 | soldaten.push_back((Soldat&)(*i)->daten[j * sizeof(Soldat)]); 54 | } 55 | else if (strcmp((*i)->kennung, Prodlist::kennung) == 0) 56 | { 57 | for (int j = 0; j < (*i)->laenge / sizeof(Prodlist); j++) 58 | prodlist.push_back((Prodlist&)(*i)->daten[j * sizeof(Prodlist)]); 59 | } 60 | else if (strcmp((*i)->kennung, Player::kennung) == 0) 61 | { 62 | for (int j = 0; j < (*i)->laenge / sizeof(Player); j++) 63 | spieler.push_back((Player&)(*i)->daten[j * sizeof(Player)]); 64 | } 65 | i++; 66 | } 67 | 68 | 69 | // Initialisiere Animationen über Gebäuden 70 | 71 | for (Prodlist& prod : prodlist) 72 | { 73 | int x = prod.x_pos + inseln[prod.inselnummer]->xpos; 74 | int y = prod.y_pos + inseln[prod.inselnummer]->ypos; 75 | inselfeld_t inselfeld; 76 | feld_an_pos(inselfeld, x, y); 77 | Bebauungsinfo* info = bebauung->info_zu(inselfeld.bebauung); 78 | if (info != nullptr) 79 | { 80 | int max_x = (((inselfeld.rot & 1) == 0) ? info->breite : info->hoehe) - 1; 81 | int max_y = (((inselfeld.rot & 1) == 0) ? info->hoehe : info->breite) - 1; 82 | if (info->kategorie == 4) 83 | { 84 | int versatz = (info->breite + info->hoehe) / 2; 85 | versatz += (versatz & 1) * 2; 86 | if (!((prod.modus & 1) != 0)) // Betrieb ist geschlossen 87 | { 88 | animationen[std::pair(x, y)] = {x * 256 + max_x * 128, y * 256 + max_y * 128, 256 + versatz * 205, 0, 350, 32, (max_x + max_y) * 128, true}; 89 | } 90 | if ((prod.ani & 0x0f) == 0x0f) // Betrieb hat Rohstoffmangel 91 | { 92 | animationen[std::pair(x, y)] = {x * 256 + max_x * 128, y * 256 + max_y * 128, 256 + versatz * 205, 0, 382, 32, (max_x + max_y) * 128, true}; 93 | } 94 | } 95 | } 96 | } 97 | 98 | // Initialisiere Animationen über Bergen 99 | 100 | for (Insel*& insel : inseln) 101 | { 102 | for (int i = 0; i < reinterpret_cast(insel->inselX->daten)->erzvorkommen; i++) 103 | { 104 | const Erzvorkommen& erz = reinterpret_cast(insel->inselX->daten)->erze[i]; 105 | int x = erz.x_pos + insel->xpos; 106 | int y = erz.y_pos + insel->ypos; 107 | inselfeld_t inselfeld; 108 | feld_an_pos(inselfeld, x, y); 109 | Bebauungsinfo* info = bebauung->info_zu(inselfeld.bebauung); 110 | if (info != nullptr) 111 | { 112 | int max_x = (((inselfeld.rot & 1) == 0) ? info->breite : info->hoehe) - 1; 113 | int max_y = (((inselfeld.rot & 1) == 0) ? info->hoehe : info->breite) - 1; 114 | // if (info->kategorie == 4) 115 | { 116 | int versatz = (info->breite + info->hoehe) / 2; 117 | versatz += (versatz & 1) * 2 + 3; 118 | if (erz.typ == 2) // Eisen 119 | { 120 | animationen[std::pair(x, y)] 121 | = {x * 256 + max_x * 128, y * 256 + max_y * 128, 256 + versatz * 205, 0, 556, 32, (max_x + max_y) * 128, true}; 122 | } 123 | if (erz.typ == 3) // Gold 124 | { 125 | animationen[std::pair(x, y)] 126 | = {x * 256 + max_x * 128, y * 256 + max_y * 128, 256 + versatz * 205, 0, 588, 32, (max_x + max_y) * 128, true}; 127 | } 128 | } 129 | } 130 | } 131 | } 132 | } 133 | 134 | int Welt::inselnummer_an_pos(uint16_t x, uint16_t y) 135 | { 136 | for (int i = 0; i < inseln.size(); i++) 137 | { 138 | if ((x >= inseln[i]->xpos) && (y >= inseln[i]->ypos) && (x < inseln[i]->xpos + inseln[i]->breite) && (y < inseln[i]->ypos + inseln[i]->hoehe)) 139 | return i; 140 | } 141 | return -1; 142 | } 143 | 144 | Insel* Welt::insel_an_pos(uint16_t x, uint16_t y) 145 | { 146 | for (Insel* insel : inseln) 147 | { 148 | if ((x >= insel->xpos) && (y >= insel->ypos) && (x < insel->xpos + insel->breite) && (y < insel->ypos + insel->hoehe)) 149 | return insel; 150 | } 151 | return NULL; 152 | } 153 | 154 | void Welt::simulationsschritt() 155 | { 156 | ani = (ani + 1) % 12; 157 | for (Insel* insel : inseln) 158 | { 159 | insel->bewege_wasser(); 160 | } 161 | for (Prodlist& prod : prodlist) 162 | { 163 | if (prod.modus & 1 && prod.rohstoff1_menge >= 16 && prod.produkt_menge < 320) 164 | inseln[prod.inselnummer]->animiere_gebaeude(prod.x_pos, prod.y_pos); 165 | } 166 | for (auto& map_elem : animationen) 167 | { 168 | Animation& animation = map_elem.second; 169 | if (animation.ani != -1) 170 | { 171 | if (animation.ani < animation.schritte - 1) 172 | { 173 | animation.ani++; 174 | } 175 | else 176 | { 177 | if (animation.wiederholen) 178 | animation.ani = 0; 179 | else 180 | animation.ani = -1; 181 | } 182 | } 183 | } 184 | } 185 | 186 | void Welt::feld_an_pos(inselfeld_t& feld, int x, int y) 187 | { 188 | Insel* insel = insel_an_pos(x, y); 189 | if (insel != NULL) 190 | insel->inselfeld_bebauung(feld, x - insel->xpos, y - insel->ypos); 191 | else 192 | { 193 | memset(&feld, 0, sizeof(inselfeld_t)); 194 | feld.bebauung = 1201; 195 | feld.ani = (0x80000000 + y + x * 3 + ani) % 12; // (12 == ani_schritte des Meeres); 196 | } 197 | } 198 | 199 | Prodlist* Welt::prodlist_an_pos(uint8_t insel, uint8_t x, uint8_t y) 200 | { 201 | // Provisorium! Muss viel effizienter werden! 202 | for (int i = 0; i < prodlist.size(); i++) 203 | { 204 | if (prodlist[i].inselnummer == insel && prodlist[i].x_pos == x && prodlist[i].y_pos == y) 205 | return &prodlist[i]; 206 | } 207 | return nullptr; 208 | } 209 | 210 | Ship* Welt::schiff_an_pos(uint16_t x, uint16_t y) 211 | { 212 | // Provisorium! Muss viel effizienter werden! 213 | for (int i = 0; i < schiffe.size(); i++) 214 | { 215 | if (schiffe[i].x_pos == x && schiffe[i].y_pos == y) 216 | return &schiffe[i]; 217 | } 218 | return nullptr; 219 | } 220 | 221 | uint8_t Welt::spielerfarbe(uint8_t spieler) 222 | { 223 | return this->spieler[spieler].farbe; 224 | } 225 | -------------------------------------------------------------------------------- /src/bsh_schreiber.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2017 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "bsh_schreiber.hpp" 20 | 21 | #include 22 | 23 | using namespace std; 24 | 25 | istream& operator>>(istream& is, const char* str) 26 | { 27 | string temp; 28 | is >> temp; 29 | if (temp != str) 30 | throw new istream::failure("unexpected string constant in input"); 31 | return is; 32 | } 33 | 34 | Bsh_schreiber::Bsh_schreiber(int transp_farbe, int extra_spalten, bool ist_zei) 35 | { 36 | this->transp_farbe = transp_farbe; 37 | this->extra_spalten = extra_spalten; 38 | this->ist_zei = ist_zei; 39 | } 40 | 41 | Bsh_schreiber::~Bsh_schreiber() 42 | { 43 | } 44 | 45 | enum zustand_t 46 | { 47 | TRANSPARENT, 48 | PIXEL, 49 | }; 50 | 51 | #define ist_transparent(a) ((a) == transp_farbe) 52 | 53 | void Bsh_schreiber::schreib_bsh(uint8_t* bild, int breite, int hoehe, vector& ziel) 54 | { 55 | int tz = 0; 56 | int zz = 0; 57 | int pixel_index = 0; 58 | zustand_t zustand = TRANSPARENT; 59 | 60 | for (int y = 0; y < hoehe; y++) 61 | { 62 | for (int x = 0; x < breite; x++) 63 | { 64 | if (zustand == TRANSPARENT) 65 | { 66 | if (x == 0 && y != 0) 67 | { 68 | zz++; 69 | tz = 0; 70 | } 71 | if (ist_transparent(bild[y * breite + x])) 72 | { 73 | tz++; 74 | } 75 | else 76 | { 77 | for (int i = 0; i < zz; i++) 78 | { 79 | ziel.push_back(0xfe); 80 | } 81 | zz = 0; 82 | while (tz > 253) 83 | { 84 | ziel.push_back(253); 85 | ziel.push_back(0); 86 | tz -= 253; 87 | } 88 | ziel.push_back(tz); 89 | tz = 1; 90 | pixel_index = y * breite + x; 91 | zustand = PIXEL; 92 | } 93 | } 94 | else 95 | { 96 | if (x == 0 || ist_transparent(bild[y * breite + x])) 97 | { 98 | // tz Pixel ausgeben 99 | while (tz > 253) 100 | { 101 | ziel.push_back(253); 102 | for (int i = 0; i < 253; i++) 103 | { 104 | ziel.push_back(bild[pixel_index]); 105 | pixel_index++; 106 | } 107 | ziel.push_back(0); 108 | tz -= 253; 109 | } 110 | ziel.push_back(tz); 111 | for (int i = 0; i < tz; i++) 112 | { 113 | ziel.push_back(bild[pixel_index]); 114 | pixel_index++; 115 | } 116 | tz = 1; 117 | if (x == 0 && !ist_transparent(bild[y * breite + x])) 118 | { 119 | ziel.push_back(0xfe); 120 | ziel.push_back(0); 121 | } 122 | else 123 | { 124 | if (ist_transparent(bild[y * breite + x])) 125 | { 126 | zustand = TRANSPARENT; 127 | if (x == 0) 128 | { 129 | zz++; 130 | } 131 | } 132 | } 133 | } 134 | else 135 | { 136 | tz++; 137 | } 138 | } 139 | } 140 | } 141 | if (zustand == PIXEL) 142 | { 143 | // tz Pixel ausgeben 144 | while (tz > 253) 145 | { 146 | ziel.push_back(253); 147 | for (int i = 0; i < 253; i++) 148 | { 149 | ziel.push_back(bild[pixel_index]); 150 | pixel_index++; 151 | } 152 | ziel.push_back(0); 153 | tz -= 253; 154 | } 155 | ziel.push_back(tz); 156 | for (int i = 0; i < tz; i++) 157 | { 158 | ziel.push_back(bild[pixel_index]); 159 | pixel_index++; 160 | } 161 | } 162 | ziel.push_back(0xff); 163 | } 164 | 165 | void Bsh_schreiber::lies_pgm(const char* pfadname, uint8_t*& bild, int& breite, int& hoehe) 166 | { 167 | ifstream pgm; 168 | pgm.open(pfadname, ios_base::in | ios_base::binary); 169 | pgm.unsetf(ios::skipws); 170 | pgm >> "P5"; 171 | pgm.setf(ios::skipws); 172 | pgm >> breite >> hoehe >> "255"; 173 | pgm.get(); 174 | bild = new uint8_t[breite * hoehe]; 175 | pgm.read(reinterpret_cast(bild), breite * hoehe); 176 | pgm.close(); 177 | } 178 | 179 | void Bsh_schreiber::pgm_anhaengen(const char* pfadname) 180 | { 181 | int breite, hoehe; 182 | uint8_t* bild; 183 | lies_pgm(pfadname, bild, breite, hoehe); 184 | bilder.emplace_back(); 185 | Bild_und_meta& ziel = bilder.back(); 186 | schreib_bsh(bild, breite, hoehe, ziel.daten); 187 | delete[] bild; 188 | while (ziel.daten.size() % 4 != 0) 189 | ziel.daten.push_back(0); 190 | ziel.typ = 1; 191 | ziel.laenge = ziel.daten.size() + 16; 192 | ziel.breite = (breite > extra_spalten) ? breite - extra_spalten : 1; 193 | ziel.hoehe = hoehe; 194 | boost::crc_32_type crccomp; 195 | crccomp.process_bytes(ziel.daten.data(), ziel.daten.size()); 196 | ziel.crc = crccomp.checksum(); 197 | ziel.duplikat_von = -1; 198 | ziel.versatz = 0; 199 | } 200 | 201 | void Bsh_schreiber::datei_schreiben(const char* pfadname) 202 | { 203 | if (bilder.size() < 1) 204 | return; 205 | 206 | fstream bsh; 207 | bsh.open(pfadname, fstream::in | fstream::out | fstream::trunc | fstream::binary); 208 | char signatur_bsh[16] = {'B', 'S', 'H', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'}; 209 | char signatur_zei[16] = {'Z', 'E', 'I', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'}; 210 | if (ist_zei) 211 | bsh.write(signatur_zei, sizeof(signatur_zei)); 212 | else 213 | bsh.write(signatur_bsh, sizeof(signatur_bsh)); 214 | 215 | for (int i = 0; i < bilder.size(); i++) 216 | { 217 | for (int j = 0; j < i; j++) 218 | { 219 | if (bilder[i].crc == bilder[j].crc && bilder[i].breite == bilder[j].breite && bilder[i].hoehe == bilder[j].hoehe && bilder[i].typ == bilder[j].typ 220 | && bilder[i].laenge == bilder[j].laenge && bilder[i].daten == bilder[j].daten) 221 | { 222 | bilder[i].duplikat_von = j; 223 | break; 224 | } 225 | } 226 | } 227 | 228 | uint32_t versatz_absolut = bilder.size() * sizeof(uint32_t); 229 | for (int i = 0; i < bilder.size(); i++) 230 | { 231 | if (bilder[i].duplikat_von == -1) 232 | { 233 | bilder[i].versatz = versatz_absolut; 234 | versatz_absolut += bilder[i].laenge; 235 | } 236 | else 237 | bilder[i].versatz = bilder[bilder[i].duplikat_von].versatz; 238 | } 239 | 240 | uint32_t groesse = bilder.size() * sizeof(uint32_t); 241 | for (Bild_und_meta& bild : bilder) 242 | { 243 | if (bild.duplikat_von == -1) 244 | groesse += bild.laenge; 245 | } 246 | bsh.write(reinterpret_cast(&groesse), sizeof(groesse)); 247 | 248 | for (Bild_und_meta& bild : bilder) 249 | { 250 | bsh.write(reinterpret_cast(&bild.versatz), sizeof(bild.versatz)); 251 | } 252 | 253 | for (Bild_und_meta& bild : bilder) 254 | { 255 | if (bild.duplikat_von == -1) 256 | { 257 | bsh.write(reinterpret_cast(&bild.breite), sizeof(bild.breite)); 258 | bsh.write(reinterpret_cast(&bild.hoehe), sizeof(bild.hoehe)); 259 | bsh.write(reinterpret_cast(&bild.typ), sizeof(bild.typ)); 260 | bsh.write(reinterpret_cast(&bild.laenge), sizeof(bild.laenge)); 261 | bsh.write(reinterpret_cast(bild.daten.data()), bild.daten.size()); 262 | } 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /src/insel.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "strukturen.hpp" 20 | #include "insel.hpp" 21 | #include "bebauung.hpp" 22 | #include "grafiken.hpp" 23 | #include "files.hpp" 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | void Insel::insel_rastern(inselfeld_t* a, uint32_t laenge, inselfeld_t* b, uint8_t breite, uint8_t hoehe) 31 | { 32 | for (int y = 0; y < hoehe; y++) 33 | { 34 | for (int x = 0; x < breite; x++) 35 | { 36 | b[y * breite + x].bebauung = 0xffff; 37 | } 38 | } 39 | 40 | for (int i = 0; i < laenge; i++) 41 | { 42 | inselfeld_t& feld = a[i]; 43 | 44 | if (feld.x_pos >= breite || feld.y_pos >= hoehe) 45 | continue; 46 | 47 | Bebauungsinfo* info = bebauung.info_zu(feld.bebauung); 48 | if (info != nullptr) 49 | { 50 | int x, y, u, v; 51 | if (feld.rot % 2 == 0) 52 | { 53 | u = info->breite; 54 | v = info->hoehe; 55 | } 56 | else 57 | { 58 | u = info->hoehe; 59 | v = info->breite; 60 | } 61 | 62 | for (int y = 0; y < v && feld.y_pos + y < hoehe; y++) 63 | { 64 | for (int x = 0; x < u && feld.x_pos + x < breite; x++) 65 | { 66 | b[(feld.y_pos + y) * breite + feld.x_pos + x] = feld; 67 | b[(feld.y_pos + y) * breite + feld.x_pos + x].x_pos = x; 68 | b[(feld.y_pos + y) * breite + feld.x_pos + x].y_pos = y; 69 | } 70 | } 71 | } 72 | else 73 | { 74 | b[feld.y_pos * breite + feld.x_pos] = feld; 75 | b[feld.y_pos * breite + feld.x_pos].x_pos = 0; 76 | b[feld.y_pos * breite + feld.x_pos].y_pos = 0; 77 | } 78 | } 79 | } 80 | 81 | /*30x30 "lit%02d.scp" 82 | 40x40 "mit%02d.scp" 83 | 50x52 "med%02d.scp" 84 | 70x60 "big%02d.scp" 85 | 100x90 "lar%02d.scp" 86 | */ 87 | 88 | std::string Insel::basisname(uint8_t breite, uint8_t num, uint8_t sued) 89 | { 90 | // 30x30 91 | if (breite < 35) 92 | return boost::str(boost::format("%slit%02d.scp") % (sued ? "sued/" : "nord/") % (int)num); 93 | // 40x40 94 | if (breite < 45) 95 | return boost::str(boost::format("%smit%02d.scp") % (sued ? "sued/" : "nord/") % (int)num); 96 | // 50x52 97 | if (breite < 60) 98 | return boost::str(boost::format("%smed%02d.scp") % (sued ? "sued/" : "nord/") % (int)num); 99 | // 70x60 100 | if (breite < 85) 101 | return boost::str(boost::format("%sbig%02d.scp") % (sued ? "sued/" : "nord/") % (int)num); 102 | // 100x90 103 | return boost::str(boost::format("%slar%02d.scp") % (sued ? "sued/" : "nord/") % (int)num); 104 | } 105 | 106 | Insel::Insel(Block* inselX, Block* inselhaus, Bebauung& bebauung) 107 | : bebauung(bebauung) 108 | { 109 | // Kennung prüfen 110 | if (strcmp(inselX->kennung, Insel5::kennung) == 0) 111 | { 112 | this->inselX = inselX; 113 | this->breite = ((Insel5*)inselX->daten)->breite; 114 | this->hoehe = ((Insel5*)inselX->daten)->hoehe; 115 | this->xpos = ((Insel5*)inselX->daten)->x_pos; 116 | this->ypos = ((Insel5*)inselX->daten)->y_pos; 117 | this->schicht1 = new inselfeld_t[this->breite * this->hoehe]; 118 | this->schicht2 = new inselfeld_t[this->breite * this->hoehe]; 119 | if (((Insel5*)inselX->daten)->diff == 0) 120 | { 121 | std::ifstream f; 122 | auto files = Files::instance(); 123 | std::string karte = this->basisname(this->breite, ((Insel5*)inselX->daten)->basis, ((Insel5*)inselX->daten)->sued).c_str(); 124 | karte = files->instance()->find_path_for_file(karte); 125 | if (files->instance()->check_file(karte) == false) 126 | { 127 | std::cout << "[ERR] Island not found: " << karte << std::endl; 128 | exit(EXIT_FAILURE); 129 | } 130 | 131 | f.open(karte, std::ios_base::in | std::ios_base::binary); 132 | Block inselX_basis = Block(f); 133 | Block inselhaus_basis = Block(f); 134 | this->insel_rastern((inselfeld_t*)inselhaus_basis.daten, inselhaus_basis.laenge / 8, schicht1, this->breite, this->hoehe); 135 | f.close(); 136 | } 137 | 138 | this->insel_rastern((inselfeld_t*)inselhaus->daten, inselhaus->laenge / 8, schicht2, this->breite, this->hoehe); 139 | 140 | uint8_t x, y; 141 | for (y = 0; y < this->hoehe; y++) 142 | { 143 | for (x = 0; x < this->breite; x++) 144 | { 145 | if (schicht2[y * this->breite + x].bebauung == 0xffff) 146 | schicht2[y * this->breite + x] = schicht1[y * this->breite + x]; 147 | } 148 | } 149 | } 150 | else if (strcmp(inselX->kennung, Insel3::kennung) == 0) 151 | { 152 | this->inselX = inselX; 153 | this->breite = ((Insel3*)inselX->daten)->breite; 154 | this->hoehe = ((Insel3*)inselX->daten)->hoehe; 155 | this->xpos = ((Insel3*)inselX->daten)->x_pos; 156 | this->ypos = ((Insel3*)inselX->daten)->y_pos; 157 | this->schicht1 = new inselfeld_t[this->breite * this->hoehe]; 158 | this->schicht2 = new inselfeld_t[this->breite * this->hoehe]; 159 | this->insel_rastern((inselfeld_t*)inselhaus->daten, inselhaus->laenge / 8, schicht1, this->breite, this->hoehe); 160 | memcpy(schicht2, schicht1, sizeof(inselfeld_t) * this->breite * this->hoehe); 161 | } 162 | } 163 | 164 | void Insel::grafik_boden(feld_t& ziel, uint8_t x, uint8_t y, uint8_t r, Grafiken& grafiken) 165 | { 166 | Bebauungsinfo* info; 167 | int grafik; 168 | if (schicht2[y * breite + x].bebauung != 0xffff) 169 | { 170 | info = bebauung.info_zu(schicht2[y * breite + x].bebauung); 171 | grafik = grafiken.grafik_zu(schicht2[y * breite + x].bebauung); 172 | if (info != nullptr && info->bauhoehe == 0 && grafik != -1) 173 | { 174 | ziel.index = grafik; 175 | ziel.grundhoehe = info->grundhoehe; 176 | return; 177 | } 178 | } 179 | if (schicht1[y * breite + x].bebauung != 0xffff) 180 | { 181 | info = bebauung.info_zu(schicht1[y * breite + x].bebauung); 182 | grafik = grafiken.grafik_zu(schicht1[y * breite + x].bebauung); 183 | if (info != nullptr && info->bauhoehe == 0 && grafik != -1) 184 | { 185 | ziel.index = grafik; 186 | ziel.grundhoehe = info->grundhoehe; 187 | return; 188 | } 189 | } 190 | ziel.index = 0; 191 | ziel.grundhoehe = 1; 192 | } 193 | 194 | void Insel::inselfeld_bebauung(inselfeld_t& ziel, uint8_t x, uint8_t y) 195 | { 196 | uint8_t xp = schicht2[y * breite + x].x_pos; 197 | uint8_t yp = schicht2[y * breite + x].y_pos; 198 | if ((yp > y) || (xp > x)) 199 | { 200 | // TODO "ziel" auf einen sinnvollen Wert setzen 201 | return; 202 | } 203 | ziel = schicht2[(y - yp) * breite + x - xp]; 204 | ziel.x_pos = xp; 205 | ziel.y_pos = yp; 206 | } 207 | 208 | void Insel::grafik_bebauung_inselfeld(feld_t& ziel, inselfeld_t& feld, uint8_t r, Bebauung& bebauung, Grafiken& grafiken) 209 | { 210 | if (feld.bebauung == 0xffff) 211 | { 212 | ziel.index = -1; 213 | ziel.grundhoehe = 0; 214 | return; 215 | } 216 | 217 | Bebauungsinfo* info = bebauung.info_zu(feld.bebauung); 218 | int grafik = grafiken.grafik_zu(feld.bebauung); 219 | if (info == nullptr || grafik == -1) 220 | { 221 | ziel.index = -1; 222 | ziel.grundhoehe = 0; 223 | return; 224 | } 225 | int16_t index = grafik; 226 | index += info->breite * info->hoehe * ((r + feld.rot) % info->richtungen); 227 | switch (feld.rot) 228 | { 229 | case 0: index += feld.y_pos * info->breite + feld.x_pos; break; 230 | case 1: index += (info->hoehe - feld.x_pos - 1) * info->breite + feld.y_pos; break; 231 | case 2: index += (info->hoehe - feld.y_pos - 1) * info->breite + (info->breite - feld.x_pos - 1); break; 232 | case 3: index += feld.x_pos * info->breite + (info->breite - feld.y_pos - 1); break; 233 | } 234 | index += info->breite * info->hoehe * info->richtungen * (feld.ani % info->ani_schritte); 235 | ziel.index = index; 236 | ziel.grundhoehe = info->grundhoehe; 237 | } 238 | 239 | void Insel::grafik_bebauung(feld_t& ziel, uint8_t x, uint8_t y, uint8_t r, Grafiken& grafiken) 240 | { 241 | inselfeld_t feld; 242 | inselfeld_bebauung(feld, x, y); 243 | grafik_bebauung_inselfeld(ziel, feld, r, bebauung, grafiken); 244 | } 245 | 246 | void Insel::bewege_wasser() // FIXME 247 | { 248 | for (int y = 0; y < hoehe; y++) 249 | { 250 | for (int x = 0; x < breite; x++) 251 | { 252 | inselfeld_t& feld = schicht2[y * breite + x]; 253 | if (feld.bebauung >= 1201 && feld.bebauung <= 1218 || feld.bebauung >= 901 && feld.bebauung <= 905 || feld.bebauung >= 1251 && feld.bebauung <= 1259 254 | || feld.bebauung == 1071 || feld.bebauung == 2311) 255 | { 256 | Bebauungsinfo* info = bebauung.info_zu(feld.bebauung); 257 | if (info != nullptr) 258 | feld.ani = (feld.ani + 1) % info->ani_schritte; 259 | } 260 | } 261 | } 262 | } 263 | 264 | void Insel::animiere_gebaeude(uint8_t x, uint8_t y) 265 | { 266 | inselfeld_t& feld = schicht2[y * breite + x]; 267 | Bebauungsinfo* info = bebauung.info_zu(feld.bebauung); 268 | if (info != nullptr) 269 | feld.ani = (feld.ani + 1) % info->ani_schritte; 270 | } 271 | -------------------------------------------------------------------------------- /src/grafiken.txt: -------------------------------------------------------------------------------- 1 | 101 4 gras0_gruen 2 | 102 8 gras1_gruen 3 | 103 4 gras2_gruen 4 | 104 4 gras3_gruen 5 | 105 12 gras4_gruen 6 | 106 12 gras5_gruen 7 | 141 280 wueste0 8 | 142 284 wueste1 9 | 143 288 wueste2 10 | 144 292 wueste3 11 | 145 296 wueste4 12 | 146 300 wueste5 13 | 147 304 wueste6 14 | 148 308 wueste7 15 | 149 312 wueste8 16 | 150 316 wueste9 17 | 151 320 gras0_braun 18 | 152 324 gras1_braun 19 | 153 328 gras2_braun 20 | 154 332 gras3_braun 21 | 155 336 gras4_braun 22 | 156 340 gras5_braun 23 | 157 344 gras6_braun 24 | 158 348 gras7_braun 25 | 159 352 gras8_braun 26 | 160 356 gras9_braun 27 | 161 80 gras0 28 | 162 84 gras1 29 | 163 88 gras2 30 | 164 92 gras3 31 | 165 96 gras4 32 | 166 100 gras5 33 | 167 104 gras6 34 | 168 108 gras7 35 | 169 112 gras8 36 | 170 116 gras9 37 | 181 200 pflanzen0 38 | 182 204 pflanzen1 39 | 183 208 pflanzen2 40 | 184 212 pflanzen3 41 | 185 216 pflanzen4 42 | 186 220 pflanzen5 43 | 187 224 pflanzen6 44 | 188 228 pflanzen7 45 | 189 232 pflanzen8 46 | 190 236 pflanzen9 47 | 303 1420 stadttor 48 | 304 1340 tor_stein 49 | 305 1336 wachturm_stein_land 50 | 306 1376 wachturm_stein_kueste 51 | 311 5400 burg 52 | 313 5416 burg_gross 53 | 315 5452 festung 54 | 401 1260 strasse_gerade 55 | 402 1264 strasse_ecke 56 | 403 1268 strasse_t 57 | 404 1272 strasse_kreuzung 58 | 411 1280 weg_gerade 59 | 412 1284 weg_ecke 60 | 413 1288 weg_t 61 | 414 1292 weg_kreuzung 62 | 421 1300 platz1 63 | 422 1304 platz2 64 | 423 1308 platz3 65 | 424 1312 zierbaum 66 | 501 1840 windmuehle 67 | 503 3760 baeckerei 68 | 505 3776 schneiderei 69 | 507 3792 webstube 70 | 509 2096 wassermuehle 71 | 511 3840 metzger 72 | 513 2552 steinmetz 73 | 515 3984 werkzeugschmiede 74 | 517 4324 schwertschmiede 75 | 519 3824 rumbrennerei 76 | 521 3904 erzschmelze 77 | 525 3856 tabakwarenladen 78 | 527 4144 kanonengiesserei 79 | 529 4064 musketenbauer 80 | 531 3808 weberei 81 | 533 3872 goldschmiede 82 | 605 2952 pionier1 83 | 606 2968 pionier2 84 | 607 2984 pionier3 85 | 608 3000 pionier4 86 | 609 3016 pionier5 87 | 610 3032 pionier6 88 | 611 3048 pionier7 89 | 621 3064 siedler1 90 | 622 3080 siedler2 91 | 623 3096 siedler3 92 | 624 3112 siedler4 93 | 625 3128 siedler5 94 | 631 3144 buerger1 95 | 632 3160 buerger2 96 | 633 3176 buerger3 97 | 634 3192 buerger4 98 | 635 3208 buerger5 99 | 636 3224 buerger6 100 | 641 3240 kaufleute1 101 | 642 3256 kaufleute2 102 | 643 3272 kaufleute3 103 | 644 3288 kaufleute4 104 | 645 3304 kaufleute5 105 | 651 3320 aristokraten1 106 | 652 3336 aristokraten2 107 | 653 3352 aristokraten3 108 | 654 3368 aristokraten4 109 | 655 3384 aristokraten5 110 | 656 3400 aristokraten6 111 | 801 4992 kathedrale 112 | 803 5136 kapelle 113 | 805 5088 kirche 114 | 807 4508 wirtshaus 115 | 809 4700 marktplatz 116 | 811 2760 feuerwehr 117 | 813 4652 badehaus 118 | 815 5144 theater 119 | 817 2856 arzt 120 | 819 5320 hochschule 121 | 821 5356 schule 122 | 831 5180 schloss 123 | 841 5372 galgen 124 | 851 5396 denkmal 125 | 901 1576 fluss0_gerade 126 | 902 1600 fluss1_gerade 127 | 903 1624 fluss0_gabelung 128 | 904 1648 fluss0_biegung 129 | 905 1744 fluss1_biegung 130 | 1011 1092 kueste0_1_2 131 | 1012 1096 kueste1_1_2 132 | 1013 1100 kueste2_1_2 133 | 1014 1104 kueste3_1_2 134 | 1015 1108 kueste4_1_2 135 | 1016 1112 kueste5_1_2 136 | 1017 1116 kueste6_1_2 137 | 1018 1120 kueste7_1_2 138 | 1019 1124 kueste8_1_2 139 | 1020 1128 kueste9_1_2 140 | 1031 1132 kueste0_3_4 141 | 1032 1136 kueste1_3_4 142 | 1033 1140 kueste2_3_4 143 | 1034 1144 kueste3_3_4 144 | 1051 1164 kueste0_1_4 145 | 1052 1168 kueste1_1_4 146 | 1053 1172 kueste2_1_4 147 | 1071 1196 kueste_muendung 148 | 1073 1316 anlegestelle 149 | 1075 1320 fischer 150 | 1081 1220 kueste0_felsig 151 | 1082 1224 kueste1_felsig 152 | 1083 1228 kueste2_felsig 153 | 1084 1232 kueste3_felsig 154 | 1103 5824 berg2 155 | 1104 5932 berg5 156 | 1105 5948 berg6 157 | 1106 5860 berg3 158 | 1107 5896 berg4 159 | 1108 5552 vulkan 160 | 1109 5616 berg0 161 | 1110 5680 berg1 162 | 1201 752 meer 163 | 1202 692 meer_flach_fischgruende 164 | 1203 680 meer_flach 165 | 1204 740 fischgruende 166 | 1205 812 strand0_1_2 167 | 1206 836 strand0_3_4 168 | 1207 860 strand0_1_4 169 | 1208 884 strand0_muendung 170 | 1209 764 fischgruende_meer 171 | 1214 908 strand1_1_2 172 | 1215 932 strand2_1_2 173 | 1216 956 strand3_1_2 174 | 1217 980 strand4_1_2 175 | 1218 1004 strand5_1_2 176 | 1221 1028 strand1_3_4 177 | 1231 1052 dreck0 178 | 1232 1056 dreck1 179 | 1233 1060 wrack 180 | 1234 1064 skelett 181 | 1235 1068 felsbogen0 182 | 1236 1072 felsbogen1 183 | 1237 1076 felsformation 184 | 1251 752 meer befischt 185 | 1252 692 meer_flach_fischgruende 186 | 1254 740 fischgruende befischt 187 | 1259 740 fischgruende befischt 188 | 1301 584 weizenfeld 189 | 1302 589 weizenfeld_fertig 190 | 1303 1444 baum0_nord 191 | 1304 1449 baum0_nord_fertig 192 | 1305 1450 baum1_nord 193 | 1306 1455 baum1_nord_fertig 194 | 1307 1456 baum2_nord 195 | 1308 1461 baum2_nord_fertig 196 | 1309 1462 baum3_nord 197 | 1310 1467 baum3_nord_fertig 198 | 1311 1468 baum4_nord 199 | 1312 1473 baum4_nord_fertig 200 | 1313 1474 baum5_nord 201 | 1314 1479 baum5_nord_fertig 202 | 1315 1480 baum6_nord 203 | 1316 1485 baum6_nord_fertig 204 | 1317 1486 baum7_nord 205 | 1318 1491 baum7_nord_fertig 206 | 1319 1492 baum8_nord 207 | 1320 1497 baum8_nord_fertig 208 | 1321 1498 baum9_nord 209 | 1322 1503 baum9_nord_fertig 210 | 1323 1504 baum10_nord 211 | 1324 1509 baum10_nord_fertig 212 | 1331 590 baumwollfeld 213 | 1332 595 baumwollfeld_fertig 214 | 1335 602 tabakfeld 215 | 1336 607 tabakfeld_fertig 216 | 1337 608 kakaofeld 217 | 1338 613 kakaofeld_fertig 218 | 1339 614 zuckerrohrfeld 219 | 1340 619 zuckerrohrfeld_fertig 220 | 1341 620 gewuerzfeld 221 | 1342 625 gewuerzfeld_fertig 222 | 1343 626 weinfeld 223 | 1344 631 weinfeld_fertig 224 | 1351 1510 baum0_sued 225 | 1352 1515 baum0_sued_fertig 226 | 1353 1516 baum1_sued 227 | 1354 1521 baum1_sued_fertig 228 | 1355 1522 baum2_sued 229 | 1356 1527 baum2_sued_fertig 230 | 1357 1528 baum3_sued 231 | 1358 1533 baum3_sued_fertig 232 | 1359 1534 baum4_sued 233 | 1360 1539 baum4_sued_fertig 234 | 1361 1540 baum5_sued 235 | 1362 1545 baum5_sued_fertig 236 | 1363 1546 baum6_sued 237 | 1364 1551 baum6_sued_fertig 238 | 1365 1552 baum7_sued 239 | 1366 1557 baum7_sued_fertig 240 | 1367 1558 baum8_sued 241 | 1368 1563 baum8_sued_fertig 242 | 1369 1564 baum9_sued 243 | 1370 1569 baum9_sued_fertig 244 | 1371 1570 baum10_sued 245 | 1372 1575 baum10_sued_fertig 246 | 1375 650 tabakfeld_trocken 247 | 1377 656 kakaofeld_trocken 248 | 1379 662 zuckerrohrfeld_trocken 249 | 1381 668 gewuerzfeld_trocken 250 | 1383 674 weinfeld_trocken 251 | 1405 1356 wachturm_holz_land 252 | 1406 1392 wachturm_holz_kueste 253 | 1501 2744 gewuerzplantage 254 | 1503 2616 bauernhof 255 | 1505 2632 baumwollplantage 256 | 1507 2680 tabakplantage 257 | 1509 2696 kakaoplantage 258 | 1511 2712 zuckerrohrplantage 259 | 1513 2648 rinderfarm 260 | 1515 2664 schaffarm 261 | 1517 2728 weingut 262 | 1601 1296 holzbruecke 263 | 1603 1276 steinbruecke 264 | 2001 2488 holzfaeller 265 | 2003 4408 jagdhuette 266 | 2101 4412 kontor1 267 | 2103 4436 kontor2 268 | 2105 4460 kontor3 269 | 2107 4484 kontor4 270 | 2111 4892 werft_gross 271 | 2115 4956 werft 272 | 2121 4556 kontor1_kaputt 273 | 2123 4580 kontor2_kaputt 274 | 2125 4604 kontor3_kaputt 275 | 2127 4628 kontor4_kaputt 276 | 2201 3416 haeuptlingshuette_stein 277 | 2202 3432 kriegerhuette_stein 278 | 2203 3448 eingeborenenhuette_stein 279 | 2204 3528 gewuerzlager_stein 280 | 2205 3544 tabaklager_stein 281 | 2211 3640 pyramide 282 | 2221 4532 piratenkontor 283 | 2222 3704 piratenhaus1 284 | 2223 3720 piratenhaus2 285 | 2224 3736 piratenwirtshaus 286 | 2231 3464 haeuptlingshuette 287 | 2232 3480 eingeborenenhuette 288 | 2233 3496 kriegerhuette 289 | 2234 3576 gewuerzlager 290 | 2235 3592 tabaklager 291 | 2241 3752 piratenturm_land 292 | 2242 3756 piratenturm_kueste 293 | 2301 432 hang0 294 | 2302 436 hang1 295 | 2303 440 hang2 296 | 2304 444 hang3 297 | 2305 448 hang4 298 | 2306 452 hang5 299 | 2307 456 hang6 300 | 2308 460 hang7 301 | 2309 464 hang8 302 | 2310 468 hang9 303 | 2311 552 quelle 304 | 2321 472 hang0_1_4 305 | 2322 476 hang1_1_4 306 | 2341 512 hang0_3_4 307 | 2342 516 hang1_3_4 308 | 2401 2296 erzmine 309 | 2403 2360 erzmine_tief 310 | 2405 2424 goldmine 311 | 2407 2288 steinbruch 312 | 2501 1324 steinwall_gerade_land 313 | 2502 1328 steinwall_ecke_land 314 | 2503 1332 steinwall_turm_land 315 | 2521 1344 palisade_gerade_land 316 | 2522 1348 palisade_ecke_land 317 | 2523 1352 palisade_turm_land 318 | 2541 1364 steinwall_gerade_kueste 319 | 2542 1368 steinwall_ecke_kueste 320 | 2543 1372 steinwall_turm_kueste 321 | 2551 1396 steinwall_gerade_fluss 322 | 2552 1400 steinwall_ecke_fluss 323 | 2553 1404 steinwall_turm_fluss 324 | 2561 1380 palisade_gerade_kueste 325 | 2562 1384 palisade_ecke_kueste 326 | 2563 1388 palisade_turm_kueste 327 | 2601 400 truemmer0 328 | 2602 401 truemmer1 329 | 2603 402 truemmer2 330 | 2604 403 truemmer3 331 | 2605 404 truemmer4 332 | 2606 405 truemmer5 333 | 2610 413 truemmer1_kueste 334 | 2611 406 truemmer6 335 | 2612 407 truemmer7 336 | 2613 408 truemmer8 337 | 2614 409 truemmer9 338 | 2615 410 truemmer10 339 | 2616 411 truemmer11 340 | 2620 412 truemmer0_kueste 341 | 2621 664 verbranntes_feld0 342 | 2622 669 verbranntes_feld1 343 | 2631 426 wegreste0 zu überprüfen 344 | 2632 427 wegreste1 345 | 2633 428 wegreste2 346 | 2634 429 wegreste3 347 | 2635 430 wegreste4 348 | 2636 429 wegreste3 349 | 2637 430 wegreste4 350 | 2638 431 wegreste5 351 | 2701 80 gras0 352 | 2702 80 gras0 353 | 2703 80 gras0 354 | 2704 80 gras0 355 | 2705 108 gras7 356 | 2706 108 gras7 357 | 2707 16 sand0 358 | 2708 16 sand0 359 | 2709 80 gras0 360 | 2710 80 gras0 361 | 2711 80 gras0 362 | 2712 80 gras0 363 | 2713 80 gras0 364 | 2714 80 gras0 365 | 2715 80 gras0 366 | 2716 80 gras0 367 | 2717 80 gras0 368 | 2718 80 gras0 369 | 2719 80 gras0 370 | 2720 80 gras0 371 | 2721 120 gras0b 372 | 2722 120 gras0b 373 | 2723 124 gras1b 374 | 2724 124 gras1b 375 | 2725 128 gras2b 376 | 2726 128 gras2b 377 | 2727 132 gras3b 378 | 2728 132 gras3b 379 | 2729 136 gras4b 380 | 2730 136 gras4b 381 | 2731 140 gras5b 382 | 2732 140 gras5b 383 | 2733 144 gras6b 384 | 2734 144 gras6b 385 | 2735 148 gras7b 386 | 2736 148 gras7b 387 | 2737 152 gras8b 388 | 2738 152 gras8b 389 | 2739 156 gras9b 390 | 2740 156 gras9b 391 | 2741 160 pflanzen0b 392 | 2742 160 pflanzen0b 393 | 2743 164 pflanzen1b 394 | 2744 164 pflanzen1b 395 | 2745 168 pflanzen2b 396 | 2746 168 pflanzen2b 397 | 2747 172 pflanzen3b 398 | 2748 172 pflanzen3b 399 | 2749 176 pflanzen4b 400 | 2750 176 pflanzen4b 401 | 2751 180 pflanzen5b 402 | 2752 180 pflanzen5b 403 | 2753 184 pflanzen6b 404 | 2754 184 pflanzen6b 405 | 2755 188 pflanzen7b 406 | 2756 188 pflanzen7b 407 | 2757 192 pflanzen8b 408 | 2758 192 pflanzen8b 409 | 2759 196 pflanzen9b 410 | 2760 196 pflanzen9b 411 | 2761 280 wueste0 412 | 2762 280 wueste0 413 | 2763 284 wueste1 414 | 2764 284 wueste1 415 | 2765 288 wueste2 416 | 2766 288 wueste2 417 | 2767 292 wueste3 418 | 2768 292 wueste3 419 | 2769 296 wueste4 420 | 2770 296 wueste4 421 | 2771 300 wueste5 422 | 2772 300 wueste5 423 | 2773 304 wueste6 424 | 2774 304 wueste6 425 | 2775 308 wueste7 426 | 2776 308 wueste7 427 | 2777 312 wueste8 428 | 2778 312 wueste8 429 | 2779 316 wueste9 430 | 2780 316 wueste9 431 | 2781 320 gras0_braun 432 | 2782 320 gras0_braun 433 | 2783 324 gras1_braun 434 | 2784 324 gras1_braun 435 | 2785 328 gras2_braun 436 | 2786 328 gras2_braun 437 | 2787 332 gras3_braun 438 | 2788 332 gras3_braun 439 | 2789 336 gras4_braun 440 | 2790 336 gras4_braun 441 | 2791 340 gras5_braun 442 | 2792 340 gras5_braun 443 | 2793 344 gras6_braun 444 | 2794 344 gras6_braun 445 | 2795 348 gras7_braun 446 | 2796 348 gras7_braun 447 | 2797 352 gras8_braun 448 | 2798 352 gras8_braun 449 | 2799 356 gras9_braun 450 | 2800 356 gras9_braun 451 | 2801 1510 baum0_sued 452 | 2802 1515 baum0_sued_fertig 453 | 2803 1516 baum1_sued 454 | 2804 1521 baum1_sued_fertig 455 | 2805 1522 baum2_sued 456 | 2806 1527 baum2_sued_fertig 457 | 2807 1528 baum3_sued 458 | 2808 1533 baum3_sued_fertig 459 | 2809 1534 baum4_sued 460 | 2810 1539 baum4_sued_fertig 461 | 2811 1540 baum5_sued 462 | 2812 1545 baum5_sued_fertig 463 | 2813 1546 baum6_sued 464 | 2814 1551 baum6_sued_fertig 465 | 2815 1552 baum7_sued 466 | 2816 1557 baum7_sued_fertig 467 | 2817 1558 baum8_sued 468 | 2818 1563 baum8_sued_fertig 469 | 2819 1564 baum9_sued 470 | 2820 1569 baum9_sued_fertig 471 | 2821 1570 baum10_sued 472 | 2822 1575 baum10_sued_fertig 473 | -------------------------------------------------------------------------------- /src/grafiken_1602.txt: -------------------------------------------------------------------------------- 1 | 101 4 gras0_gruen 2 | 102 8 gras1_gruen 3 | 103 4 gras2_gruen 4 | 104 4 gras3_gruen 5 | 105 12 gras4_gruen 6 | 106 12 gras5_gruen 7 | 141 280 wueste0 8 | 142 284 wueste1 9 | 143 288 wueste2 10 | 144 292 wueste3 11 | 145 296 wueste4 12 | 146 300 wueste5 13 | 147 304 wueste6 14 | 148 308 wueste7 15 | 149 312 wueste8 16 | 150 316 wueste9 17 | 151 320 gras0_braun 18 | 152 324 gras1_braun 19 | 153 328 gras2_braun 20 | 154 332 gras3_braun 21 | 155 336 gras4_braun 22 | 156 340 gras5_braun 23 | 157 344 gras6_braun 24 | 158 348 gras7_braun 25 | 159 352 gras8_braun 26 | 160 356 gras9_braun 27 | 161 80 gras0 28 | 162 84 gras1 29 | 163 88 gras2 30 | 164 92 gras3 31 | 165 96 gras4 32 | 166 100 gras5 33 | 167 104 gras6 34 | 168 108 gras7 35 | 169 112 gras8 36 | 170 116 gras9 37 | 181 200 pflanzen0 38 | 182 204 pflanzen1 39 | 183 208 pflanzen2 40 | 184 212 pflanzen3 41 | 185 216 pflanzen4 42 | 186 220 pflanzen5 43 | 187 224 pflanzen6 44 | 188 228 pflanzen7 45 | 189 232 pflanzen8 46 | 190 236 pflanzen9 47 | 303 1396 stadttor 48 | 304 1340 tor_stein 49 | 305 1336 wachturm_stein_land 50 | 306 1376 wachturm_stein_kueste 51 | 311 5184 burg 52 | 313 5200 burg_gross 53 | 315 5236 festung 54 | 401 1260 strasse_gerade 55 | 402 1264 strasse_ecke 56 | 403 1268 strasse_t 57 | 404 1272 strasse_kreuzung 58 | 411 1280 weg_gerade 59 | 412 1284 weg_ecke 60 | 413 1288 weg_t 61 | 414 1292 weg_kreuzung 62 | 421 1300 platz1 63 | 422 1304 platz2 64 | 423 1308 platz3 65 | 424 1312 zierbaum 66 | 501 1816 windmuehle 67 | 503 3544 baeckerei 68 | 505 3560 schneiderei 69 | 507 3576 webstube 70 | 509 1816 wassermuehle platzhalter 71 | 511 3624 metzger 72 | 513 2336 steinmetz 73 | 515 3768 werkzeugschmiede 74 | 517 4108 schwertschmiede 75 | 519 3608 rumbrennerei 76 | 521 3688 erzschmelze 77 | 525 3640 tabakwarenladen 78 | 527 3928 kanonengiesserei 79 | 529 3848 musketenbauer 80 | 531 3592 weberei 81 | 533 3656 goldschmiede 82 | 605 2736 pionier1 83 | 606 2752 pionier2 84 | 607 2768 pionier3 85 | 608 2784 pionier4 86 | 609 2800 pionier5 87 | 610 2816 pionier6 88 | 611 2832 pionier7 89 | 621 2848 siedler1 90 | 622 2864 siedler2 91 | 623 2880 siedler3 92 | 624 2896 siedler4 93 | 625 2912 siedler5 94 | 631 2928 buerger1 95 | 632 2944 buerger2 96 | 633 2960 buerger3 97 | 634 3976 buerger4 98 | 635 3992 buerger5 99 | 636 3008 buerger6 100 | 641 3024 kaufleute1 101 | 642 3040 kaufleute2 102 | 643 3056 kaufleute3 103 | 644 3072 kaufleute4 104 | 645 3088 kaufleute5 105 | 651 3104 aristokraten1 106 | 652 3120 aristokraten2 107 | 653 3136 aristokraten3 108 | 654 3152 aristokraten4 109 | 655 3168 aristokraten5 110 | 656 3184 aristokraten6 111 | 801 4776 kathedrale 112 | 803 4920 kapelle 113 | 805 4872 kirche 114 | 807 4292 wirtshaus 115 | 809 4484 marktplatz 116 | 811 2544 feuerwehr 117 | 813 4436 badehaus 118 | 815 4928 theater 119 | 817 2640 arzt 120 | 819 5104 hochschule 121 | 821 5140 schule 122 | 831 4964 schloss 123 | 841 5156 galgen 124 | 851 5180 denkmal 125 | 901 1552 fluss0_gerade 126 | 902 1576 fluss1_gerade 127 | 903 1600 fluss0_gabelung 128 | 904 1624 fluss0_biegung 129 | 905 1720 fluss1_biegung 130 | 1011 1092 kueste0_1_2 131 | 1012 1096 kueste1_1_2 132 | 1013 1100 kueste2_1_2 133 | 1014 1104 kueste3_1_2 134 | 1015 1108 kueste4_1_2 135 | 1016 1112 kueste5_1_2 136 | 1017 1116 kueste6_1_2 137 | 1018 1120 kueste7_1_2 138 | 1019 1124 kueste8_1_2 139 | 1020 1128 kueste9_1_2 140 | 1031 1132 kueste0_3_4 141 | 1032 1136 kueste1_3_4 142 | 1033 1140 kueste2_3_4 143 | 1034 1144 kueste3_3_4 144 | 1051 1164 kueste0_1_4 145 | 1052 1168 kueste1_1_4 146 | 1053 1172 kueste2_1_4 147 | 1071 1196 kueste_muendung 148 | 1073 1316 anlegestelle 149 | 1075 1320 fischer 150 | 1081 1220 kueste0_felsig 151 | 1082 1224 kueste1_felsig 152 | 1083 1228 kueste2_felsig 153 | 1084 1232 kueste3_felsig 154 | 1103 5608 berg2 155 | 1104 5716 berg5 156 | 1105 5732 berg6 157 | 1106 5644 berg3 158 | 1107 5680 berg4 159 | 1108 5336 vulkan 160 | 1109 5400 berg0 161 | 1110 5464 berg1 162 | 1201 752 meer 163 | 1202 692 meer_flach_fischgruende 164 | 1203 680 meer_flach 165 | 1204 740 fischgruende 166 | 1205 812 strand0_1_2 167 | 1206 836 strand0_3_4 168 | 1207 860 strand0_1_4 169 | 1208 884 strand0_muendung 170 | 1209 764 fischgruende_meer 171 | 1214 908 strand1_1_2 172 | 1215 932 strand2_1_2 173 | 1216 956 strand3_1_2 174 | 1217 980 strand4_1_2 175 | 1218 1004 strand5_1_2 176 | 1221 1028 strand1_3_4 177 | 1231 1052 dreck0 178 | 1232 1056 dreck1 179 | 1233 1060 wrack 180 | 1234 1064 skelett 181 | 1235 1068 felsbogen0 182 | 1236 1072 felsbogen1 183 | 1237 1076 felsformation 184 | 1251 752 meer befischt 185 | 1252 692 meer_flach_fischgruende 186 | 1254 740 fischgruende befischt 187 | 1259 740 fischgruende befischt 188 | 1301 584 weizenfeld 189 | 1302 589 weizenfeld_fertig 190 | 1303 1420 baum0_nord 191 | 1304 1425 baum0_nord_fertig 192 | 1305 1426 baum1_nord 193 | 1306 1431 baum1_nord_fertig 194 | 1307 1432 baum2_nord 195 | 1308 1437 baum2_nord_fertig 196 | 1309 1438 baum3_nord 197 | 1310 1443 baum3_nord_fertig 198 | 1311 1444 baum4_nord 199 | 1312 1449 baum4_nord_fertig 200 | 1313 1450 baum5_nord 201 | 1314 1455 baum5_nord_fertig 202 | 1315 1456 baum6_nord 203 | 1316 1461 baum6_nord_fertig 204 | 1317 1462 baum7_nord 205 | 1318 1467 baum7_nord_fertig 206 | 1319 1468 baum8_nord 207 | 1320 1473 baum8_nord_fertig 208 | 1321 1474 baum9_nord 209 | 1322 1479 baum9_nord_fertig 210 | 1323 1480 baum10_nord 211 | 1324 1485 baum10_nord_fertig 212 | 1331 590 baumwollfeld 213 | 1332 595 baumwollfeld_fertig 214 | 1335 602 tabakfeld 215 | 1336 607 tabakfeld_fertig 216 | 1337 608 kakaofeld 217 | 1338 613 kakaofeld_fertig 218 | 1339 614 zuckerrohrfeld 219 | 1340 619 zuckerrohrfeld_fertig 220 | 1341 620 gewuerzfeld 221 | 1342 625 gewuerzfeld_fertig 222 | 1343 626 weinfeld 223 | 1344 631 weinfeld_fertig 224 | 1351 1486 baum0_sued 225 | 1352 1491 baum0_sued_fertig 226 | 1353 1492 baum1_sued 227 | 1354 1497 baum1_sued_fertig 228 | 1355 1498 baum2_sued 229 | 1356 1503 baum2_sued_fertig 230 | 1357 1504 baum3_sued 231 | 1358 1509 baum3_sued_fertig 232 | 1359 1510 baum4_sued 233 | 1360 1515 baum4_sued_fertig 234 | 1361 1516 baum5_sued 235 | 1362 1521 baum5_sued_fertig 236 | 1363 1522 baum6_sued 237 | 1364 1527 baum6_sued_fertig 238 | 1365 1528 baum7_sued 239 | 1366 1533 baum7_sued_fertig 240 | 1367 1534 baum8_sued 241 | 1368 1539 baum8_sued_fertig 242 | 1369 1540 baum9_sued 243 | 1370 1545 baum9_sued_fertig 244 | 1371 1546 baum10_sued 245 | 1372 1551 baum10_sued_fertig 246 | 1375 650 tabakfeld_trocken 247 | 1377 656 kakaofeld_trocken 248 | 1379 662 zuckerrohrfeld_trocken 249 | 1381 668 gewuerzfeld_trocken 250 | 1383 674 weinfeld_trocken 251 | 1405 1356 wachturm_holz_land 252 | 1406 1392 wachturm_holz_kueste 253 | 1501 2528 gewuerzplantage 254 | 1503 2400 bauernhof 255 | 1505 2416 baumwollplantage 256 | 1507 2464 tabakplantage 257 | 1509 2480 kakaoplantage 258 | 1511 2496 zuckerrohrplantage 259 | 1513 2432 rinderfarm 260 | 1515 2448 schaffarm 261 | 1517 2512 weingut 262 | 1601 1296 holzbruecke 263 | 1603 1276 steinbruecke 264 | 2001 2272 holzfaeller 265 | 2003 4192 jagdhuette 266 | 2101 4196 kontor1 267 | 2103 4220 kontor2 268 | 2105 4244 kontor3 269 | 2107 4268 kontor4 270 | 2111 4676 werft_gross 271 | 2115 4740 werft 272 | 2121 4340 kontor1_kaputt 273 | 2123 4364 kontor2_kaputt 274 | 2125 4388 kontor3_kaputt 275 | 2127 4412 kontor4_kaputt 276 | 2201 3200 haeuptlingshuette_stein 277 | 2202 3216 kriegerhuette_stein 278 | 2203 3232 eingeborenenhuette_stein 279 | 2204 3312 gewuerzlager_stein 280 | 2205 3328 tabaklager_stein 281 | 2211 3424 pyramide 282 | 2221 4316 piratenkontor 283 | 2222 3488 piratenhaus1 284 | 2223 3504 piratenhaus2 285 | 2224 3520 piratenwirtshaus 286 | 2231 3248 haeuptlingshuette 287 | 2232 3264 eingeborenenhuette 288 | 2233 3280 kriegerhuette 289 | 2234 3360 gewuerzlager 290 | 2235 3376 tabaklager 291 | 2241 3536 piratenturm_land 292 | 2242 3540 piratenturm_kueste 293 | 2301 432 hang0 294 | 2302 436 hang1 295 | 2303 440 hang2 296 | 2304 444 hang3 297 | 2305 448 hang4 298 | 2306 452 hang5 299 | 2307 456 hang6 300 | 2308 460 hang7 301 | 2309 464 hang8 302 | 2310 468 hang9 303 | 2311 552 quelle 304 | 2321 472 hang0_1_4 305 | 2322 476 hang1_1_4 306 | 2341 512 hang0_3_4 307 | 2342 516 hang1_3_4 308 | 2401 2080 erzmine 309 | 2403 2144 erzmine_tief 310 | 2405 2208 goldmine 311 | 2407 2072 steinbruch 312 | 2501 1324 steinwall_gerade_land 313 | 2502 1328 steinwall_ecke_land 314 | 2503 1332 steinwall_turm_land 315 | 2521 1344 palisade_gerade_land 316 | 2522 1348 palisade_ecke_land 317 | 2523 1352 palisade_turm_land 318 | 2541 1364 steinwall_gerade_kueste 319 | 2542 1368 steinwall_ecke_kueste 320 | 2543 1372 steinwall_turm_kueste 321 | 2551 1364 steinwall_gerade_fluss platzhalter 322 | 2552 1368 steinwall_ecke_fluss platzhalter 323 | 2553 1372 steinwall_turm_fluss platzhalter 324 | 2561 1380 palisade_gerade_kueste 325 | 2562 1384 palisade_ecke_kueste 326 | 2563 1388 palisade_turm_kueste 327 | 2601 400 truemmer0 328 | 2602 401 truemmer1 329 | 2603 402 truemmer2 330 | 2604 403 truemmer3 331 | 2605 404 truemmer4 332 | 2606 405 truemmer5 333 | 2610 413 truemmer1_kueste 334 | 2611 406 truemmer6 335 | 2612 407 truemmer7 336 | 2613 408 truemmer8 337 | 2614 409 truemmer9 338 | 2615 410 truemmer10 339 | 2616 411 truemmer11 340 | 2620 412 truemmer0_kueste 341 | 2621 664 verbranntes_feld0 342 | 2622 669 verbranntes_feld1 343 | 2631 426 wegreste0 zu überprüfen 344 | 2632 427 wegreste1 345 | 2633 428 wegreste2 346 | 2634 429 wegreste3 347 | 2635 430 wegreste4 348 | 2636 429 wegreste3 349 | 2637 430 wegreste4 350 | 2638 431 wegreste5 351 | 2701 80 gras0 352 | 2702 80 gras0 353 | 2703 80 gras0 354 | 2704 80 gras0 355 | 2705 108 gras7 356 | 2706 108 gras7 357 | 2707 16 sand0 358 | 2708 16 sand0 359 | 2709 80 gras0 360 | 2710 80 gras0 361 | 2711 80 gras0 362 | 2712 80 gras0 363 | 2713 80 gras0 364 | 2714 80 gras0 365 | 2715 80 gras0 366 | 2716 80 gras0 367 | 2717 80 gras0 368 | 2718 80 gras0 369 | 2719 80 gras0 370 | 2720 80 gras0 371 | 2721 120 gras0b 372 | 2722 120 gras0b 373 | 2723 124 gras1b 374 | 2724 124 gras1b 375 | 2725 128 gras2b 376 | 2726 128 gras2b 377 | 2727 132 gras3b 378 | 2728 132 gras3b 379 | 2729 136 gras4b 380 | 2730 136 gras4b 381 | 2731 140 gras5b 382 | 2732 140 gras5b 383 | 2733 144 gras6b 384 | 2734 144 gras6b 385 | 2735 148 gras7b 386 | 2736 148 gras7b 387 | 2737 152 gras8b 388 | 2738 152 gras8b 389 | 2739 156 gras9b 390 | 2740 156 gras9b 391 | 2741 160 pflanzen0b 392 | 2742 160 pflanzen0b 393 | 2743 164 pflanzen1b 394 | 2744 164 pflanzen1b 395 | 2745 168 pflanzen2b 396 | 2746 168 pflanzen2b 397 | 2747 172 pflanzen3b 398 | 2748 172 pflanzen3b 399 | 2749 176 pflanzen4b 400 | 2750 176 pflanzen4b 401 | 2751 180 pflanzen5b 402 | 2752 180 pflanzen5b 403 | 2753 184 pflanzen6b 404 | 2754 184 pflanzen6b 405 | 2755 188 pflanzen7b 406 | 2756 188 pflanzen7b 407 | 2757 192 pflanzen8b 408 | 2758 192 pflanzen8b 409 | 2759 196 pflanzen9b 410 | 2760 196 pflanzen9b 411 | 2761 280 wueste0 412 | 2762 280 wueste0 413 | 2763 284 wueste1 414 | 2764 284 wueste1 415 | 2765 288 wueste2 416 | 2766 288 wueste2 417 | 2767 292 wueste3 418 | 2768 292 wueste3 419 | 2769 296 wueste4 420 | 2770 296 wueste4 421 | 2771 300 wueste5 422 | 2772 300 wueste5 423 | 2773 304 wueste6 424 | 2774 304 wueste6 425 | 2775 308 wueste7 426 | 2776 308 wueste7 427 | 2777 312 wueste8 428 | 2778 312 wueste8 429 | 2779 316 wueste9 430 | 2780 316 wueste9 431 | 2781 320 gras0_braun 432 | 2782 320 gras0_braun 433 | 2783 324 gras1_braun 434 | 2784 324 gras1_braun 435 | 2785 328 gras2_braun 436 | 2786 328 gras2_braun 437 | 2787 332 gras3_braun 438 | 2788 332 gras3_braun 439 | 2789 336 gras4_braun 440 | 2790 336 gras4_braun 441 | 2791 340 gras5_braun 442 | 2792 340 gras5_braun 443 | 2793 344 gras6_braun 444 | 2794 344 gras6_braun 445 | 2795 348 gras7_braun 446 | 2796 348 gras7_braun 447 | 2797 352 gras8_braun 448 | 2798 352 gras8_braun 449 | 2799 356 gras9_braun 450 | 2800 356 gras9_braun 451 | 2801 1486 baum0_sued 452 | 2802 1491 baum0_sued_fertig 453 | 2803 1492 baum1_sued 454 | 2804 1497 baum1_sued_fertig 455 | 2805 1498 baum2_sued 456 | 2806 1503 baum2_sued_fertig 457 | 2807 1504 baum3_sued 458 | 2808 1509 baum3_sued_fertig 459 | 2809 1510 baum4_sued 460 | 2810 1515 baum4_sued_fertig 461 | 2811 1516 baum5_sued 462 | 2812 1521 baum5_sued_fertig 463 | 2813 1522 baum6_sued 464 | 2814 1527 baum6_sued_fertig 465 | 2815 1528 baum7_sued 466 | 2816 1533 baum7_sued_fertig 467 | 2817 1534 baum8_sued 468 | 2818 1539 baum8_sued_fertig 469 | 2819 1540 baum9_sued 470 | 2820 1545 baum9_sued_fertig 471 | 2821 1546 baum10_sued 472 | 2822 1551 baum10_sued_fertig 473 | -------------------------------------------------------------------------------- /src/kamera.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include "kamera.hpp" 21 | #include "grafiken.hpp" 22 | #include "files.hpp" 23 | 24 | const int Kamera::x_raster[3] = {8, 16, 32}; 25 | const int Kamera::y_raster[3] = {4, 8, 16}; 26 | const int Kamera::grundhoehe[3] = {5, 10, 20}; 27 | 28 | Kamera::Kamera() 29 | { 30 | xpos = Welt::KARTENBREITE / 2; 31 | ypos = Welt::KARTENHOEHE / 2; 32 | drehung = 0; 33 | vergroesserung = 1; 34 | auto files = Files::instance(); 35 | effekte_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/effekte.bsh")); 36 | effekte_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/effekte.bsh")); 37 | effekte_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/effekte.bsh")); 38 | 39 | // maeher_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/maeher.bsh")); 40 | // maeher_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/maeher.bsh")); 41 | // maeher_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/maeher.bsh")); 42 | 43 | // numbers_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/numbers.bsh")); 44 | // numbers_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/numbers.bsh")); 45 | // numbers_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/numbers.bsh")); 46 | 47 | ship_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/ship.bsh")); 48 | ship_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/ship.bsh")); 49 | ship_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/ship.bsh")); 50 | 51 | soldat_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/soldat.bsh")); 52 | soldat_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/soldat.bsh")); 53 | soldat_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/soldat.bsh")); 54 | 55 | stadtfld_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/stadtfld.bsh")); 56 | stadtfld_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/stadtfld.bsh")); 57 | stadtfld_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/stadtfld.bsh")); 58 | 59 | // tiere_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/tiere.bsh")); 60 | // tiere_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/tiere.bsh")); 61 | // tiere_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/tiere.bsh")); 62 | 63 | // traeger_bsh[0] = new Bsh_leser(files->instance()->get_file("sgfx/traeger.bsh")); 64 | // traeger_bsh[1] = new Bsh_leser(files->instance()->get_file("mgfx/traeger.bsh")); 65 | // traeger_bsh[2] = new Bsh_leser(files->instance()->get_file("gfx/traeger.bsh")); 66 | 67 | zei = new Zei_leser(files->instance()->get_file("toolgfx/zeig16g_zei")); 68 | 69 | stadtfld_grafiken = new Grafiken(files->instance()->get_file("grafiken.txt")); 70 | } 71 | 72 | void Kamera::gehe_zu(uint16_t x, uint16_t y) 73 | { 74 | xpos = (x < 0) ? 0 : ((x >= Welt::KARTENBREITE) ? Welt::KARTENBREITE - 1 : x); 75 | ypos = (y < 0) ? 0 : ((y >= Welt::KARTENHOEHE) ? Welt::KARTENHOEHE - 1 : y); 76 | } 77 | 78 | void Kamera::nach_links() 79 | { 80 | switch (drehung) 81 | { 82 | case 0: 83 | if (xpos > 0) 84 | xpos--; 85 | if (ypos < Welt::KARTENHOEHE - 1) 86 | ypos++; 87 | break; 88 | case 1: 89 | if (xpos < Welt::KARTENBREITE - 1) 90 | xpos++; 91 | if (ypos < Welt::KARTENHOEHE - 1) 92 | ypos++; 93 | break; 94 | case 2: 95 | if (xpos < Welt::KARTENBREITE - 1) 96 | xpos++; 97 | if (ypos > 0) 98 | ypos--; 99 | break; 100 | case 3: 101 | if (xpos > 0) 102 | xpos--; 103 | if (ypos > 0) 104 | ypos--; 105 | break; 106 | } 107 | } 108 | 109 | void Kamera::nach_rechts() 110 | { 111 | switch (drehung) 112 | { 113 | case 0: 114 | if (xpos < Welt::KARTENBREITE - 1) 115 | xpos++; 116 | if (ypos > 0) 117 | ypos--; 118 | break; 119 | case 1: 120 | if (xpos > 0) 121 | xpos--; 122 | if (ypos > 0) 123 | ypos--; 124 | break; 125 | case 2: 126 | if (xpos > 0) 127 | xpos--; 128 | if (ypos < Welt::KARTENHOEHE - 1) 129 | ypos++; 130 | break; 131 | case 3: 132 | if (xpos < Welt::KARTENBREITE - 1) 133 | xpos++; 134 | if (ypos < Welt::KARTENHOEHE - 1) 135 | ypos++; 136 | break; 137 | } 138 | } 139 | 140 | void Kamera::nach_oben() 141 | { 142 | switch (drehung) 143 | { 144 | case 0: 145 | if (xpos > 0) 146 | xpos--; 147 | if (ypos > 0) 148 | ypos--; 149 | break; 150 | case 1: 151 | if (xpos > 0) 152 | xpos--; 153 | if (ypos < Welt::KARTENHOEHE - 1) 154 | ypos++; 155 | break; 156 | case 2: 157 | if (xpos < Welt::KARTENBREITE - 1) 158 | xpos++; 159 | if (ypos < Welt::KARTENHOEHE - 1) 160 | ypos++; 161 | break; 162 | case 3: 163 | if (xpos < Welt::KARTENBREITE - 1) 164 | xpos++; 165 | if (ypos > 0) 166 | ypos--; 167 | break; 168 | } 169 | } 170 | 171 | void Kamera::nach_unten() 172 | { 173 | switch (drehung) 174 | { 175 | case 0: 176 | if (xpos < Welt::KARTENBREITE - 1) 177 | xpos++; 178 | if (ypos < Welt::KARTENHOEHE - 1) 179 | ypos++; 180 | break; 181 | case 1: 182 | if (xpos < Welt::KARTENBREITE - 1) 183 | xpos++; 184 | if (ypos > 0) 185 | ypos--; 186 | break; 187 | case 2: 188 | if (xpos > 0) 189 | xpos--; 190 | if (ypos > 0) 191 | ypos--; 192 | break; 193 | case 3: 194 | if (xpos > 0) 195 | xpos--; 196 | if (ypos < Welt::KARTENHOEHE - 1) 197 | ypos++; 198 | break; 199 | } 200 | } 201 | 202 | void Kamera::vergroessern() 203 | { 204 | if (vergroesserung < 2) 205 | vergroesserung++; 206 | } 207 | 208 | void Kamera::verkleinern() 209 | { 210 | if (vergroesserung > 0) 211 | vergroesserung--; 212 | } 213 | 214 | void Kamera::setze_vergroesserung(uint8_t vergroesserung) 215 | { 216 | this->vergroesserung = vergroesserung; 217 | } 218 | 219 | void Kamera::links_drehen() 220 | { 221 | drehung = (drehung + 3) % 4; 222 | } 223 | 224 | void Kamera::rechts_drehen() 225 | { 226 | drehung = (drehung + 1) % 4; 227 | } 228 | 229 | void Kamera::auf_bildschirm(Bildspeicher& bs, int karte_x, int karte_y, int& bildschirm_x, int& bildschirm_y) 230 | { 231 | int x = karte_x - xpos; 232 | int y = karte_y - ypos; 233 | switch (drehung) 234 | { 235 | case 0: 236 | bildschirm_x = bs.breite / 2 + (x - y - 1) * x_raster[vergroesserung]; 237 | bildschirm_y = bs.hoehe / 2 + (x + y) * y_raster[vergroesserung]; 238 | break; 239 | case 1: // TODO: Fälle 1-3 überprüfen 240 | bildschirm_x = bs.breite / 2 + (-x - y - 1) * x_raster[vergroesserung]; 241 | bildschirm_y = bs.hoehe / 2 + (x + -y) * y_raster[vergroesserung]; 242 | break; 243 | case 2: 244 | bildschirm_x = bs.breite / 2 - (x - y - 1) * x_raster[vergroesserung]; 245 | bildschirm_y = bs.hoehe / 2 - (x + y) * y_raster[vergroesserung]; 246 | break; 247 | case 3: 248 | bildschirm_x = bs.breite / 2 - (-x - y - 1) * x_raster[vergroesserung]; 249 | bildschirm_y = bs.hoehe / 2 - (x + -y) * y_raster[vergroesserung]; 250 | break; 251 | } 252 | } 253 | 254 | void Kamera::auf_bildschirm(Bildspeicher& bs, int karte_x, int karte_y, int karte_z, int& bildschirm_x, int& bildschirm_y, int& bildschirm_z) 255 | { 256 | auf_bildschirm(bs, karte_x, karte_y, bildschirm_x, bildschirm_y); 257 | int x = karte_x - xpos; 258 | int y = karte_y - ypos; 259 | switch (drehung) 260 | { 261 | case 0: bildschirm_z = x + y; break; 262 | case 1: bildschirm_z = x - y; break; 263 | case 2: bildschirm_z = -(x + y); break; 264 | case 3: bildschirm_z = -(x - y); break; 265 | } 266 | bildschirm_y -= karte_z * grundhoehe[vergroesserung]; 267 | bildschirm_z *= 256; 268 | } 269 | 270 | void Kamera::auf_bildschirm_256(Bildspeicher& bs, int karte_x, int karte_y, int karte_z, int& bildschirm_x, int& bildschirm_y, int& bildschirm_z) 271 | { 272 | int x = karte_x - 256 * xpos; 273 | int y = karte_y - 256 * ypos; 274 | switch (drehung) 275 | { 276 | case 0: 277 | bildschirm_x = bs.breite / 2 + (x - y - 256) * x_raster[vergroesserung] / 256; 278 | bildschirm_y = bs.hoehe / 2 + (x + y) * y_raster[vergroesserung] / 256; 279 | bildschirm_z = x + y; 280 | break; 281 | case 1: // TODO: Fälle 1-3 überprüfen 282 | bildschirm_x = bs.breite / 2 + (-x - y - 256) * x_raster[vergroesserung] / 256; 283 | bildschirm_y = bs.hoehe / 2 + (x + -y) * y_raster[vergroesserung] / 256; 284 | bildschirm_z = x - y; 285 | break; 286 | case 2: 287 | bildschirm_x = bs.breite / 2 - (x - y - 256) * x_raster[vergroesserung] / 256; 288 | bildschirm_y = bs.hoehe / 2 - (x + y) * y_raster[vergroesserung] / 256; 289 | bildschirm_z = -(x + y); 290 | break; 291 | case 3: 292 | bildschirm_x = bs.breite / 2 - (-x - y - 256) * x_raster[vergroesserung] / 256; 293 | bildschirm_y = bs.hoehe / 2 - (x + -y) * y_raster[vergroesserung] / 256; 294 | bildschirm_z = -(x - y); 295 | break; 296 | } 297 | bildschirm_y -= karte_z * grundhoehe[vergroesserung] / 256; 298 | } 299 | 300 | void Kamera::auf_karte(Bildspeicher& bs, int bildschirm_x, int bildschirm_y, int& karte_x, int& karte_y) 301 | { 302 | int temp1 = (bildschirm_x - (int)bs.breite / 2) / x_raster[vergroesserung]; 303 | int temp2 = (bildschirm_y - (int)bs.hoehe / 2) / y_raster[vergroesserung]; 304 | int temp3 = (temp2 - temp1 + 1) / 2; 305 | switch (drehung) 306 | { 307 | case 0: 308 | karte_x = temp1 + temp3 + xpos; 309 | karte_y = temp3 + ypos; 310 | break; 311 | case 1: // TODO: Fälle 1-3 überprüfen 312 | karte_x = temp3 + xpos; 313 | karte_y = -(temp1 + temp3) + ypos; 314 | break; 315 | case 2: 316 | karte_x = -(temp1 + temp3) + xpos; 317 | karte_y = -temp3 + ypos; 318 | break; 319 | case 3: 320 | karte_x = -temp3 + xpos; 321 | karte_y = temp1 + temp3 + ypos; 322 | break; 323 | } 324 | } 325 | 326 | 327 | struct bild_mit_pos_t 328 | { 329 | Bsh_bild* bild; 330 | int bs_x; 331 | int bs_y; 332 | int bs_z; 333 | int x; 334 | int y; 335 | bool sp; 336 | }; 337 | 338 | 339 | void Kamera::zeichne_bild(Bildspeicher& bs, Welt& welt, int maus_x, int maus_y) 340 | { 341 | bool feld_unter_maus = false; 342 | int feld_unter_maus_x, feld_unter_maus_y; 343 | 344 | int karte_x, karte_y; 345 | auf_karte(bs, -x_raster[vergroesserung], -2 * y_raster[vergroesserung], karte_x, karte_y); 346 | int bildschirm_x, bildschirm_y; 347 | auf_bildschirm(bs, karte_x, karte_y, bildschirm_x, bildschirm_y); 348 | int felder_horizontal = bs.breite / x_raster[vergroesserung] / 2 + 2; 349 | int felder_vertikal = bs.hoehe / y_raster[vergroesserung] / 2 + 8; 350 | 351 | int ausdehnung = (felder_horizontal + felder_vertikal) / 2; 352 | 353 | std::vector felder; 354 | for (int y = ypos - ausdehnung; y < ypos + ausdehnung; y++) 355 | { 356 | for (int x = xpos - ausdehnung; x < xpos + ausdehnung; x++) 357 | { 358 | inselfeld_t inselfeld; 359 | welt.feld_an_pos(inselfeld, x, y); 360 | feld_t feld; 361 | Insel::grafik_bebauung_inselfeld(feld, inselfeld, drehung, *welt.bebauung, *stadtfld_grafiken); 362 | if (feld.index != -1) 363 | { 364 | int bs_x, bs_y, bs_z; 365 | auf_bildschirm(bs, x, y, feld.grundhoehe, bs_x, bs_y, bs_z); 366 | bild_mit_pos_t bild_mit_pos = {&stadtfld_bsh[vergroesserung]->gib_bsh_bild(feld.index), bs_x, bs_y + y_raster[vergroesserung], bs_z, x, y, true}; 367 | felder.push_back(bild_mit_pos); 368 | } 369 | } 370 | } 371 | 372 | 373 | for (auto& map_elem : welt.animationen) 374 | { 375 | Animation& animation = map_elem.second; 376 | int bs_x, bs_y, bs_z; 377 | auf_bildschirm_256(bs, animation.x, animation.y, animation.z, bs_x, bs_y, bs_z); 378 | bild_mit_pos_t bild_mit_pos = {&effekte_bsh[vergroesserung]->gib_bsh_bild(animation.start_index + animation.ani), bs_x, bs_y, bs_z + animation.bs_z_versatz, 379 | map_elem.first.first, map_elem.first.second, false}; 380 | felder.push_back(bild_mit_pos); 381 | } 382 | 383 | for (Ship& schiff : welt.schiffe) 384 | { 385 | int index; 386 | switch (schiff.typ) 387 | { 388 | case 0x15: index = 0; break; // kleines Handelsschiff 389 | case 0x17: index = 32; break; // großes Handelsschiff 390 | case 0x1b: index = 48; break; // großes Kriegsschiff 391 | case 0x1d: index = 16; break; // fliegender Händler 392 | case 0x19: index = 64; break; // kleines Kriegsschiff 393 | case 0x1f: index = 80; break; // Piratenschiff TODO: fahrender Händler (0x25) 394 | default: index = 0; 395 | } 396 | int bs_x, bs_y, bs_z; 397 | auf_bildschirm(bs, schiff.x_pos, schiff.y_pos, 0, bs_x, bs_y, bs_z); 398 | // zeichne Bugwellen 399 | if ((schiff.kurs_ziel & 0xff) != 0) // FIXME: Bedeutet dies wirklich, dass das Schiff fährt? 400 | { 401 | Bsh_bild& wellen = ship_bsh[vergroesserung]->gib_bsh_bild(12 * schiff.richtung + 96); 402 | felder.push_back({&wellen, bs_x, bs_y + y_raster[vergroesserung] * 2, bs_z + 512, schiff.x_pos, schiff.y_pos, false}); 403 | } 404 | // zeichne Schiff 405 | Bsh_bild& bsh = ship_bsh[vergroesserung]->gib_bsh_bild(index + schiff.richtung); // FIXME 406 | felder.push_back({&bsh, bs_x, bs_y + y_raster[vergroesserung], bs_z + 512, schiff.x_pos, schiff.y_pos, false}); 407 | // zeichne Flagge 408 | if (schiff.spieler != 4) 409 | { 410 | uint8_t nummer = (schiff.spieler < 4) ? welt.spielerfarbe(schiff.spieler) : schiff.spieler; 411 | Bsh_bild& flagge = ship_bsh[vergroesserung]->gib_bsh_bild(192 + nummer * 8); 412 | felder.push_back({&flagge, bs_x, bs_y + y_raster[vergroesserung], bs_z + 512, schiff.x_pos, schiff.y_pos, false}); 413 | } 414 | } 415 | 416 | for (Soldat& soldat : welt.soldaten) 417 | { 418 | int index; 419 | switch (soldat.typ) 420 | { 421 | case 1: index = 0; break; // Infanterist, rot 422 | case 2: index = 280; break; // Infanterist, blau 423 | case 3: index = 560; break; // Infanterist, gelb 424 | case 4: index = 840; break; // Infanterist, grau 425 | case 5: index = 1120; break; // Kavallerist, rot 426 | case 6: index = 1424; break; // Kavallerist, blau 427 | case 7: index = 1728; break; // Kavallerist, gelb 428 | case 8: index = 2032; break; // Kavallerist, grau 429 | case 9: index = 3200; break; // Musketier, rot 430 | case 10: index = 3336; break; // Musketier, blau 431 | case 11: index = 3472; break; // Musketier, gelb 432 | case 12: index = 3608; break; // Musketier, grau 433 | case 13: index = 2336; break; // Kanonier, rot 434 | case 14: index = 2552; break; // Kanonier, blau 435 | case 15: index = 2768; break; // Kanonier, gelb 436 | case 16: index = 2984; break; // Kanonier, grau 437 | case 33: index = 3744; break; // Eingeborener 438 | default: index = 0; 439 | } 440 | Bsh_bild& bsh = soldat_bsh[vergroesserung]->gib_bsh_bild(index + soldat.richtung * 8); // FIXME 441 | int bs_x, bs_y, bs_z; 442 | auf_bildschirm_256(bs, soldat.x_pos_2 * 128, soldat.y_pos_2 * 128, 256, bs_x, bs_y, bs_z); 443 | felder.push_back({&bsh, bs_x, bs_y + y_raster[vergroesserung], bs_z + 256, soldat.x_pos_2 / 2, soldat.y_pos_2 / 2, false}); 444 | } 445 | 446 | std::stable_sort(felder.begin(), felder.end(), [](const bild_mit_pos_t& a, const bild_mit_pos_t& b) { return a.bs_z < b.bs_z; }); 447 | 448 | for (bild_mit_pos_t& feld : felder) 449 | { 450 | bool schnitt; 451 | bs.zeichne_bsh_bild_sp_oz(*feld.bild, feld.bs_x, feld.bs_y, maus_x, maus_y, schnitt); 452 | if (schnitt && feld.sp) 453 | { 454 | feld_unter_maus_x = feld.x; 455 | feld_unter_maus_y = feld.y; 456 | feld_unter_maus = true; 457 | } 458 | } 459 | 460 | 461 | bs.setze_schriftfarbe(245, 0); 462 | bs.zeichne_string(*zei, "aktuelle Position:", 10, 10); 463 | bs.zeichne_string(*zei, "(" + std::to_string(xpos) + ", " + std::to_string(ypos) + ")", 10, 30); 464 | if (feld_unter_maus) 465 | { 466 | inselfeld_t inselfeld; 467 | welt.feld_an_pos(inselfeld, feld_unter_maus_x, feld_unter_maus_y); 468 | bs.zeichne_string(*zei, "Bebauung unter Mauszeiger:", 10, 60); 469 | bs.zeichne_string(*zei, std::to_string(inselfeld.bebauung), 10, 80); 470 | bs.zeichne_string(*zei, "Position und Insel unter Mauszeiger:", 10, 110); 471 | bs.zeichne_string(*zei, 472 | "(" + std::to_string(feld_unter_maus_x) + ", " + std::to_string(feld_unter_maus_y) + ") Insel " 473 | + std::to_string(welt.inselnummer_an_pos(feld_unter_maus_x, feld_unter_maus_y)), 474 | 10, 130); 475 | } 476 | } 477 | -------------------------------------------------------------------------------- /src/bebauung.txt: -------------------------------------------------------------------------------- 1 | ; 2 | ; Diese Datei enthält Metadaten zur Bebauung eines Inselfeldes. 3 | ; Die Informationen müssen zum verwendeten Grafikarchiv passen. 4 | ; 5 | ; _________ ID 6 | ; / ________ Breite (d.h. Breite des Gebäudes) 7 | ; / / _______ Höhe (d.h. Länge des Gebäudes) 8 | ; / / / ______ Richtungen (1 oder 4) 9 | ; / / / / _____ Animationsschritte 10 | ; / / / / / ____ Grundhöhe (0 oder 1) 11 | ; / / / / / / ___ Bauhöhe (0 oder 1) 12 | ; / / / / / / / __ Anzahl optisch unterscheidbarer Lagerstände 13 | ; / / / / / / / / _ Kategorie (0=keine, 1=Land, 2=Feld, 3=Haus, 4=Betrieb) 14 | ; / / / / / / / / / 15 | ; 16 | 17 | 101 1 1 4 1 1 0 1 1 gras0_gruen 18 | 102 1 1 4 1 1 0 1 1 gras1_gruen 19 | 103 1 1 4 1 1 0 1 1 gras2_gruen 20 | 104 1 1 4 1 1 0 1 1 gras3_gruen 21 | 105 1 1 4 1 1 0 1 1 gras4_gruen 22 | 106 1 1 4 1 1 0 1 1 gras5_gruen 23 | 141 1 1 4 1 1 0 1 1 wueste0 24 | 142 1 1 4 1 1 0 1 1 wueste1 25 | 143 1 1 4 1 1 0 1 1 wueste2 26 | 144 1 1 4 1 1 0 1 1 wueste3 27 | 145 1 1 4 1 1 0 1 1 wueste4 28 | 146 1 1 4 1 1 0 1 1 wueste5 29 | 147 1 1 4 1 1 0 1 1 wueste6 30 | 148 1 1 4 1 1 0 1 1 wueste7 31 | 149 1 1 4 1 1 0 1 1 wueste8 32 | 150 1 1 4 1 1 0 1 1 wueste9 33 | 151 1 1 4 1 1 0 1 1 gras0_braun 34 | 152 1 1 4 1 1 0 1 1 gras1_braun 35 | 153 1 1 4 1 1 0 1 1 gras2_braun 36 | 154 1 1 4 1 1 0 1 1 gras3_braun 37 | 155 1 1 4 1 1 0 1 1 gras4_braun 38 | 156 1 1 4 1 1 0 1 1 gras5_braun 39 | 157 1 1 4 1 1 0 1 1 gras6_braun 40 | 158 1 1 4 1 1 0 1 1 gras7_braun 41 | 159 1 1 4 1 1 0 1 1 gras8_braun 42 | 160 1 1 4 1 1 0 1 1 gras9_braun 43 | 161 1 1 4 1 1 0 1 1 gras0 44 | 162 1 1 4 1 1 0 1 1 gras1 45 | 163 1 1 4 1 1 0 1 1 gras2 46 | 164 1 1 4 1 1 0 1 1 gras3 47 | 165 1 1 4 1 1 0 1 1 gras4 48 | 166 1 1 4 1 1 0 1 1 gras5 49 | 167 1 1 4 1 1 0 1 1 gras6 50 | 168 1 1 4 1 1 0 1 1 gras7 51 | 169 1 1 4 1 1 0 1 1 gras8 52 | 170 1 1 4 1 1 0 1 1 gras9 53 | 181 1 1 4 1 1 0 1 1 pflanzen0 54 | 182 1 1 4 1 1 0 1 1 pflanzen1 55 | 183 1 1 4 1 1 0 1 1 pflanzen2 56 | 184 1 1 4 1 1 0 1 1 pflanzen3 57 | 185 1 1 4 1 1 0 1 1 pflanzen4 58 | 186 1 1 4 1 1 0 1 1 pflanzen5 59 | 187 1 1 4 1 1 0 1 1 pflanzen6 60 | 188 1 1 4 1 1 0 1 1 pflanzen7 61 | 189 1 1 4 1 1 0 1 1 pflanzen8 62 | 190 1 1 4 1 1 0 1 1 pflanzen9 63 | 303 1 3 4 1 1 1 1 0 stadttor 64 | 304 1 1 4 1 1 1 1 0 tor_stein 65 | 305 1 1 4 1 1 1 1 0 wachturm_stein_land 66 | 306 1 1 4 1 0 1 1 0 wachturm_stein_kueste 67 | 311 2 2 4 1 1 1 1 0 burg 68 | 313 3 3 4 1 1 1 1 0 burg_gross 69 | 315 5 5 4 1 1 1 1 0 festung 70 | 401 1 1 4 1 1 0 1 0 strasse_gerade 71 | 402 1 1 4 1 1 0 1 0 strasse_ecke 72 | 403 1 1 4 1 1 0 1 0 strasse_t 73 | 404 1 1 1 1 1 0 1 0 strasse_kreuzung 74 | 411 1 1 4 1 1 0 1 0 weg_gerade 75 | 412 1 1 4 1 1 0 1 0 weg_ecke 76 | 413 1 1 4 1 1 0 1 0 weg_t 77 | 414 1 1 1 1 1 0 1 0 weg_kreuzung 78 | 421 1 1 4 1 1 0 1 0 platz1 79 | 422 1 1 4 1 1 0 1 0 platz2 80 | 423 1 1 4 1 1 0 1 0 platz3 81 | 424 1 1 4 1 1 1 1 0 zierbaum 82 | 501 2 2 4 16 1 1 1 4 windmuehle 83 | 503 2 2 4 1 1 1 1 4 baeckerei 84 | 505 2 2 4 1 1 1 1 4 schneiderei 85 | 507 2 2 4 1 1 1 1 4 webstube 86 | 509 2 2 4 12 1 1 1 4 wassermuehle 87 | 511 2 2 4 1 1 1 1 4 metzger 88 | 513 2 2 4 1 1 1 4 4 steinmetz 89 | 515 2 2 4 5 1 1 1 4 werkzeugschmiede 90 | 517 2 2 4 5 1 1 1 4 schwertschmiede 91 | 519 2 2 4 1 1 1 1 4 rumbrennerei 92 | 521 2 2 4 5 1 1 1 4 erzschmelze 93 | 525 2 2 4 1 1 1 1 4 tabakwarenladen 94 | 527 3 3 4 5 1 1 1 4 kanonengiesserei 95 | 529 2 2 4 5 1 1 1 4 musketenbauer 96 | 531 2 2 4 1 1 1 1 4 weberei 97 | 533 2 2 4 1 1 1 1 4 goldschmiede 98 | 605 2 2 4 1 1 1 1 3 pionier1 99 | 606 2 2 4 1 1 1 1 3 pionier2 100 | 607 2 2 4 1 1 1 1 3 pionier3 101 | 608 2 2 4 1 1 1 1 3 pionier4 102 | 609 2 2 4 1 1 1 1 3 pionier5 103 | 610 2 2 4 1 1 1 1 3 pionier6 104 | 611 2 2 4 1 1 1 1 3 pionier7 105 | 621 2 2 4 1 1 1 1 3 siedler1 106 | 622 2 2 4 1 1 1 1 3 siedler2 107 | 623 2 2 4 1 1 1 1 3 siedler3 108 | 624 2 2 4 1 1 1 1 3 siedler4 109 | 625 2 2 4 1 1 1 1 3 siedler5 110 | 631 2 2 4 1 1 1 1 3 buerger1 111 | 632 2 2 4 1 1 1 1 3 buerger2 112 | 633 2 2 4 1 1 1 1 3 buerger3 113 | 634 2 2 4 1 1 1 1 3 buerger4 114 | 635 2 2 4 1 1 1 1 3 buerger5 115 | 636 2 2 4 1 1 1 1 3 buerger6 116 | 641 2 2 4 1 1 1 1 3 kaufleute1 117 | 642 2 2 4 1 1 1 1 3 kaufleute2 118 | 643 2 2 4 1 1 1 1 3 kaufleute3 119 | 644 2 2 4 1 1 1 1 3 kaufleute4 120 | 645 2 2 4 1 1 1 1 3 kaufleute5 121 | 651 2 2 4 1 1 1 1 3 aristokraten1 122 | 652 2 2 4 1 1 1 1 3 aristokraten2 123 | 653 2 2 4 1 1 1 1 3 aristokraten3 124 | 654 2 2 4 1 1 1 1 3 aristokraten4 125 | 655 2 2 4 1 1 1 1 3 aristokraten5 126 | 656 2 2 4 1 1 1 1 3 aristokraten6 127 | 801 6 4 4 1 1 1 1 0 kathedrale 128 | 803 2 1 4 1 1 1 1 0 kapelle 129 | 805 4 3 4 1 1 1 1 0 kirche 130 | 807 2 3 4 1 1 1 1 0 wirtshaus 131 | 809 4 3 4 1 1 1 1 0 marktplatz 132 | 811 2 2 4 6 1 1 1 0 feuerwehr 133 | 813 4 3 4 1 1 1 1 0 badehaus 134 | 815 3 3 4 1 1 1 1 0 theater 135 | 817 2 2 4 1 1 1 1 0 arzt 136 | 819 3 3 4 1 1 1 1 0 hochschule 137 | 821 2 2 4 1 1 1 1 0 schule 138 | 831 5 7 4 1 1 1 1 0 schloss 139 | 841 1 1 4 6 1 1 1 0 galgen 140 | 851 1 1 4 1 1 1 1 0 denkmal 141 | 901 1 1 4 6 1 0 1 0 fluss0_gerade 142 | 902 1 1 4 6 1 0 1 0 fluss1_gerade 143 | 903 1 1 4 6 1 0 1 0 fluss0_gabelung 144 | 904 2 2 4 6 1 0 1 0 fluss0_biegung 145 | 905 2 2 4 6 1 0 1 0 fluss1_biegung 146 | 1011 1 1 4 1 0 1 1 0 kueste0_1_2 147 | 1012 1 1 4 1 0 1 1 0 kueste1_1_2 148 | 1013 1 1 4 1 0 1 1 0 kueste2_1_2 149 | 1014 1 1 4 1 0 1 1 0 kueste3_1_2 150 | 1015 1 1 4 1 0 1 1 0 kueste4_1_2 151 | 1016 1 1 4 1 0 1 1 0 kueste5_1_2 152 | 1017 1 1 4 1 0 1 1 0 kueste6_1_2 153 | 1018 1 1 4 1 0 1 1 0 kueste7_1_2 154 | 1019 1 1 4 1 0 1 1 0 kueste8_1_2 155 | 1020 1 1 4 1 0 1 1 0 kueste9_1_2 156 | 1031 1 1 4 1 0 1 1 0 kueste0_3_4 157 | 1032 1 1 4 1 0 1 1 0 kueste1_3_4 158 | 1033 1 1 4 1 0 1 1 0 kueste2_3_4 159 | 1034 1 1 4 1 0 1 1 0 kueste3_3_4 160 | 1051 1 1 4 1 0 1 1 0 kueste0_1_4 161 | 1052 1 1 4 1 0 1 1 0 kueste1_1_4 162 | 1053 1 1 4 1 0 1 1 0 kueste2_1_4 163 | 1071 1 1 4 6 0 1 1 0 kueste_muendung 164 | 1073 1 1 4 1 0 0 1 0 anlegestelle 165 | 1075 1 1 4 1 0 1 1 4 fischer 166 | 1081 1 1 4 1 0 1 1 0 kueste0_felsig 167 | 1082 1 1 4 1 0 1 1 0 kueste1_felsig 168 | 1083 1 1 4 1 0 1 1 0 kueste2_felsig 169 | 1084 1 1 4 1 0 1 1 0 kueste3_felsig 170 | 1103 3 3 4 1 1 1 1 0 berg2 171 | 1104 2 2 4 1 1 1 1 0 berg5 172 | 1105 2 2 4 1 1 1 1 0 berg6 173 | 1106 3 3 4 1 1 1 1 0 berg3 174 | 1107 3 3 4 1 1 1 1 0 berg4 175 | 1108 4 4 4 1 1 1 1 0 vulkan 176 | 1109 4 4 4 1 1 1 1 0 berg0 177 | 1110 6 6 4 1 1 1 1 0 berg1 178 | 1201 1 1 1 12 0 0 1 0 meer 179 | 1202 1 1 4 12 0 0 1 0 meer_flach_fischgruende 180 | 1203 1 1 1 12 0 0 1 0 meer_flach 181 | 1204 1 1 1 12 0 0 1 0 fischgruende 182 | 1205 1 1 4 6 0 0 1 0 strand0_1_2 183 | 1206 1 1 4 6 0 0 1 0 strand0_3_4 184 | 1207 1 1 4 6 0 0 1 0 strand0_1_4 185 | 1208 1 1 4 6 0 0 1 0 strand0_muendung 186 | 1209 1 1 4 12 0 0 1 0 fischgruende_meer 187 | 1214 1 1 4 6 0 0 1 0 strand1_1_2 188 | 1215 1 1 4 6 0 0 1 0 strand2_1_2 189 | 1216 1 1 4 6 0 0 1 0 strand3_1_2 190 | 1217 1 1 4 6 0 0 1 0 strand4_1_2 191 | 1218 1 1 4 6 0 0 1 0 strand5_1_2 192 | 1221 1 1 4 6 0 0 1 0 strand1_3_4 193 | 1231 1 1 4 1 0 1 1 0 dreck0 194 | 1232 1 1 4 1 0 1 1 0 dreck1 195 | 1233 1 1 4 1 0 1 1 0 wrack 196 | 1234 1 1 4 1 0 1 1 0 skelett 197 | 1235 1 1 4 1 0 1 1 0 felsbogen0 198 | 1236 1 1 4 1 0 1 1 0 felsbogen1 199 | 1237 1 1 4 1 0 1 1 0 felsformation 200 | 1251 1 1 1 12 0 0 1 0 meer befischt 201 | 1252 1 1 4 12 0 0 1 0 meer_flach_fischgruende 202 | 1254 1 1 1 12 0 0 1 0 fischgruende befischt 203 | 1259 1 1 1 12 0 0 1 0 fischgruende befischt 204 | 1301 1 1 1 6 1 0 1 2 weizenfeld 205 | 1302 1 1 1 1 1 0 1 2 weizenfeld_fertig 206 | 1303 1 1 1 6 1 1 1 1 baum0_nord 207 | 1304 1 1 1 1 1 1 1 1 baum0_nord_fertig 208 | 1305 1 1 1 6 1 1 1 1 baum1_nord 209 | 1306 1 1 1 1 1 1 1 1 baum1_nord_fertig 210 | 1307 1 1 1 6 1 1 1 1 baum2_nord 211 | 1308 1 1 1 1 1 1 1 1 baum2_nord_fertig 212 | 1309 1 1 1 6 1 1 1 1 baum3_nord 213 | 1310 1 1 1 1 1 1 1 1 baum3_nord_fertig 214 | 1311 1 1 1 6 1 1 1 1 baum4_nord 215 | 1312 1 1 1 1 1 1 1 1 baum4_nord_fertig 216 | 1313 1 1 1 6 1 1 1 1 baum5_nord 217 | 1314 1 1 1 1 1 1 1 1 baum5_nord_fertig 218 | 1315 1 1 1 6 1 1 1 1 baum6_nord 219 | 1316 1 1 1 1 1 1 1 1 baum6_nord_fertig 220 | 1317 1 1 1 6 1 1 1 1 baum7_nord 221 | 1318 1 1 1 1 1 1 1 1 baum7_nord_fertig 222 | 1319 1 1 1 6 1 1 1 1 baum8_nord 223 | 1320 1 1 1 1 1 1 1 1 baum8_nord_fertig 224 | 1321 1 1 1 6 1 1 1 1 baum9_nord 225 | 1322 1 1 1 1 1 1 1 1 baum9_nord_fertig 226 | 1323 1 1 1 6 1 1 1 1 baum10_nord 227 | 1324 1 1 1 1 1 1 1 1 baum10_nord_fertig 228 | 1331 1 1 1 6 1 0 1 2 baumwollfeld 229 | 1332 1 1 1 1 1 0 1 2 baumwollfeld_fertig 230 | 1335 1 1 1 6 1 0 1 2 tabakfeld 231 | 1336 1 1 1 1 1 0 1 2 tabakfeld_fertig 232 | 1337 1 1 1 6 1 0 1 2 kakaofeld 233 | 1338 1 1 1 1 1 0 1 2 kakaofeld_fertig 234 | 1339 1 1 1 6 1 0 1 2 zuckerrohrfeld 235 | 1340 1 1 1 1 1 0 1 2 zuckerrohrfeld_fertig 236 | 1341 1 1 1 6 1 0 1 2 gewuerzfeld 237 | 1342 1 1 1 1 1 0 1 2 gewuerzfeld_fertig 238 | 1343 1 1 1 6 1 0 1 2 weinfeld 239 | 1344 1 1 1 1 1 0 1 2 weinfeld_fertig 240 | 1351 1 1 1 6 1 1 1 1 baum0_sued 241 | 1352 1 1 1 1 1 1 1 1 baum0_sued_fertig 242 | 1353 1 1 1 6 1 1 1 1 baum1_sued 243 | 1354 1 1 1 1 1 1 1 1 baum1_sued_fertig 244 | 1355 1 1 1 6 1 1 1 1 baum2_sued 245 | 1356 1 1 1 1 1 1 1 1 baum2_sued_fertig 246 | 1357 1 1 1 6 1 1 1 1 baum3_sued 247 | 1358 1 1 1 1 1 1 1 1 baum3_sued_fertig 248 | 1359 1 1 1 6 1 1 1 1 baum4_sued 249 | 1360 1 1 1 1 1 1 1 1 baum4_sued_fertig 250 | 1361 1 1 1 6 1 1 1 1 baum5_sued 251 | 1362 1 1 1 1 1 1 1 1 baum5_sued_fertig 252 | 1363 1 1 1 6 1 1 1 1 baum6_sued 253 | 1364 1 1 1 1 1 1 1 1 baum6_sued_fertig 254 | 1365 1 1 1 6 1 1 1 1 baum7_sued 255 | 1366 1 1 1 1 1 1 1 1 baum7_sued_fertig 256 | 1367 1 1 1 6 1 1 1 1 baum8_sued 257 | 1368 1 1 1 1 1 1 1 1 baum8_sued_fertig 258 | 1369 1 1 1 6 1 1 1 1 baum9_sued 259 | 1370 1 1 1 1 1 1 1 1 baum9_sued_fertig 260 | 1371 1 1 1 6 1 1 1 1 baum10_sued 261 | 1372 1 1 1 1 1 1 1 1 baum10_sued_fertig 262 | 1375 1 1 1 6 1 0 1 2 tabakfeld_trocken 263 | 1377 1 1 1 6 1 0 1 2 kakaofeld_trocken 264 | 1379 1 1 1 6 1 0 1 2 zuckerrohrfeld_trocken 265 | 1381 1 1 1 6 1 0 1 2 gewuerzfeld_trocken 266 | 1383 1 1 1 6 1 0 1 2 weinfeld_trocken 267 | 1405 1 1 4 1 1 1 1 0 wachturm_holz_land 268 | 1406 1 1 4 1 0 1 1 0 wachturm_holz_kueste 269 | 1501 2 2 4 1 1 1 1 4 gewuerzplantage 270 | 1503 2 2 4 1 1 1 1 4 bauernhof 271 | 1505 2 2 4 1 1 1 1 4 baumwollplantage 272 | 1507 2 2 4 1 1 1 1 4 tabakplantage 273 | 1509 2 2 4 1 1 1 1 4 kakaoplantage 274 | 1511 2 2 4 1 1 1 1 4 zuckerrohrplantage 275 | 1513 2 2 4 1 1 1 1 4 rinderfarm 276 | 1515 2 2 4 1 1 1 1 4 schaffarm 277 | 1517 2 2 4 1 1 1 1 4 weingut 278 | 1601 1 1 4 1 1 0 1 0 holzbruecke 279 | 1603 1 1 4 1 1 0 1 0 steinbruecke 280 | 2001 2 2 4 1 1 1 4 4 holzfaeller 281 | 2003 1 1 4 1 1 1 1 4 jagdhuette 282 | 2101 2 3 4 1 1 1 1 0 kontor1 283 | 2103 2 3 4 1 1 1 1 0 kontor2 284 | 2105 2 3 4 1 1 1 1 0 kontor3 285 | 2107 2 3 4 1 1 1 1 0 kontor4 286 | 2111 4 4 4 1 0 1 1 0 werft_gross 287 | 2115 3 3 4 1 0 1 1 0 werft 288 | 2121 2 3 4 1 1 1 1 0 kontor1_kaputt 289 | 2123 2 3 4 1 1 1 1 0 kontor2_kaputt 290 | 2125 2 3 4 1 1 1 1 0 kontor3_kaputt 291 | 2127 2 3 4 1 1 1 1 0 kontor4_kaputt 292 | 2201 2 2 4 1 1 1 1 0 haeuptlingshuette_stein 293 | 2202 2 2 4 1 1 1 1 0 kriegerhuette_stein 294 | 2203 2 2 4 1 1 1 1 0 eingeborenenhuette_stein 295 | 2204 2 2 4 1 1 1 1 4 gewuerzlager_stein 296 | 2205 2 2 4 1 1 1 1 4 tabaklager_stein 297 | 2211 4 4 4 1 1 1 1 0 pyramide 298 | 2221 2 3 4 1 1 1 1 0 piratenkontor 299 | 2222 2 2 4 1 1 1 1 0 piratenhaus1 300 | 2223 2 2 4 1 1 1 1 0 piratenhaus2 301 | 2224 2 2 4 1 1 1 1 0 piratenwirtshaus 302 | 2231 2 2 4 1 1 1 1 0 haeuptlingshuette 303 | 2232 2 2 4 1 1 1 1 0 eingeborenenhuette 304 | 2233 2 2 4 1 1 1 1 0 kriegerhuette 305 | 2234 2 2 4 1 1 1 1 4 gewuerzlager 306 | 2235 2 2 4 1 1 1 1 4 tabaklager 307 | 2241 1 1 4 1 1 1 1 0 piratenturm_land 308 | 2242 1 1 4 1 0 1 1 0 piratenturm_kueste 309 | 2301 1 1 4 1 1 1 1 0 hang0 310 | 2302 1 1 4 1 1 1 1 0 hang1 311 | 2303 1 1 4 1 1 1 1 0 hang2 312 | 2304 1 1 4 1 1 1 1 0 hang3 313 | 2305 1 1 4 1 1 1 1 0 hang4 314 | 2306 1 1 4 1 1 1 1 0 hang5 315 | 2307 1 1 4 1 1 1 1 0 hang6 316 | 2308 1 1 4 1 1 1 1 0 hang7 317 | 2309 1 1 4 1 1 1 1 0 hang8 318 | 2310 1 1 4 1 1 1 1 0 hang9 319 | 2311 1 1 4 6 1 1 1 0 quelle 320 | 2321 1 1 4 1 1 1 1 0 hang0_1_4 321 | 2322 1 1 4 1 1 1 1 0 hang1_1_4 322 | 2341 1 1 4 1 1 1 1 0 hang0_3_4 323 | 2342 1 1 4 1 1 1 1 0 hang1_3_4 324 | 2401 1 2 4 8 1 1 1 4 erzmine 325 | 2403 1 2 4 8 1 1 1 4 erzmine_tief 326 | 2405 1 2 4 8 1 1 1 4 goldmine 327 | 2407 1 2 4 1 1 1 1 4 steinbruch 328 | 2501 1 1 4 1 1 1 1 0 steinwall_gerade_land 329 | 2502 1 1 4 1 1 1 1 0 steinwall_ecke_land 330 | 2503 1 1 4 1 1 1 1 0 steinwall_turm_land 331 | 2521 1 1 4 1 1 1 1 0 palisade_gerade_land 332 | 2522 1 1 4 1 1 1 1 0 palisade_ecke_land 333 | 2523 1 1 4 1 1 1 1 0 palisade_turm_land 334 | 2541 1 1 4 1 0 1 1 0 steinwall_gerade_kueste 335 | 2542 1 1 4 1 0 1 1 0 steinwall_ecke_kueste 336 | 2543 1 1 4 1 0 1 1 0 steinwall_turm_kueste 337 | 2551 1 1 4 1 0 1 1 0 steinwall_gerade_fluss 338 | 2552 1 1 4 1 0 1 1 0 steinwall_ecke_fluss 339 | 2553 1 1 4 1 0 1 1 0 steinwall_turm_fluss 340 | 2561 1 1 4 1 0 1 1 0 palisade_gerade_kueste 341 | 2562 1 1 4 1 0 1 1 0 palisade_ecke_kueste 342 | 2563 1 1 4 1 0 1 1 0 palisade_turm_kueste 343 | 2601 1 1 1 1 1 0 1 0 truemmer0 344 | 2602 1 1 1 1 1 0 1 0 truemmer1 345 | 2603 1 1 1 1 1 0 1 0 truemmer2 346 | 2604 1 1 1 1 1 0 1 0 truemmer3 347 | 2605 1 1 1 1 1 0 1 0 truemmer4 348 | 2606 1 1 1 1 1 0 1 0 truemmer5 349 | 2610 1 1 1 1 0 0 1 0 truemmer1_kueste 350 | 2611 1 1 1 1 1 0 1 0 truemmer6 351 | 2612 1 1 1 1 1 0 1 0 truemmer7 352 | 2613 1 1 1 1 1 0 1 0 truemmer8 353 | 2614 1 1 1 1 1 0 1 0 truemmer9 354 | 2615 1 1 1 1 1 0 1 0 truemmer10 355 | 2616 1 1 1 1 1 0 1 0 truemmer11 356 | 2620 1 1 1 1 0 0 1 0 truemmer0_kueste 357 | 2621 1 1 4 1 1 0 1 0 verbranntes_feld0 358 | 2622 1 1 4 1 1 0 1 0 verbranntes_feld1 359 | 2631 1 1 1 1 1 0 1 0 wegreste0 zu überprüfen 360 | 2632 1 1 1 1 1 0 1 0 wegreste1 361 | 2633 1 1 1 1 1 0 1 0 wegreste2 362 | 2634 1 1 1 1 1 0 1 0 wegreste3 363 | 2635 1 1 1 1 1 0 1 0 wegreste4 364 | 2636 1 1 1 1 1 0 1 0 wegreste3 365 | 2637 1 1 1 1 1 0 1 0 wegreste4 366 | 2638 1 1 1 1 1 0 1 0 wegreste5 367 | 2701 1 1 4 1 1 0 1 1 gras0 368 | 2702 1 1 4 1 1 0 1 1 gras0 369 | 2703 1 1 4 1 1 0 1 1 gras0 370 | 2704 1 1 4 1 1 0 1 1 gras0 371 | 2705 1 1 4 1 1 0 1 1 gras7 372 | 2706 1 1 4 1 1 0 1 1 gras7 373 | 2707 1 1 4 1 1 0 1 1 sand0 374 | 2708 1 1 4 1 1 0 1 1 sand0 375 | 2709 1 1 4 1 1 0 1 1 gras0 376 | 2710 1 1 4 1 1 0 1 1 gras0 377 | 2711 1 1 4 1 1 0 1 1 gras0 378 | 2712 1 1 4 1 1 0 1 1 gras0 379 | 2713 1 1 4 1 1 0 1 1 gras0 380 | 2714 1 1 4 1 1 0 1 1 gras0 381 | 2715 1 1 4 1 1 0 1 1 gras0 382 | 2716 1 1 4 1 1 0 1 1 gras0 383 | 2717 1 1 4 1 1 0 1 1 gras0 384 | 2718 1 1 4 1 1 0 1 1 gras0 385 | 2719 1 1 4 1 1 0 1 1 gras0 386 | 2720 1 1 4 1 1 0 1 1 gras0 387 | 2721 1 1 4 1 1 0 1 1 gras0b 388 | 2722 1 1 4 1 1 0 1 1 gras0b 389 | 2723 1 1 4 1 1 0 1 1 gras1b 390 | 2724 1 1 4 1 1 0 1 1 gras1b 391 | 2725 1 1 4 1 1 0 1 1 gras2b 392 | 2726 1 1 4 1 1 0 1 1 gras2b 393 | 2727 1 1 4 1 1 0 1 1 gras3b 394 | 2728 1 1 4 1 1 0 1 1 gras3b 395 | 2729 1 1 4 1 1 0 1 1 gras4b 396 | 2730 1 1 4 1 1 0 1 1 gras4b 397 | 2731 1 1 4 1 1 0 1 1 gras5b 398 | 2732 1 1 4 1 1 0 1 1 gras5b 399 | 2733 1 1 4 1 1 0 1 1 gras6b 400 | 2734 1 1 4 1 1 0 1 1 gras6b 401 | 2735 1 1 4 1 1 0 1 1 gras7b 402 | 2736 1 1 4 1 1 0 1 1 gras7b 403 | 2737 1 1 4 1 1 0 1 1 gras8b 404 | 2738 1 1 4 1 1 0 1 1 gras8b 405 | 2739 1 1 4 1 1 0 1 1 gras9b 406 | 2740 1 1 4 1 1 0 1 1 gras9b 407 | 2741 1 1 4 1 1 0 1 1 pflanzen0b 408 | 2742 1 1 4 1 1 0 1 1 pflanzen0b 409 | 2743 1 1 4 1 1 0 1 1 pflanzen1b 410 | 2744 1 1 4 1 1 0 1 1 pflanzen1b 411 | 2745 1 1 4 1 1 0 1 1 pflanzen2b 412 | 2746 1 1 4 1 1 0 1 1 pflanzen2b 413 | 2747 1 1 4 1 1 0 1 1 pflanzen3b 414 | 2748 1 1 4 1 1 0 1 1 pflanzen3b 415 | 2749 1 1 4 1 1 0 1 1 pflanzen4b 416 | 2750 1 1 4 1 1 0 1 1 pflanzen4b 417 | 2751 1 1 4 1 1 0 1 1 pflanzen5b 418 | 2752 1 1 4 1 1 0 1 1 pflanzen5b 419 | 2753 1 1 4 1 1 0 1 1 pflanzen6b 420 | 2754 1 1 4 1 1 0 1 1 pflanzen6b 421 | 2755 1 1 4 1 1 0 1 1 pflanzen7b 422 | 2756 1 1 4 1 1 0 1 1 pflanzen7b 423 | 2757 1 1 4 1 1 0 1 1 pflanzen8b 424 | 2758 1 1 4 1 1 0 1 1 pflanzen8b 425 | 2759 1 1 4 1 1 0 1 1 pflanzen9b 426 | 2760 1 1 4 1 1 0 1 1 pflanzen9b 427 | 2761 1 1 4 1 1 0 1 1 wueste0 428 | 2762 1 1 4 1 1 0 1 1 wueste0 429 | 2763 1 1 4 1 1 0 1 1 wueste1 430 | 2764 1 1 4 1 1 0 1 1 wueste1 431 | 2765 1 1 4 1 1 0 1 1 wueste2 432 | 2766 1 1 4 1 1 0 1 1 wueste2 433 | 2767 1 1 4 1 1 0 1 1 wueste3 434 | 2768 1 1 4 1 1 0 1 1 wueste3 435 | 2769 1 1 4 1 1 0 1 1 wueste4 436 | 2770 1 1 4 1 1 0 1 1 wueste4 437 | 2771 1 1 4 1 1 0 1 1 wueste5 438 | 2772 1 1 4 1 1 0 1 1 wueste5 439 | 2773 1 1 4 1 1 0 1 1 wueste6 440 | 2774 1 1 4 1 1 0 1 1 wueste6 441 | 2775 1 1 4 1 1 0 1 1 wueste7 442 | 2776 1 1 4 1 1 0 1 1 wueste7 443 | 2777 1 1 4 1 1 0 1 1 wueste8 444 | 2778 1 1 4 1 1 0 1 1 wueste8 445 | 2779 1 1 4 1 1 0 1 1 wueste9 446 | 2780 1 1 4 1 1 0 1 1 wueste9 447 | 2781 1 1 4 1 1 0 1 1 gras0_braun 448 | 2782 1 1 4 1 1 0 1 1 gras0_braun 449 | 2783 1 1 4 1 1 0 1 1 gras1_braun 450 | 2784 1 1 4 1 1 0 1 1 gras1_braun 451 | 2785 1 1 4 1 1 0 1 1 gras2_braun 452 | 2786 1 1 4 1 1 0 1 1 gras2_braun 453 | 2787 1 1 4 1 1 0 1 1 gras3_braun 454 | 2788 1 1 4 1 1 0 1 1 gras3_braun 455 | 2789 1 1 4 1 1 0 1 1 gras4_braun 456 | 2790 1 1 4 1 1 0 1 1 gras4_braun 457 | 2791 1 1 4 1 1 0 1 1 gras5_braun 458 | 2792 1 1 4 1 1 0 1 1 gras5_braun 459 | 2793 1 1 4 1 1 0 1 1 gras6_braun 460 | 2794 1 1 4 1 1 0 1 1 gras6_braun 461 | 2795 1 1 4 1 1 0 1 1 gras7_braun 462 | 2796 1 1 4 1 1 0 1 1 gras7_braun 463 | 2797 1 1 4 1 1 0 1 1 gras8_braun 464 | 2798 1 1 4 1 1 0 1 1 gras8_braun 465 | 2799 1 1 4 1 1 0 1 1 gras9_braun 466 | 2800 1 1 4 1 1 0 1 1 gras9_braun 467 | 2801 1 1 1 6 1 1 1 1 baum0_sued 468 | 2802 1 1 1 1 1 1 1 1 baum0_sued_fertig 469 | 2803 1 1 1 6 1 1 1 1 baum1_sued 470 | 2804 1 1 1 1 1 1 1 1 baum1_sued_fertig 471 | 2805 1 1 1 6 1 1 1 1 baum2_sued 472 | 2806 1 1 1 1 1 1 1 1 baum2_sued_fertig 473 | 2807 1 1 1 6 1 1 1 1 baum3_sued 474 | 2808 1 1 1 1 1 1 1 1 baum3_sued_fertig 475 | 2809 1 1 1 6 1 1 1 1 baum4_sued 476 | 2810 1 1 1 1 1 1 1 1 baum4_sued_fertig 477 | 2811 1 1 1 6 1 1 1 1 baum5_sued 478 | 2812 1 1 1 1 1 1 1 1 baum5_sued_fertig 479 | 2813 1 1 1 6 1 1 1 1 baum6_sued 480 | 2814 1 1 1 1 1 1 1 1 baum6_sued_fertig 481 | 2815 1 1 1 6 1 1 1 1 baum7_sued 482 | 2816 1 1 1 1 1 1 1 1 baum7_sued_fertig 483 | 2817 1 1 1 6 1 1 1 1 baum8_sued 484 | 2818 1 1 1 1 1 1 1 1 baum8_sued_fertig 485 | 2819 1 1 1 6 1 1 1 1 baum9_sued 486 | 2820 1 1 1 1 1 1 1 1 baum9_sued_fertig 487 | 2821 1 1 1 6 1 1 1 1 baum10_sued 488 | 2822 1 1 1 1 1 1 1 1 baum10_sued_fertig 489 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------