Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
updated to latest df/dfhack
  • Loading branch information
pronvit committed Feb 19, 2018
1 parent 5facbf4 commit 0d8dfb3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
14 changes: 7 additions & 7 deletions Makefile
@@ -1,12 +1,12 @@
DFHACKVER ?= 0.40.13-r1
DFHACKVER ?= 0.44.05-r1

DFVERNUM = `echo $(DFHACKVER) | sed -e s/-.*// -e s/\\\\.//g`

DF ?= /Users/vit/Downloads/df_40_13_osx
DH ?= /Users/vit/Downloads/dfhack-master
DF ?= /Users/vit/Downloads/df_44_05_osx
DH ?= /Users/vit/Downloads/buildagent-2/workspace/root/dfhack/0.44

SRC = multiscroll.mm
DEP = Makefile
DEP = Makefile renderer_twbt.h

ifneq (,$(findstring 0.34,$(DFHACKVER)))
EXT = so
Expand All @@ -18,13 +18,13 @@ OUT = dist/$(DFHACKVER)/multiscroll.plug.$(EXT)
INC = -I"$(DH)/library/include" -I"$(DH)/library/proto" -I"$(DH)/depends/protobuf" -I"$(DH)/depends/lua/include"
LIB = -L"$(DH)/build/library" -ldfhack -ldfhack-version

CFLAGS = $(INC) -m32 -DLINUX_BUILD -O3
CFLAGS = $(INC) -m64 -DLINUX_BUILD -O3 -D_GLIBCXX_USE_CXX11_ABI=0
LDFLAGS = $(LIB) -shared

ifeq ($(shell uname -s), Darwin)
CXX = c++ -std=gnu++0x -stdlib=libstdc++
CXX = clang -std=gnu++0x -stdlib=libstdc++ -ObjC++
CFLAGS += -Wno-tautological-compare
LDFLAGS += -framework AppKit -mmacosx-version-min=10.6
LDFLAGS += -framework AppKit -mmacosx-version-min=10.6 -undefined dynamic_lookup
else
endif

Expand Down
2 changes: 2 additions & 0 deletions multiscroll.mm
Expand Up @@ -21,13 +21,15 @@
#include "modules/MapCache.h"
#include "modules/Gui.h"
#include "modules/Screen.h"
#include "df/world.h"
#include "df/construction.h"
#include "df/graphic.h"
#include "df/enabler.h"
#include "df/viewscreen_dwarfmodest.h"
#include "df/renderer.h"
#include "renderer_twbt.h"

using namespace DFHack;
using df::global::world;
using std::string;
using std::vector;
Expand Down
26 changes: 19 additions & 7 deletions renderer_twbt.h
Expand Up @@ -26,31 +26,33 @@ struct renderer_cool : renderer_opengl
{
uint32_t dummy;

float *gvertexes, *gfg, *gbg, *gtex;
float *gvertexes, *gfg, *gtex;
int gdimx, gdimy, gdimxfull, gdimyfull;
int gdispx, gdispy;
float goff_x, goff_y, gsize_x, gsize_y;
bool needs_reshape;
int needs_zoom;
bool needs_full_update;
unsigned char *gscreen;
int32_t *gscreentexpos;
long *gscreentexpos;
float goff_y_gl;

renderer_cool();

void reshape_graphics();
void display_new(bool update_graphics);
void display_map();
void gswap_arrays();
void allocate_buffers(int tiles);
void allocate_buffers(int tiles, int extra_tiles);
void update_map_tile(int x, int y);
void reshape_zoom_swap();

virtual void update_tile(int x, int y);
virtual void update_all();
virtual void draw(int vertex_count);
virtual void reshape_gl();

virtual void zoom(df::zoom_commands cmd);
virtual void zoom(df::zoom_commands cmd);
virtual bool get_mouse_coords(int32_t *x, int32_t *y);

virtual void update_tile_old(int x, int y) {}; //17
Expand All @@ -71,18 +73,28 @@ struct renderer_cool : renderer_opengl

void output_char(int8_t color, int x, int y, unsigned char ch)
{
const int tile = (x-1) * gdimy + (y-1);
if (x < 1 || x > gdimx || y < 1 || y > gdimy)
return;

const int tile = (x-1) * gdimy + (y-1);
unsigned char *s = gscreen + tile*4;
s[0] = ch;
s[1] = color % 8;
s[2] = 0;
s[3] = (color / 8) | (s[3]&0xf0);

gscreentexpos[tile] = 0;
};
};

int depth_at(int x, int y)
{
if (x < 1 || x > gdimx || y < 1 || y > gdimy)
return 0;

const int tile = (x-1) * gdimy + (y-1);
unsigned char *s = gscreen + tile*4;
return ((s[3]&0xf0)>>4);
}

DFHack::Gui::DwarfmodeDims map_dims()
{
Expand All @@ -91,4 +103,4 @@ struct renderer_cool : renderer_opengl
};
};

#endif
#endif

0 comments on commit 0d8dfb3

Please sign in to comment.