From 75b3ad661c2d6ed382620a25613846c2b2b10f46 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 3 May 2012 22:20:35 +0000 Subject: Misc updates. --- .gitignore | 4 ++++ bloodfields.stage | 2 +- default.bld | 11 ++++++++++- sml-help.sml | 18 ++++++++++++++++++ src/options.cpp | 25 +++++++++++++++++++------ support/vim/syntax/stage.vim | 2 +- 6 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 sml-help.sml diff --git a/.gitignore b/.gitignore index 9b9c783..2ccb45d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ stage*.zip *.o *.win_o libbu++ +libgats +src/datafiles.cpp +src/datafiles.h +*.dll diff --git a/bloodfields.stage b/bloodfields.stage index bfef7ba..861fdb7 100644 --- a/bloodfields.stage +++ b/bloodfields.stage @@ -98,7 +98,7 @@ function mkEnemy() global.enemy = global.enemyTypes[eid]; mod = player.level; - if mod > count(global.enemyMods) then + if mod > count(global.enemyMods) - 1 then { mod = count(global.enemyMods); } diff --git a/default.bld b/default.bld index b35ee6a..6f9feeb 100644 --- a/default.bld +++ b/default.bld @@ -10,7 +10,7 @@ if exists("src/parser.tab.cpp") then action "default" { - build: ["src/version.h", "stage"]; + build: ["src/version.h", "src/datafiles.h", "stage"]; } target "src/version.h" @@ -41,6 +41,15 @@ target "src/version.h" } } +target "src/datafiles.h" +{ + input ["sml-help.sml"]; + profile "build" + { + execute("bin2cpp -d src -f deflate sml-help.sml"); + } +} + CC="g++"; target "stage" { diff --git a/sml-help.sml b/sml-help.sml new file mode 100644 index 0000000..74ac686 --- /dev/null +++ b/sml-help.sml @@ -0,0 +1,18 @@ +SML - STAGE Markup Language help[break][break] +SML has two types of tags, unary tags stand on their own and are fenced by +square brackets like \[break]. Putting a \[braek] in anywhere will add a +paragraph break. This is the only way to insert a newline manually, as SML will +reformat your text to fit the available space automatically. +[break] +There are also binary tags, which contain text and let you change the formatting +in a variety of ways. For example, you can set the [yellow>color of some +text and end with \[green>Green[red>Red[yellow>Yellow[blue>Blue[magenta>Magenta[cyan>Cyan[white>White #include #include +#include "datafiles.h" #include @@ -108,7 +109,7 @@ int Options::smlTest( Bu::Array aArgs ) fIn.close(); SmlNode *pRoot = SmlNode::parse( sContent ); - sio << *pRoot << sio.nl; +// sio << *pRoot << sio.nl; try { @@ -130,12 +131,24 @@ int Options::smlTest( Bu::Array aArgs ) int Options::smlHelp( Bu::Array aArgs ) { - Bu::File fIn("sml-help.sml.gz", Bu::File::Read ); - Bu::Deflate dIn( fIn ); - char buf[4096]; - buf[dIn.read( buf, 4096 )] = '\0'; - printf("%s\n", buf ); + Bu::String sContent = Datafiles::getString("sml-help.sml"); + SmlNode *pRoot = SmlNode::parse( sContent ); + + try + { + InterfacePlugger &ip = InterfacePlugger::getInstance(); + Interface *pIface = ip.instantiate( sInterface ); + pIface->display( pRoot ); + ip.destroy( pIface ); + } + catch( Bu::HashException &e ) + { + sio << "No such interface found." << sio.nl; + } + + delete pRoot; + exit( 0 ); return 0; } diff --git a/support/vim/syntax/stage.vim b/support/vim/syntax/stage.vim index 6009d80..313760f 100644 --- a/support/vim/syntax/stage.vim +++ b/support/vim/syntax/stage.vim @@ -19,7 +19,7 @@ syn keyword Statement setup enter syn keyword Todo TODO FIXME XXX syn keyword Type function command situation game global player option syn keyword Constant null true false -syn keyword Builtins display goto exists delete exit return random integer float string debugString keys join +syn keyword Builtins display goto exists delete exit return random integer float string debugString keys join count syn cluster CommentGroup contains=Todo -- cgit v1.2.3