forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michal
committed
Dec 5, 2013
0 parents
commit 90caf3b
Showing
124 changed files
with
29,273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
|
||
CC = new-g++ | ||
LD = new-g++ | ||
CFLAGS = -Wall -std=c++0x -Wno-sign-compare -Wno-unused-variable -Wl,-rpath=. | ||
|
||
CMD:=$(shell rm -f zagadka) | ||
|
||
ifdef DATA_DIR | ||
CFLAGS += -DDATA_DIR=\"$(DATA_DIR)\" | ||
endif | ||
|
||
ifdef OPT | ||
GFLAG = -O3 -DRELEASE | ||
else | ||
GFLAG = -g | ||
endif | ||
|
||
ifndef OPTFLAGS | ||
OPTFLAGS = -static-libstdc++ ${GFLAG} | ||
endif | ||
|
||
ifdef OPT | ||
OBJDIR = obj-opt | ||
else | ||
OBJDIR = obj | ||
endif | ||
|
||
NAME = zagadka | ||
|
||
ROOT = ./ | ||
TOROOT = ./../ | ||
IPATH = -I. -I./extern | ||
|
||
CFLAGS += $(IPATH) | ||
|
||
SRCS = time_queue.cpp level.cpp model.cpp square.cpp util.cpp monster.cpp square_factory.cpp view.cpp creature.cpp message_buffer.cpp item_factory.cpp item.cpp inventory.cpp debug.cpp player.cpp window_view.cpp field_of_view.cpp view_object.cpp creature_factory.cpp quest.cpp shortest_path.cpp effect.cpp equipment.cpp level_maker.cpp monster_ai.cpp attack.cpp attack.cpp tribe.cpp name_generator.cpp event.cpp location.cpp skill.cpp fire.cpp ranged_weapon.cpp action.cpp map_layout.cpp trigger.cpp map_memory.cpp view_index.cpp pantheon.cpp enemy_check.cpp collective.cpp collective_action.cpp task.cpp markov_chain.cpp controller.cpp village_control.cpp poison_gas.cpp minion_equipment.cpp | ||
|
||
#LIBS = -L/usr/lib/x86_64-linux-gnu `pkg-config --libs allegro-5.0 allegro_ttf-5.0 allegro_primitives-5.0 allegro_image-5.0` | ||
LIBS = -L/usr/lib/x86_64-linux-gnu -lsfml-graphics -lsfml-window -lsfml-system ${LDFLAGS} | ||
|
||
ifdef debug | ||
CFLAGS += -g | ||
OBJDIR := ${addsuffix -d,$(OBJDIR)} | ||
NAME := ${addsuffix -d,$(NAME)} | ||
else | ||
CFLAGS += $(OPTFLAGS) | ||
endif | ||
|
||
|
||
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.o)) | ||
DEPS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.d)) | ||
|
||
############################################################################## | ||
|
||
|
||
all: $(OBJDIR) $(NAME) | ||
ctags --c++-kinds=+p --fields=+iaS --extra=+q *.h | ||
|
||
$(OBJDIR): | ||
mkdir $(OBJDIR) | ||
|
||
stdafx.h.gch: stdafx.h $(wildcard *.h) | ||
$(CC) -MMD $(CFLAGS) -c $< -o $@ | ||
|
||
ifndef OPT | ||
PCH = stdafx.h.gch | ||
endif | ||
|
||
$(OBJDIR)/%.o: %.cpp ${PCH} | ||
$(CC) -MMD $(CFLAGS) -c $< -o $@ | ||
|
||
$(NAME): $(OBJS) $(OBJDIR)/main.o | ||
$(LD) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
test: $(OBJS) $(OBJDIR)/test.o | ||
$(LD) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
monkey: $(OBJS) $(OBJDIR)/monkey_test.o | ||
$(LD) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
clean: | ||
$(RM) $(OBJDIR)/*.o | ||
$(RM) $(OBJDIR)/*.d | ||
$(RM) log13* | ||
$(RM) log.out | ||
$(RM) $(OBJDIR)/test | ||
$(RM) $(OBJDIR)-opt/*.o | ||
$(RM) $(OBJDIR)-opt/*.d | ||
$(RM) $(NAME) | ||
$(RM) stdafx.h.gch | ||
|
||
-include $(DEPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
|
||
CC = g++ | ||
LD = g++ | ||
CFLAGS = -Wall -std=c++0x -Wno-sign-compare -Wno-unused-variable | ||
|
||
ifdef DATA_DIR | ||
CFLAGS += -DDATA_DIR=\"$(DATA_DIR)\" | ||
endif | ||
|
||
ifndef OPTFLAGS | ||
OPTFLAGS = -Winvalid-pch -static-libstdc++ -static -DSFML_STATIC -DWINDOWS -DRELEASE -O3 | ||
endif | ||
|
||
OBJDIR = obj | ||
NAME = zagadka | ||
|
||
ROOT = ./ | ||
TOROOT = ./../ | ||
IPATH = -I. -I./extern | ||
|
||
CFLAGS += $(IPATH) | ||
|
||
SRCS = time_queue.cpp level.cpp model.cpp square.cpp util.cpp monster.cpp square_factory.cpp view.cpp creature.cpp message_buffer.cpp item_factory.cpp item.cpp inventory.cpp debug.cpp player.cpp window_view.cpp field_of_view.cpp view_object.cpp creature_factory.cpp quest.cpp shortest_path.cpp effect.cpp equipment.cpp level_maker.cpp monster_ai.cpp attack.cpp attack.cpp tribe.cpp name_generator.cpp event.cpp location.cpp skill.cpp fire.cpp ranged_weapon.cpp action.cpp map_layout.cpp trigger.cpp map_memory.cpp view_index.cpp pantheon.cpp enemy_check.cpp collective.cpp collective_action.cpp task.cpp markov_chain.cpp controller.cpp village_control.cpp poison_gas.cpp minion_equipment.cpp | ||
|
||
LIBS = -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -ldinput -lddraw -ldxguid -lwinmm -ldsound -lpsapi -lgdiplus -lshlwapi -luuid -lfreetype-2.4.8-static-md -lopengl32 -lglu32 | ||
|
||
|
||
|
||
ifdef debug | ||
CFLAGS += -g | ||
OBJDIR := ${addsuffix -d,$(OBJDIR)} | ||
NAME := ${addsuffix -d,$(NAME)} | ||
else | ||
CFLAGS += $(OPTFLAGS) | ||
endif | ||
|
||
|
||
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.o)) | ||
DEPS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.d)) | ||
|
||
############################################################################## | ||
|
||
all: $(OBJDIR) $(NAME) | ||
ctags --c++-kinds=+p --fields=+iaS --extra=+q *.h | ||
|
||
$(OBJDIR): | ||
mkdir $(OBJDIR) | ||
|
||
stdafx.h.gch: stdafx.h $(wildcard *.h) | ||
$(CC) -MMD $(CFLAGS) -c $< -o $@ | ||
|
||
$(OBJDIR)/%.o: %.cpp stdafx.h.gch | ||
$(CC) -MMD $(CFLAGS) -c $< -o $@ | ||
|
||
$(NAME): $(OBJS) $(OBJDIR)/main.o | ||
$(LD) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
test: $(OBJS) $(OBJDIR)/test.o | ||
$(LD) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
monkey: $(OBJS) $(OBJDIR)/monkey_test.o | ||
$(LD) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
clean: | ||
$(RM) $(OBJDIR)/*.o | ||
$(RM) $(OBJDIR)/*.d | ||
$(RM) $(NAME) | ||
$(RM) stdafx.h.gch | ||
|
||
-include $(DEPS) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "stdafx.h" | ||
|
||
vector<ActionId> dirActions {ActionId::MOVE, ActionId::TRAVEL, ActionId::FIRE, ActionId::THROW_DIR}; | ||
|
||
Action::Action() { | ||
} | ||
|
||
Action::Action(ActionId i) : id(i) { | ||
CHECK(!contains(dirActions, id)) << "Id " << (int)id << " needs direction"; | ||
} | ||
|
||
ActionId Action::getId() { | ||
return id; | ||
} | ||
|
||
Action::Action(ActionId i, Vec2 dir) : id(i), direction(dir) { | ||
CHECK(contains(dirActions, id)) << "Id " << (int)id << " doesn't have direction"; | ||
} | ||
|
||
Vec2 Action::getDirection() { | ||
CHECK(contains(dirActions, id)) << "Id " << (int)id << " doesn't have direction"; | ||
return direction; | ||
} | ||
|
||
std::ostream& operator << (std::ostream& o, Action a) { | ||
o << (int) a.getId(); | ||
if (contains(dirActions, a.getId())) | ||
o << " " << a.getDirection(); | ||
return o; | ||
} | ||
|
||
std::istream& operator >> (std::istream& in, Action& a) { | ||
int id; | ||
in >> id; | ||
if (contains(dirActions, (ActionId) id)) { | ||
Vec2 v; | ||
in >> v; | ||
a = Action((ActionId) id, v); | ||
} else | ||
a = Action((ActionId) id); | ||
return in; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef _ACTION_H | ||
#define _ACTION_H | ||
|
||
#include <iostream> | ||
|
||
enum class ActionId { | ||
MOVE, | ||
TRAVEL, | ||
FIRE, | ||
PICK_UP, | ||
EXT_PICK_UP, | ||
DROP, | ||
EXT_DROP, | ||
SHOW_INVENTORY, | ||
APPLY_ITEM, | ||
EQUIPMENT, | ||
THROW, | ||
THROW_DIR, | ||
SHOW_HISTORY, | ||
HIDE, | ||
PAY_DEBT, | ||
CHAT, | ||
WAIT, | ||
UNPOSSESS, | ||
IDLE | ||
}; | ||
|
||
class Action { | ||
public: | ||
Action(); | ||
Action(ActionId); | ||
Action(ActionId, Vec2 direction); | ||
ActionId getId(); | ||
Vec2 getDirection(); | ||
|
||
private: | ||
ActionId id; | ||
Vec2 direction; | ||
}; | ||
|
||
std::ostream& operator << (std::ostream&, Action); | ||
std::istream& operator >> (std::istream&, Action&); | ||
|
||
#endif |
Oops, something went wrong.