Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random islands #66

Merged
merged 22 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/mdcii/cod_parser/src/cod_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <boost/program_options.hpp>

#include "mdcii/cod_parser.hpp"
#include "mdcii/cod/cod_parser.hpp"
#include "mdcii/cod/haeuser.hpp"
#include "mdcii/files.hpp"
#include "mdcii/haeuser.hpp"

namespace po = boost::program_options;

Expand Down
2 changes: 1 addition & 1 deletion source/mdcii/inselbmp/src/inselbmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "mdcii/bildspeicher_pal8.hpp"
#include "mdcii/bsh_leser.hpp"
#include "mdcii/cod_parser.hpp"
#include "mdcii/cod/cod_parser.hpp"
#include "mdcii/files.hpp"
#include "mdcii/insel.hpp"
#include "mdcii/palette.hpp"
Expand Down
35 changes: 28 additions & 7 deletions source/mdcii/mdcii/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ set(source_path "${CMAKE_CURRENT_SOURCE_DIR}/src")

set(headers
${include_path}/mdcii.hpp
${include_path}/cod_parser.hpp
${include_path}/animation.hpp
${include_path}/basegad_dat.hpp
${include_path}/bildspeicher.hpp
${include_path}/bildspeicher_pal8.hpp
${include_path}/bildspeicher_rgb24.hpp
Expand All @@ -57,8 +55,6 @@ set(headers
${include_path}/fps.hpp
${include_path}/files_to_check.hpp
${include_path}/generischer_bsh_leser.hpp
${include_path}/haeuser.hpp
${include_path}/host_gad.hpp
${include_path}/insel.hpp
${include_path}/kamera.hpp
${include_path}/karte.hpp
Expand All @@ -73,17 +69,29 @@ set(headers
${include_path}/menu/mainmenu.hpp
${include_path}/menu/singleplayerwindow.hpp
${include_path}/menu/gamewindow.hpp
${include_path}/cod/cod_parser.hpp
${include_path}/cod/basegad_dat.hpp
${include_path}/cod/haeuser.hpp
${include_path}/cod/host_gad.hpp
${include_path}/gam/chunk.hpp
${include_path}/gam/city.hpp
${include_path}/gam/deer.hpp
${include_path}/gam/island.hpp
${include_path}/gam/islandhouse.hpp
${include_path}/gam/marketplace.hpp
${include_path}/gam/military.hpp
${include_path}/gam/missions.hpp
${include_path}/gam/kontor.hpp
${include_path}/gam/productionlist.hpp
${include_path}/gam/rawgrowth.hpp
${include_path}/gam/scene.hpp
${include_path}/gam/settlers.hpp
${include_path}/gam/shipyard.hpp
${include_path}/gam/warehouse.hpp
${include_path}/gam/gam_parser.hpp
)

set(sources
${source_path}/mdcii.cpp
${source_path}/cod_parser.cpp
${source_path}/bildspeicher.cpp
${source_path}/bildspeicher_pal8.cpp
${source_path}/bildspeicher_rgb24.cpp
Expand All @@ -105,11 +113,24 @@ set(sources
${source_path}/menu/mainmenu.cpp
${source_path}/menu/singleplayerwindow.cpp
${source_path}/menu/gamewindow.cpp
${source_path}/cod/cod_parser.cpp
${source_path}/cod/basegad_dat.cpp
${source_path}/cod/haeuser.cpp
${source_path}/cod/host_gad.cpp
${source_path}/gam/chunk.cpp
${source_path}/gam/city.cpp
${source_path}/gam/deer.cpp
${source_path}/gam/island.cpp
${source_path}/gam/islandhouse.cpp
${source_path}/gam/marketplace.cpp
${source_path}/gam/military.cpp
${source_path}/gam/missions.cpp
${source_path}/gam/kontor.cpp
${source_path}/gam/productionlist.cpp
${source_path}/gam/rawgrowth.cpp
${source_path}/gam/scene.cpp
${source_path}/gam/settlers.cpp
${source_path}/gam/shipyard.cpp
${source_path}/gam/warehouse.cpp
${source_path}/gam/gam_parser.cpp
)

Expand Down
171 changes: 0 additions & 171 deletions source/mdcii/mdcii/include/mdcii/basegad_dat.hpp

This file was deleted.

75 changes: 75 additions & 0 deletions source/mdcii/mdcii/include/mdcii/cod/basegad_dat.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// This file is part of the MDCII Game Engine.
// Copyright (C) 2020 Armin Schlegel
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

#ifndef _BASEGAD_DAT_H_
#define _BASEGAD_DAT_H_

#include <experimental/optional>
#include <map>

#include "cod_parser.hpp"


enum class BaseGadKindType
{
UNSET = 0,
GAD_GFX
};

struct BaseGadGadget
{
int Id = -1;
int Blocknr = -1;
int Gfxnr = -1;
BaseGadKindType Kind = BaseGadKindType::UNSET;
int Noselflg = -1;
int Pressoff = -1;
struct
{
int x;
int y;
} Pos;

struct
{
int h;
int w;
} Size;
};

class Basegad
{
public:
explicit Basegad(std::shared_ptr<Cod_Parser> cod);
std::experimental::optional<BaseGadGadget*> get_gadget(int id);
int get_gadgets_size();
BaseGadGadget* get_gadgets_by_index(int index);

private:
void generate_gadgets();
BaseGadGadget generate_gadget(const cod_pb::Object* obj);

private:
const int id_offset = 30000;
std::map<int, BaseGadGadget> gadgets;
std::vector<BaseGadGadget*> gadgets_vec;
std::shared_ptr<Cod_Parser> cod;

std::map<std::string, BaseGadKindType> KindMap = {{"GAD_GFX", BaseGadKindType::GAD_GFX}};
};

#endif //_BASEGAD_DAT_H_
Loading