+include/tinyxml2.h linguist-vendored
src/tinyxml2.cpp linguist-vendored
src/threadpool.cpp linguist-vendored
-include/tinyxml2.h linguist-vendored
include/threadpool.h linguist-vendored
include/SDL2/* linguist-vendored
include/freetype/* linguist-vendored
- fixed world draw shadings
- improved merchant menu
+
+3/9/2016:
+=========
+
+ - pages are XMLable and can be drawn
+ - dialogs are cool with threads
+ - better lighting
+++ /dev/null
-
-ID DEBUG_ITEM
- NAME "Debug"
- TYPE TOOL
- WIDTH 1
- HEIGHT 1
- STACKSIZE 1
- TEX "assets/items/ITEM_TEST.png"
- ENI
-
-ID TEST_ITEM
- NAME "Dank MayMay"
- TYPE TOOL
- WIDTH HLINE*10
- HEIGHT HLINE*10
- STACKSIZE 420
- TEX "assets/items/ITEM_TEST.png"
- ENI
-
-ID PLAYER_BAG
- NAME "Your Bag"
- TYPE EQUIP
- WIDTH HLINE*5
- HEIGHT HLINE*5
- STACKSIZE 1
- TEX "assets/items/ITEM_TEST.png"
- ENI
-
-ID FLASHLIGHT
- NAME "Flashlight"
- TYPE TOOL
- WIDTH HLINE*4
- HEIGHT HLINE*8
- STACKSIZE 1
- TEX "assets/items/flashlight_off.png"
- ENI
-
-ID SWORD_WOOD
- NAME "Wood Sword"
- TYPE SWORD
- WIDTH HLINE*4
- HEIGHT HLINE*10
- STACKSIZE 1
- TEX "assets/items/SWORD_WOOD.png"
- STOP
+++ /dev/null
-TITLE "Test" DESC "A test quest" REWARD 1 x SWORD_WOOD END
* Texture functions are given a namespace for better organization.
*/
-namespace Texture{
+namespace Texture {
/**
* Loads a texture from the given file name, returning the GLuint used for
void merchantBox();
void waitForDialog(void);
+ void drawPage( std::string path );
+
/*
* Draws a larger string in the center of the screen. Drawing is done inside this function.
*/
extern Player *player; // main.cpp
extern World *currentWorld; // main.cpp
-extern float shit;
extern Menu *currentMenu;
extern Menu pauseMenu;
extern Menu optionsMenu;
void destroyEverything(void);
-void segFault(){
+inline void segFault() {
(*((int *)NULL))++;
}
return 0;
}
+void commonPageFunc( Mob *callee )
+{
+ static bool lock = false;
+
+ if ( !lock ) {
+ lock = true;
+
+ ui::drawPage( callee->heyid );
+ ui::waitForDialog();
+
+ callee->alive = false;
+ lock = false;
+ }
+}
+
void commonTriggerFunc(Mob *callee){
static bool lock = false;
XMLDocument xml;
Mix_Chunk *sanic;
+static GLuint pageTex = 0;
+
void Menu::gotoParent(){
if(parent == NULL){
currentMenu = NULL;
}
+ void drawPage( std::string path ) {
+ pageTex = Texture::loadTexture( path );
+ }
+
void draw(void){
unsigned char i;
float x,y,tmp;
char *rtext;
- if(dialogBoxExists){
+ if ( pageTex ) {
+
+ glEnable( GL_TEXTURE_2D);
+ glBindTexture( GL_TEXTURE_2D, pageTex );
+ glBegin( GL_QUADS );
+ glTexCoord2i( 0, 0 ); glVertex2i( offset.x - 300, SCREEN_HEIGHT - 100 );
+ glTexCoord2i( 1, 0 ); glVertex2i( offset.x + 300, SCREEN_HEIGHT - 100 );
+ glTexCoord2i( 1, 1 ); glVertex2i( offset.x + 300, SCREEN_HEIGHT - 600 );
+ glTexCoord2i( 0, 1 ); glVertex2i( offset.x - 300, SCREEN_HEIGHT - 600 );
+ glEnd();
+ glDisable( GL_TEXTURE_2D);
+
+ } else if (dialogBoxExists){
rtext=typeOut(dialogBoxText);
glVertex2f(x+1+(SCREEN_WIDTH/3),y+1);
glVertex2f(x+1+(SCREEN_WIDTH/3),y-1-SCREEN_HEIGHT*.6);
glVertex2f(x-1,y-1-SCREEN_HEIGHT*.6);
- glVertex2f(x,y+1);
+ glVertex2f(x - 1,y+1);
glEnd();
glColor3ub(0,0,0);
glColor3ub(255, 255, 255);
glBegin(GL_LINE_STRIP);
- glVertex2f(x-1 ,y+1);
- glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y+1);
- glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y-1-SCREEN_HEIGHT/4);
- glVertex2f(x-1 ,y-1-SCREEN_HEIGHT/4);
- glVertex2f(x ,y+1);
+ glVertex2i(x-1 ,y+1);
+ glVertex2i(x+1 +SCREEN_WIDTH-HLINE*16,y+1);
+ glVertex2i(x+1+SCREEN_WIDTH-HLINE*16,y-1-SCREEN_HEIGHT/4);
+ glVertex2i(x-1 ,y-1-SCREEN_HEIGHT/4);
+ glVertex2i( x - 1, y + 1 );
glEnd();
glColor3ub(0,0,0);
void dialogAdvance(void){
unsigned char i;
+
+ if ( pageTex ) {
+ glDeleteTextures( 1, &pageTex );
+ pageTex = 0;
+ return;
+ }
+
if(!typeOutDone){
typeOutDone = true;
return;
}
}
DONE:
-
// handle important text
if(dialogImportant){
// mouse clicks
case SDL_MOUSEBUTTONDOWN:
// right click advances dialog
- if ( ( e.button.button & SDL_BUTTON_RIGHT ) && dialogBoxExists )
+ if ( ( e.button.button & SDL_BUTTON_RIGHT ) && (dialogBoxExists | pageTex) )
dialogAdvance();
// left click uses item
if ( ( e.button.button & SDL_BUTTON_LEFT ) && !dialogBoxExists )
extern Player *player; // main.cpp?
extern World *currentWorld; // main.cpp
extern int commonAIFunc(NPC *); // entities.cpp
-extern void commonTriggerFunc(Mob *); // entities.cpp
+extern void commonTriggerFunc(Mob *); // gameplay.cpp
+extern void commonPageFunc(Mob *); // gameplay.cpp
extern bool inBattle;
extern unsigned int tickCount; // main.cpp
float spawnx, randx;
bool dialog,Indoor;
- const char *ptr,*name;
+ const char *ptr;
+ std::string name;
currentXML = (std::string)"xml/" + path;
while(wxml){
name = wxml->Name();
- if(!strcmp(name,"link")){
+ if ( name == "link" ) {
if((ptr = wxml->Attribute("left")))
tmp->setToLeft(ptr);
else if((ptr = wxml->Attribute("right")))
tmp->setToRight(ptr);
else
abort();
- }else if(!strcmp(name,"style")){
+ } else if ( name == "style" ) {
tmp->setStyle(wxml->StrAttribute("folder"));
tmp->setBackground((WorldBGType)wxml->UnsignedAttribute("background"));
tmp->setBGM(wxml->StrAttribute("bgm"));
- }else if(!strcmp(name,"generation")){
+ } else if ( name == "generation" ) {
if(!strcmp(wxml->Attribute("type"),"Random")){
if(Indoor)
((IndoorWorld *)tmp)->generate(wxml->UnsignedAttribute("width"));
}
}else if(Indoor)
abort();
- }else if(!strcmp(name,"mob")){
+ } else if ( name == "mob" ) {
unsigned int type;
type = wxml->UnsignedAttribute("type");
if(wxml->QueryFloatAttribute("x",&spawnx) != XML_NO_ERROR)
if(wxml->QueryBoolAttribute("aggressive",&dialog) == XML_NO_ERROR)
tmp->mob.back()->aggressive = dialog;
- }else if(!strcmp(name,"npc")){
+ } else if ( name == "npc" ) {
const char *npcname;
if(wxml->QueryFloatAttribute("x",&spawnx) != XML_NO_ERROR)
tmp->npc.back()->addAIFunc(commonAIFunc,false);
else tmp->npc.back()->dialogIndex = 9999;
- }else if(!strcmp(name,"structure")){
+ } else if ( name == "structure" ) {
tmp->addStructure((BUILD_SUB)wxml->UnsignedAttribute("type"),
wxml->QueryFloatAttribute("x",&spawnx) != XML_NO_ERROR ?
getRand() % tmp->getTheWidth() / 2.0f :
100,
wxml->StrAttribute("texture"),
wxml->StrAttribute("inside"));
- }else if(!strcmp(name,"trigger")){
+ } else if ( name == "trigger" ) {
tmp->addMob(MS_TRIGGER,wxml->FloatAttribute("x"),0,commonTriggerFunc);
tmp->mob.back()->heyid = wxml->Attribute("id");
+ } else if ( name == "page" ) {
+ tmp->addMob( MS_PAGE, wxml->FloatAttribute("x"), 0, commonPageFunc );
+ tmp->mob.back()->heyid = wxml->Attribute("id");
}
wxml = wxml->NextSiblingElement();
* READS DATA ABOUT STRUCTURE CONTAINED IN VILLAGE
*/
- if(!strcmp(name,"structure")){
+ if ( name == "structure" ) {
tmp->addStructure((BUILD_SUB)vil->UnsignedAttribute("type"),
vil->QueryFloatAttribute("x", &spawnx) != XML_NO_ERROR ? randx : spawnx,
100,
vil->StrAttribute("texture"),
vil->StrAttribute("inside"));
- }else if(!strcmp(name, "stall")){
+ }else if ( name == "stall" ) {
if(!strcmp(vil->Attribute("type"),"market")){
std::cout << "Market" << std::endl;
tmp->addStructure((BUILD_SUB)70,
<npc name="Ralph" hasDialog="true" />
<npc name="Johnny" hasDialog="false" />
+
+ <page x="-200" id="assets/pages/gootaGoFast.png" />
+
<village name="the Cranmore Tubing Park">
<structure type="0" x="-300" inside="playerSpawnHill1_Building1.xml"/>
<structure type="5" x="-500" inside="playerSpawnHill1_Building1.xml"/>