<?xml version="1.0"?>
-<screen width="1280" height="800" fullscreen="true"/>
+<screen width="1280" height="800"/>
<!--
VCR_OSD_MONO_1.001.ttf
-->
-
<font path="ttf/FreePixel.ttf"/>
<hline size="3"/>
void sspawn(float x,float y);
};
+class Structures : public Entity{
+public:
+ BUILD_SUB bsubtype;
+ World *inWorld;
+ std::string inside;
+ std::string textureLoc;
+
+ Structures();
+ ~Structures();
+
+ unsigned int spawn(BUILD_SUB, float, float);
+};
+
+
class NPC : public Entity {
public:
std::vector<int (*)(NPC *)>aiFunc;
void addAIFunc(int (*func)(NPC *),bool preload);
void clearAIFunc(void);
virtual void interact();
- void wander(int);
+ virtual void wander(int);
};
class Merchant : public NPC{
uint currTrade;
void interact();
+ Structures *inside;
Merchant();
~Merchant();
-};
-
-class Structures : public Entity{
-public:
- BUILD_SUB bsubtype;
- World *inWorld;
- std::string inside;
- std::string textureLoc;
- Structures();
- ~Structures();
-
- unsigned int spawn(BUILD_SUB, float, float);
+ void wander(int);
};
class Mob : public Entity{
*/
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- //SDL_GL_SetSwapInterval(0);
+ SDL_GL_SetSwapInterval(0);
glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
if(!currentTime) // Initialize currentTime if it hasn't been
currentTime=millis();
+ if(!prevTime){
+ prevTime=currentTime;
+ }
/*
* Update timing values. This is crucial to calling logic and updating the window (basically
* the entire game).
*/
- prevTime = currentTime;
currentTime = millis();
deltaTime = currentTime - prevTime;
-
+ prevTime = currentTime;
if(currentMenu)goto MENU;
currentWorld->bgmPlay(prev);
ui::dialogBoxExists = false;
}
-
if(prevPrevTime + MSEC_PER_TICK <= currentTime){
//pool.Enqueue(logic);
logic();
glPushMatrix();
glLoadIdentity();
// glOrtho((offset.x-SCREEN_WIDTH/2),(offset.x+SCREEN_WIDTH/2),(offset.y-SCREEN_HEIGHT/2),(offset.y+SCREEN_HEIGHT/2),-1,1);
- glOrtho(floor(offset.x-SCREEN_WIDTH/2),floor(offset.x+SCREEN_WIDTH/2),floor(offset.y-SCREEN_HEIGHT/2),floor(offset.y+SCREEN_HEIGHT/2),-1,1);
+ glOrtho(floor(offset.x-SCREEN_WIDTH/2),floor(offset.x+SCREEN_WIDTH/2),floor(offset.y-SCREEN_HEIGHT/2),floor(offset.y+SCREEN_HEIGHT/2),20,-20);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
* GL_COLOR_BUFFER_BIT allows the matrices to have color on them
*/
- glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_LIGHTING_BIT );
- glClear(GL_COLOR_BUFFER_BIT);
+ glPushAttrib( GL_DEPTH_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/**************************
**** RENDER STUFF HERE ****
if(ui::mouse.x > player->loc.x && ui::mouse.y < player->loc.y+player->height/2 && handAngle <= 0)
handAngle = 360 + handAngle;
-
/*
* Draw the player's inventory.
*/
"Frig.",
"The sine of theta equals the opposite over the hypotenuese.",
"Did you know the developers spelt brazier as brazzier.",
- "My dad once said to me, \"Boy, you are in a game.\" I never knew what he meant by that."
+ "What's a bagel? I don't know because I'm mormon"
};
void initEntity(){
trade.reserve(100);
currTrade = 0;
+ inside = nullptr;
+
//tex = new Texturec(1,"assets/NPC.png");
//inv = new Inventory(NPC_INV_SIZE);
//inv = new Inventory(1);
/*while(!aiFunc.empty()){
aiFunc.pop_back();
}*/
-
+ delete inside;
//delete inv;
//delete tex;
//delete[] name;
}).detach();
}
+void Merchant::wander(int timeRun){
+ static int direction;
+ if ( ticksToUse == 0 ) {
+ ticksToUse = timeRun;
+
+ vel.x = .008 * HLINE;
+ direction = (getRand() % 3 - 1);
+
+ if ( direction == 0 )
+ ticksToUse *= 2;
+
+ vel.x *= direction;
+ }
+
+ if( vel.x < 0)
+ currentWorld->goWorldLeft( this );
+ if(inside != nullptr){
+ if(loc.x <= inside->loc.x)loc.x = inside->loc.x;
+ if(loc.x + width >= inside->loc.x + inside->width)loc.x = inside->loc.x + inside->width - width;
+ }
+ ticksToUse--;
+}
+
void Merchant::interact(){
std::thread([this]{
ui::merchantBox(name, trade[currTrade], ":Accept:Good-Bye", false, "Welcome to Smithy\'s. Buy your sausages here you freaking meme lording screw-face");
* screen.
*/
-void World::
-draw( Player *p )
-{
+void World::draw(Player *p){
// iterators
int i, iStart, iEnd;
vil->StrAttribute("texture"),
vil->StrAttribute("inside"));
tmp->addMerchant(0,100);
+ tmp->merchant.back()->inside = tmp->build.back();
if(vil->FirstChildElement("buy")){
std::cout << "Buy" << std::endl;
}if(vil->FirstChildElement("sell")){
<page x="-200" id="assets/pages/gootaGoFast.png" />
- <village name="the Cranmore Tubing Park">
+ <village name="Scrub Lawd">
<structure type="0" x="-300" inside="playerSpawnHill1_Building1.xml"/>
<structure type="5" x="-500" inside="playerSpawnHill1_Building1.xml"/>
<stall type="market" texture="assets/style/classic/stall.png">