Merge branch 'makefile'
In addition to what the commit messages state, this merge updates the code to use latest SFML (2.3).
This commit is contained in:
75
build.sh
Executable file
75
build.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
# cboe build - paul_erdos 2015-06-14
|
||||
|
||||
COMMON_SRC=`
|
||||
ls src/classes/*.cpp | grep -v '\.win' |
|
||||
sed -E 's/es\/([^\/]*)\.cpp$/_\1.o/ ; s/src/obj/' &&
|
||||
ls src/dialogxml/*.cpp | grep -v '\.win' |
|
||||
sed -E 's/xml\/([^\/]*)\.cpp$/_\1.o/ ; s/src/obj/' &&
|
||||
ls src/dialogxml/xml-parser/*.cpp | grep -v '\.win' |
|
||||
sed 's/dialogxml\/xml-parser\/// ; s/\.cpp/.o/ ; s/src/obj/' &&
|
||||
ls src/tools/*.{cpp,mm} | grep -v '\.win' |
|
||||
sed -E 's/\/([^\/]*)\.(cpp|mm)$/_\1.o/ ; s/src/obj/'
|
||||
`
|
||||
BOE_SRC=`
|
||||
ls src/boe.*.{cpp,mm} | grep -v '.win' |
|
||||
sed -E 's/\.(cpp|mm)$/.o/ ; s/src/obj/'
|
||||
`
|
||||
ED_SRC=`
|
||||
ls src/scenedit/scen.*.{cpp,mm} | grep -v '\.win' |
|
||||
sed -E 's/scenedit\/// ; s/\.(cpp|mm)$/.o/ ; s/src/obj/'
|
||||
`
|
||||
PC_SRC=`
|
||||
ls src/pcedit/pc.*.{cpp,mm} | grep -v '\.win' |
|
||||
sed -E 's/pcedit\/// ; s/\.(cpp|mm)$/.o/ ; s/src/obj/'
|
||||
`
|
||||
COMMON_SRC=`echo $COMMON_SRC`
|
||||
BOE_SRC=`echo $BOE_SRC src/pcedit/pc.editors.cpp`
|
||||
ED_SRC=`echo $ED_SRC`
|
||||
PC_SRC=`echo $PC_SRC`
|
||||
|
||||
function usage {
|
||||
echo "usage: $0 [-chrw]"
|
||||
}
|
||||
|
||||
function help {
|
||||
usage
|
||||
echo "options:
|
||||
-b, --build clean targets and compile
|
||||
-c, --clean clean obj/ directory without compiling
|
||||
-h, --help this help text
|
||||
-r, --run runs the build"
|
||||
}
|
||||
|
||||
function clean {
|
||||
rm -rf obj/ exe/
|
||||
}
|
||||
|
||||
function build {
|
||||
mkdir -p obj exe/bin 'exe/Blades of Exile/data'
|
||||
mkdir -p 'exe/Blades of Exile/Blades of Exile Scenarios/'
|
||||
mkdir -p 'exe/Blades of Exile/Scenario Editor/Blades of Exile Base'
|
||||
echo "$COMMON_SRC" > test.txt
|
||||
export COMMON_SRC BOE_SRC ED_SRC PC_SRC
|
||||
make all
|
||||
}
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
while [ "$1" != "" ]; do
|
||||
case $1 in
|
||||
-b | --build ) build
|
||||
exit;;
|
||||
-c | --clean ) clean;;
|
||||
-h | --help ) help
|
||||
exit;;
|
||||
-r | --run ) run;;
|
||||
* ) usage
|
||||
exit 1
|
||||
esac
|
||||
shift
|
||||
done
|
||||
else
|
||||
build
|
||||
fi
|
||||
|
||||
|
103
makefile
Normal file
103
makefile
Normal file
@@ -0,0 +1,103 @@
|
||||
# oboe makefile
|
||||
|
||||
CC=clang++
|
||||
CFLAGS=-ferror-limit=0 -Werror=format -ftemplate-backtrace-limit=0 -Werror=return-type -Werror=parentheses -Werror=dangling-else -isystem/usr/local/Cellar/boost/1.58.0/include -Wfloat-equal -Wno-long-long -std=c++11 -stdlib=libc++
|
||||
LIBFLAGS = -lboost_filesystem -lboost_system -L/usr/local/Cellar/boost/1.58.0/lib -lobjc -lz -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -lc++ -framework Cocoa -framework CoreFoundation -framework OpenGL
|
||||
CINCLUDES=-Isrc -Isrc/classes -Isrc/dialogxml -Isrc/dialogxml/xml-parser -Isrc/tools -Isrc/tools/gzstream -Isrc/tools/resmgr
|
||||
|
||||
LIB=/usr/local/lib
|
||||
|
||||
boost_lib=-lboost_filesystem -lboost_system -L$LIB
|
||||
boost_include=-I/usr/local/include/boost
|
||||
|
||||
all: game pced scened
|
||||
|
||||
obj/gzstream.o: src/tools/gzstream/gzstream.cpp src/tools/gzstream/gzstream.h
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/oldstructs.o: src/oldstructs.cpp src/oldstructs.hpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/tools_%.o: src/tools/%.cpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/tools_%.o: src/tools/%.mm
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/class_%.o: src/classes/%.cpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/dialog_%.o: src/dialogxml/%.cpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/tinyxml%.o: src/dialogxml/xml-parser/tinyxml%.cpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS) -DTIXML_USE_TICPP
|
||||
|
||||
obj/ti%.o: src/dialogxml/xml-parser/ti%.cpp src/dialogxml/xml-parser/ti%.h
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS) -DTIXML_USE_TICPP
|
||||
|
||||
obj/boe.%.o: src/boe.%.cpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/boe.%.o: src/boe.%.mm
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/pc.%.o: src/pcedit/pc.%.cpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/pc.%.o: src/pcedit/pc.%.mm
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/scen.%.o: src/scenedit/scen.%.cpp
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/scen.%.o: src/scenedit/scen.%.mm
|
||||
$(CC) -c $(CINCLUDES) -o $@ $< $(CFLAGS)
|
||||
|
||||
obj/common.o: obj/gzstream.o obj/oldstructs.o $(COMMON_SRC)
|
||||
ld -r $^ -o obj/common.o
|
||||
|
||||
exe/bin/boe: obj/common.o $(BOE_SRC)
|
||||
$(CC) $(CFLAGS) $(CINCLUDES) $^ -o exe/bin/boe $(LIBFLAGS)
|
||||
|
||||
exe/bin/pced: obj/common.o $(PC_SRC)
|
||||
$(CC) $(CFLAGS) $(CINCLUDES) $^ -o exe/bin/pced $(LIBFLAGS)
|
||||
|
||||
exe/bin/scened: obj/common.o $(ED_SRC)
|
||||
$(CC) $(CFLAGS) $(CINCLUDES) $^ -o exe/bin/scened $(LIBFLAGS)
|
||||
|
||||
game: exe/bin/boe resources
|
||||
|
||||
pced: exe/bin/pced resources
|
||||
|
||||
scened: exe/bin/scened resources
|
||||
|
||||
resources: sounds.exa graphics.exd strings dialogs fonts scenarios shaders
|
||||
|
||||
shaders: src/tools/mask.vert src/tools/mask.frag
|
||||
mkdir -p 'exe/Blades of Exile/data/shaders'
|
||||
cp -fp src/tools/mask.* 'exe/Blades of Exile/data/shaders/'
|
||||
|
||||
sounds.exa:
|
||||
cp -Rfp rsrc/sounds.exa 'exe/Blades of Exile/Scenario Editor/'
|
||||
|
||||
graphics.exd:
|
||||
cp -Rfp rsrc/graphics.exd 'exe/Blades of Exile/Scenario Editor/'
|
||||
|
||||
strings:
|
||||
cp -Rfp rsrc/strings/ 'exe/Blades of Exile/data/'
|
||||
|
||||
dialogs:
|
||||
mkdir -p 'exe/Blades of Exile/data/dialogs'
|
||||
cp -fp rsrc/dialogs/*.xml 'exe/Blades of Exile/data/dialogs/'
|
||||
|
||||
fonts:
|
||||
cp -Rfp rsrc/fonts/ 'exe/Blades of Exile/data/'
|
||||
|
||||
scenarios:
|
||||
cp -fp 'rsrc/Blades of Exile Scenarios'/*.{exs,meg} 'exe/Blades of Exile/Blades of Exile Scenarios/'
|
||||
cp -fp 'rsrc/Blades of Exile Bases'/*.exs 'exe/Blades of Exile/Scenario Editor/Blades of Exile Base'
|
||||
|
||||
clean:
|
||||
rm -rf obj exe/bin
|
||||
|
@@ -47,7 +47,7 @@
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\ticpprc.h" />
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\tinystr.h" />
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\tinyxml.h" />
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\tinyprint.hpp" />
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\tinyprint.h" />
|
||||
<ClInclude Include="..\..\oldstructs.hpp" />
|
||||
<ClInclude Include="..\..\tools\cursors.hpp" />
|
||||
<ClInclude Include="..\..\tools\fileio.hpp" />
|
||||
|
@@ -112,7 +112,7 @@
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\tinyxml.h">
|
||||
<Filter>DialogXML\TinyXML</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\tinyprint.hpp">
|
||||
<ClInclude Include="..\..\dialogxml\xml-parser\tinyprint.h">
|
||||
<Filter>DialogXML\TinyXML</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\dialogxml\button.hpp">
|
||||
|
@@ -633,7 +633,7 @@
|
||||
917B573F100B956C0096C978 /* undo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = undo.hpp; sourceTree = "<group>"; };
|
||||
918D59A718EA513900735B66 /* dialog.keys.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = dialog.keys.hpp; sourceTree = "<group>"; };
|
||||
919086DF1A65C8E30071F7A0 /* tinyprint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyprint.cpp; sourceTree = "<group>"; };
|
||||
919086E11A65D3250071F7A0 /* tinyprint.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = tinyprint.hpp; sourceTree = "<group>"; };
|
||||
919086E11A65D3250071F7A0 /* tinyprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyprint.h; sourceTree = "<group>"; };
|
||||
919145FB18E3A32F005CF3A4 /* boe.appleevents.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = boe.appleevents.mm; sourceTree = "<group>"; };
|
||||
919145FD18E3C750005CF3A4 /* scrollbar.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = scrollbar.hpp; sourceTree = "<group>"; };
|
||||
919145FE18E63B41005CF3A4 /* winutil.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = winutil.hpp; sourceTree = "<group>"; };
|
||||
@@ -878,7 +878,7 @@
|
||||
910BBA2F0FB8C470001E34EA /* ticpprc.h */,
|
||||
910BBA290FB8C459001E34EA /* tinystr.h */,
|
||||
910BBA2B0FB8C459001E34EA /* tinyxml.h */,
|
||||
919086E11A65D3250071F7A0 /* tinyprint.hpp */,
|
||||
919086E11A65D3250071F7A0 /* tinyprint.h */,
|
||||
919086DF1A65C8E30071F7A0 /* tinyprint.cpp */,
|
||||
);
|
||||
path = "xml-parser";
|
||||
|
@@ -101,7 +101,7 @@ void init_menubar() {
|
||||
if(inited) return;
|
||||
inited = true;
|
||||
NSApplication* app = [NSApplication sharedApplication];
|
||||
[NSBundle loadNibNamed: @"menu" owner: app];
|
||||
[NSBundle loadNibNamed: @"game" owner: app];
|
||||
menu_bar_handle = [app mainMenu];
|
||||
|
||||
apple_menu = [[menu_bar_handle itemWithTitle: @"Blades of Exile"] submenu];
|
||||
|
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//
|
||||
|
||||
#include "tinyprint.hpp"
|
||||
#include "tinyprint.h"
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace ticpp;
|
||||
|
@@ -46,7 +46,7 @@ void init_menubar() {
|
||||
inited = true;
|
||||
|
||||
NSApplication* app = [NSApplication sharedApplication];
|
||||
[NSBundle loadNibNamed: @"pc.menu" owner: app];
|
||||
[NSBundle loadNibNamed: @"pcedit" owner: app];
|
||||
menu_bar_handle = [app mainMenu];
|
||||
|
||||
apple_menu = [[menu_bar_handle itemWithTitle: @"BoE Character Editor"] submenu];
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "dlogutil.hpp"
|
||||
#include "tarball.hpp"
|
||||
#include "gzstream.h"
|
||||
#include "tinyprint.hpp"
|
||||
#include "tinyprint.h"
|
||||
#include "map_parse.hpp"
|
||||
|
||||
#define DONE_BUTTON_ITEM 1
|
||||
|
@@ -33,7 +33,7 @@ void init_menubar() {
|
||||
inited = true;
|
||||
|
||||
NSApplication* app = [NSApplication sharedApplication];
|
||||
[NSBundle loadNibNamed: @"scen.menu" owner: app];
|
||||
[NSBundle loadNibNamed: @"scenedit" owner: app];
|
||||
menu_bar_handle = [app mainMenu];
|
||||
|
||||
app_menu = [[menu_bar_handle itemWithTitle: @"BoE Scenario Editor"] submenu];
|
||||
|
@@ -728,18 +728,18 @@ class EllipseShape : public sf::Shape {
|
||||
int points;
|
||||
float a, b;
|
||||
public:
|
||||
explicit EllipseShape(sf::Vector2f size, unsigned int points = 30) : points(points) {
|
||||
explicit EllipseShape(sf::Vector2f size, std::size_t points = 30) : points(points) {
|
||||
a = size.x / 2.0f;
|
||||
b = size.y / 2.0f;
|
||||
divSz = 2 * pi<float>() / points;
|
||||
update();
|
||||
}
|
||||
|
||||
unsigned int getPointCount() const override {
|
||||
std::size_t getPointCount() const override {
|
||||
return points;
|
||||
}
|
||||
|
||||
sf::Vector2f getPoint(unsigned int i) const override {
|
||||
sf::Vector2f getPoint(std::size_t i) const override {
|
||||
float t = i * divSz;
|
||||
return sf::Vector2f(a + a*sin(t), b + b*cos(t));
|
||||
}
|
||||
@@ -752,7 +752,7 @@ class RoundRectShape : public sf::Shape {
|
||||
int points;
|
||||
float w,h,r;
|
||||
public:
|
||||
RoundRectShape(sf::Vector2f size, float cornerRadius, unsigned int points = 32) : points(points / 4) {
|
||||
RoundRectShape(sf::Vector2f size, float cornerRadius, std::size_t points = 32) : points(points / 4) {
|
||||
w = size.x;
|
||||
h = size.y;
|
||||
r = cornerRadius;
|
||||
@@ -760,11 +760,11 @@ public:
|
||||
update();
|
||||
}
|
||||
|
||||
unsigned int getPointCount() const override {
|
||||
std::size_t getPointCount() const override {
|
||||
return points * 4;
|
||||
}
|
||||
|
||||
sf::Vector2f getPoint(unsigned int i) const override {
|
||||
sf::Vector2f getPoint(std::size_t i) const override {
|
||||
const float pi = ::pi<float>();
|
||||
const float half_pi = 0.5 * pi;
|
||||
float t = i * divSz;
|
||||
|
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
* viewdlog.cpp
|
||||
* Editor
|
||||
*
|
||||
* Created by Celtic Minstrel on 15/04/09.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dlgtool.h"
|
||||
#include "graphtool.h"
|
||||
#include "soundtool.h"
|
||||
|
||||
void Initialize();
|
||||
void init_dialogs();
|
||||
void display_strings(char *text1, char *text2, char *title,short graphic_num,short graphic_type,short parent_num);
|
||||
|
||||
GWorldPtr anim_gworld, talkfaces_gworld, items_gworld, tiny_obj_gworld, pc_gworld, dlog_gworld, monst_gworld[11], ter_gworld[7], small_ter_gworld, fields_gworld, pc_stats_gworld, item_stats_gworld;
|
||||
ResFileRefNum graphicsRef, soundsRef, boeRef, scenRef, pcRef;
|
||||
bool All_Done = false;
|
||||
WindowPtr mainPtr = (WindowPtr) -1;
|
||||
|
||||
int main()
|
||||
{
|
||||
short error;
|
||||
OSErr err;
|
||||
MenuHandle cur_menu;
|
||||
FSSpec spec;
|
||||
short refNum, localizedRefNum;
|
||||
CFBundleRef bundle;
|
||||
//start_time = TickCount();
|
||||
|
||||
Initialize();
|
||||
Point p = {0,0};
|
||||
init_graph_tool(NULL,&p);
|
||||
init_snd_tool();
|
||||
|
||||
// menu_bar_handle = GetNewMBar(128);
|
||||
// if (menu_bar_handle == NULL) {
|
||||
// SysBeep(2);
|
||||
// ExitToShell();
|
||||
// }
|
||||
// SetMenuBar(menu_bar_handle);
|
||||
// DisposeHandle(menu_bar_handle);
|
||||
//
|
||||
// apple_menu = GetMenuHandle(500);
|
||||
// file_menu = GetMenuHandle(550);
|
||||
// reg_menu = GetMenuHandle(600);
|
||||
// extra_menu = GetMenuHandle(650);
|
||||
// edit_menu = GetMenuHandle(700);
|
||||
// items_menu[0] = GetMenuHandle(750);
|
||||
// items_menu[1] = GetMenuHandle(751);
|
||||
// items_menu[2] = GetMenuHandle(752);
|
||||
// items_menu[3] = GetMenuHandle(753);
|
||||
|
||||
//init_fonts();
|
||||
|
||||
// DrawMenuBar();
|
||||
|
||||
init_dialogs();
|
||||
|
||||
|
||||
while (!All_Done){
|
||||
if(cd_create_dialog_parent_num(8000,0) == -3){
|
||||
//printf("Dialog not found.\n");
|
||||
display_strings("The dialog id 8000 could not be loaded.", "", "Dialog not found.",23,4,0);
|
||||
exit(1);
|
||||
}
|
||||
cd_attach_key(8000, 4, 24);
|
||||
//Handle_One_Event();
|
||||
cd_run_dialog();
|
||||
cd_kill_dialog(8000);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Initialize(void)
|
||||
{
|
||||
|
||||
OSErr error;
|
||||
unsigned long randSeed;
|
||||
BitMap screenBits;
|
||||
FSRef gRef;
|
||||
|
||||
//char cPath[768];
|
||||
// CFBundleRef mainBundle=CFBundleGetMainBundle();
|
||||
// CFURLRef graphicsURL = CFBundleCopyResourceURL(mainBundle,CFSTR("bladespced.rsrc"),CFSTR(""),NULL);
|
||||
// CFStringRef graphicsPath = CFURLCopyFileSystemPath(graphicsURL, kCFURLPOSIXPathStyle);
|
||||
// CFStringGetCString(graphicsPath, cPath, 512, kCFStringEncodingUTF8);// FSPathMakeRef((UInt8*)cPath, &gRef, false);
|
||||
// error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &mainRef);
|
||||
// if (error != noErr) {
|
||||
// printf("Error! PC Editor resource file not found.\n");
|
||||
// ExitToShell();
|
||||
// }
|
||||
{
|
||||
char *path = "Scenario Editor/Blades of Exile Graphics";
|
||||
error = FSPathMakeRef((UInt8*) path, &gRef, false);
|
||||
if (error != noErr) {
|
||||
//SysBeep(1);
|
||||
printf("Error! File Blades of Exile Graphics not found.\n");
|
||||
ExitToShell();
|
||||
}
|
||||
error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &graphicsRef);
|
||||
}
|
||||
{
|
||||
char *path = "Scenario Editor/Blades of Exile Sounds";
|
||||
error = FSPathMakeRef((UInt8*) path, &gRef, false);
|
||||
error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &soundsRef);
|
||||
if (error != noErr) {
|
||||
//SysBeep(1);
|
||||
printf("Error! File Blades of Exile Sounds not found.\n");
|
||||
ExitToShell();
|
||||
}
|
||||
}
|
||||
{
|
||||
char *path = "Blades of Exile.app/Contents/Resources/bladesofexile.rsrc";
|
||||
error = FSPathMakeRef((UInt8*) path, &gRef, false);
|
||||
if (error != noErr) {
|
||||
//SysBeep(1);
|
||||
printf("Error! Blades of Exile resource not found.\n");
|
||||
ExitToShell();
|
||||
}
|
||||
error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &boeRef);
|
||||
}
|
||||
{
|
||||
char *path = "Blades of Exile Character Editor.app/Contents/Resources/bladespced.rsrc";
|
||||
error = FSPathMakeRef((UInt8*) path, &gRef, false);
|
||||
if (error != noErr) {
|
||||
//SysBeep(1);
|
||||
printf("Error! Blades of Exile PC Editor resource not found.\n");
|
||||
ExitToShell();
|
||||
}
|
||||
error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &scenRef);
|
||||
}
|
||||
{
|
||||
char *path = "Scenario Editor/BoE Scenario Editor.app/Contents/Resources/BoEscen.rsrc";
|
||||
error = FSPathMakeRef((UInt8*) path, &gRef, false);
|
||||
if (error != noErr) {
|
||||
//SysBeep(1);
|
||||
printf("Error! Blades of Exile Scenario Editor resources not found.\n");
|
||||
ExitToShell();
|
||||
}
|
||||
error = FSOpenResourceFile(&gRef, 0, NULL, fsRdPerm, &pcRef);
|
||||
}
|
||||
UseResFile(boeRef);
|
||||
// path = "Scenario Editor/Blades of Exile Sounds";
|
||||
// FSPathMakeRef((UInt8*) path, &sRef, false);
|
||||
// error = FSOpenResourceFile(&sRef, 0, NULL, fsRdPerm, &soundRef);
|
||||
// if (error != noErr) {
|
||||
// //SysBeep(1);
|
||||
// printf("Error! File Blades of Exile Sounds not found.\n");
|
||||
// ExitToShell();
|
||||
// }
|
||||
|
||||
InitCursor();
|
||||
|
||||
//
|
||||
// Make a new window for drawing in, and it must be a color window.
|
||||
// The window is full screen size, made smaller to make it more visible.
|
||||
//
|
||||
// GetQDGlobalsScreenBits(&screenBits);
|
||||
// Rect windRect = screenBits.bounds;
|
||||
// InsetRect(&windRect, 63, 34);
|
||||
// windRect.top = windRect.top + 15;
|
||||
// windRect.bottom = windRect.bottom + 15;
|
||||
|
||||
// mainPtr = GetNewCWindow(128,NULL,mainPtr);
|
||||
// ActivateWindow(mainPtr,true);
|
||||
// SetPort(GetWindowPort(mainPtr)); /* set window to current graf port */
|
||||
}
|
||||
|
||||
void display_strings_event_filter (short item_hit)////
|
||||
{
|
||||
short i;
|
||||
bool had1 = false, had2 = false;
|
||||
|
||||
switch (item_hit) {
|
||||
case 1:
|
||||
toast_dialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void display_strings(char *text1, char *text2, char *title,short graphic_num,short graphic_type,short parent_num)
|
||||
{
|
||||
|
||||
short item_hit;
|
||||
short store_which_string_dlog;
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
// if ((str1a <= 0) || (str1b <= 0))
|
||||
// return;
|
||||
store_which_string_dlog = 970;
|
||||
if (strlen(title) > 0)
|
||||
store_which_string_dlog += 2;
|
||||
if ((text2 != NULL) && (text2[0] != 0))
|
||||
store_which_string_dlog++;
|
||||
cd_create_dialog_parent_num(store_which_string_dlog,parent_num);
|
||||
|
||||
csp(store_which_string_dlog,store_which_string_dlog,graphic_num,graphic_type);
|
||||
|
||||
csit(store_which_string_dlog,4,(char *) text1);
|
||||
if (text2 != NULL) {
|
||||
csit(store_which_string_dlog,5,(char *) text2);
|
||||
}
|
||||
if (strlen(title) > 0)
|
||||
csit(store_which_string_dlog,6,title);
|
||||
csp(store_which_string_dlog,3,graphic_num,graphic_type);
|
||||
|
||||
item_hit = cd_run_dialog();
|
||||
cd_kill_dialog(store_which_string_dlog);
|
||||
}
|
||||
|
||||
void choose_dialog_event_filter(short item_hit){
|
||||
static RGBColor black = {0,0,0}, white = {65535,65535,65535};
|
||||
switch(item_hit){
|
||||
case 3:
|
||||
short n = cd_retrieve_text_edit_num(8000, 2);
|
||||
if(n == 8000) break;
|
||||
printf("Showing dialog %i\n",n);
|
||||
if(cd_create_dialog_parent_num(n,8000) == -3){
|
||||
char msg[100];
|
||||
sprintf(msg,"The dialog id %i could not be loaded.",n);
|
||||
display_strings(msg, "", "Dialog not found.",23,4,0);
|
||||
return;
|
||||
}
|
||||
cd_run_dialog();
|
||||
cd_kill_dialog(n);
|
||||
break;
|
||||
case 4:
|
||||
toast_dialog();
|
||||
All_Done = true;
|
||||
break;
|
||||
case 6:
|
||||
printf("Switching to BoE resfile.\n");
|
||||
cd_set_led_range(8000,6,8,6);
|
||||
UseResFile(boeRef);
|
||||
cd_set_bg_pat_num(5);
|
||||
cd_set_text_clr(white);
|
||||
break;
|
||||
case 7:
|
||||
printf("Switching to PC resfile.\n");
|
||||
cd_set_led_range(8000,6,8,7);
|
||||
UseResFile(pcRef);
|
||||
cd_set_bg_pat_num(5);
|
||||
cd_set_text_clr(white);
|
||||
break;
|
||||
case 8:
|
||||
printf("Switching to Scen resfile.\n");
|
||||
cd_set_led_range(8000,6,8,8);
|
||||
UseResFile(scenRef);
|
||||
cd_set_bg_pat_num(16);
|
||||
cd_set_text_clr(black);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void preview_event_filter(short item_hit){
|
||||
toast_dialog();
|
||||
}
|
||||
|
||||
void init_dialogs(){
|
||||
anim_gworld = load_pict(820);
|
||||
talkfaces_gworld = load_pict(860);
|
||||
items_gworld = load_pict(901);
|
||||
tiny_obj_gworld = load_pict(900);
|
||||
pc_gworld = load_pict(902);
|
||||
dlog_gworld = load_pict(850);
|
||||
for(int i = 0; i < 11; i++)
|
||||
monst_gworld[i] = load_pict(1100 + i);
|
||||
for(int i = 0; i < 7; i++)
|
||||
ter_gworld[i] = load_pict(800 + i);
|
||||
small_ter_gworld = load_pict(904);
|
||||
fields_gworld = load_pict(821);
|
||||
pc_stats_gworld = load_pict(1400);
|
||||
item_stats_gworld = load_pict(1401);
|
||||
mixed_gworld = load_pict(903);
|
||||
cd_init_dialogs(&anim_gworld, &talkfaces_gworld, &items_gworld, &tiny_obj_gworld, &pc_gworld, &dlog_gworld, monst_gworld, ter_gworld, &small_ter_gworld, &fields_gworld, &pc_stats_gworld, &item_stats_gworld, &mixed_gworld, NULL);
|
||||
cd_register_event_filter(8000,choose_dialog_event_filter);
|
||||
cd_register_event_filter(970,display_strings_event_filter);
|
||||
cd_register_event_filter(971,display_strings_event_filter);
|
||||
cd_register_event_filter(972,display_strings_event_filter);
|
||||
cd_register_event_filter(973,display_strings_event_filter);
|
||||
cd_register_default_event_filter(preview_event_filter);
|
||||
}
|
Reference in New Issue
Block a user