Skip to content

Commit

Permalink
0.0.159: Sushi time
Browse files Browse the repository at this point in the history
* Add cooked checks for eating some meat
* Fix tile texture order
* Add cooking for deer meat
  • Loading branch information
RyanBabij committed Feb 4, 2020
1 parent 1c9ebb2 commit d7517b2
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 40 deletions.
2 changes: 1 addition & 1 deletion CompileCount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
*/
#include <string>

const std::string COMPILE_COUNT = "6164";
const std::string COMPILE_COUNT = "11239";
#endif
22 changes: 12 additions & 10 deletions Driver.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
/* WorldSim: Driver
Main file for WorldSim. Created by Ryan Babij (https://github.com/RyanBabij/WorldSim)
License: CC0
All code and binaries in WorldSim repo are copyrighted.
Wildcat code is public domain.
*/

#include <string>


#define WILDCAT_USE_OPENGL
//#define WILDCAT_USE_DIRECT3D

// What OS we are compiling for. Currently only Windows and Linux are supported cos I don't got a Mac.
// What OS we are compiling for. Currently only Windows and Linux are supported cos I don't got a Mac.
#include <System/Windows.hpp> //#define WILDCAT_WINDOWS
//#define WILDCAT_LINUX

//#define WILDCAT_AUDIO

#define GLEW_STATIC
// Need to figure out which of this is better. I think GLEW is more supported.
#include <Graphics/OpenGL/glew.h> // THIS CURRENTLY FIXES LINKER CRAP. Also allows RGBA_COMPRESSED, it would seem.
#define FREEGLUT_STATIC
#include <Graphics/OpenGL/freeglut.h> //

// DYNAMICALLY GENERATED HEADER FILE WITH STRING WHICH COUNTS COMPILATIONS.
#include "CompileCount.hpp"

Expand Down Expand Up @@ -62,12 +70,6 @@ class Stream
// Class for managing world save files.
SaveFileManager saveFileManager;

#define GLEW_STATIC
// Need to figure out which of this is better. I think GLEW is more supported.
#include <Graphics/OpenGL/glew.h> // THIS CURRENTLY FIXES LINKER CRAP. Also allows RGBA_COMPRESSED, it would seem.
#define FREEGLUT_STATIC
#include <Graphics/OpenGL/freeglut.h> //

#include <Graphics/Render/Renderer.cpp>
#include <Graphics/Texture/Texture.hpp>
#include <Graphics/Texture/TextureLoader.hpp>
Expand Down
2 changes: 1 addition & 1 deletion Driver_Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Item;
Item * inventoryGrid [10][10];

// SYSTEM STRINGS
const std::string VERSION = "0.0.158 Win32 dev";
const std::string VERSION = "0.0.159 Win32 dev";
const std::string G_WINDOW_TITLE = "WorldSim";
const std::string SAVE_FOLDER_PATH = "savedata";

Expand Down
24 changes: 22 additions & 2 deletions Item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,19 +731,39 @@ class Item_DeerPelt: public Item
class Item_DeerMeat: public Item
{
public:
bool isCooked;

Item_DeerMeat()
{
isCooked=false;
consumeTime = 5;
hungerRestore = 250;
}
virtual ~Item_DeerMeat()
{
}
std::string getName() override { return "Deer Meat"; }

std::string getName() override
{
if (isCooked)
{
return "Cooked deer meat";
}
return "Raw deer meat";
}

virtual void interact (Item*, int interactType=0) override; /* cook */
virtual void interact (Character*, int interactType=0) override; /* eat */
virtual void interact (WorldObject*, int interactType=0) override; /* eat */

virtual Vector <std::string>* getInteractNames(Item* _w) override;
virtual Vector <std::string>* getInteractNames(Character* _w) override;

Texture* currentTexture() override
{
if (isCooked )
{
return &TEX_ITEM_FOOD_STEAK_COOKED;
}
return &TEX_ITEM_FOOD_STEAK_RAW;
}
};
Expand Down
67 changes: 65 additions & 2 deletions Item_All.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,77 @@ void Item_Hand::interact(WorldObject* _target, int interactType /* =0 */)

void Item_Fish::interact (Character* _character, int interactType /* =0 */)
{
Console ("You eat the fish");
owner->consume(this);
if (isCooked)
{
Console ("You eat the cooked fish");
owner->consume(this);
}
else
{
Console ("Nice sushi");
owner->consume(this);
}



}

void Item_Fish::addToRecipeManager()
{
recipeManager.addToRecipes(this);
}

// DEER MEAT

Vector <std::string>* Item_DeerMeat::getInteractNames(Item* _w)
{
if (_w==0) { return 0; }

auto vInteract = new Vector <std::string>;
if (_w->canCook)
{
vInteract->push("Cook meat");
}
return vInteract;
}
Vector <std::string>* Item_DeerMeat::getInteractNames(Character* _w)
{
if (_w==0) { return 0; }

auto vInteract = new Vector <std::string>;
vInteract->push("Eat deer meat");
return vInteract;
}

void Item_DeerMeat::interact (Item* _item, int interactType /* =0 */)
{
// Check if we can cook with this object
if ( _item->canCook )
{

Console ("You cook the deer meat");
isCooked=true;
}
}

void Item_DeerMeat::interact (WorldObject* _target, int interactType /* =0 */)
{
// Check if we can cook with this object
Console ("Generic deer meat");
}

void Item_DeerMeat::interact (Character* _character, int interactType /* =0 */)
{
if (isCooked)
{
Console ("You eat the deer meat");
owner->consume(this);
}
else
{
Console ("It's fucking raw");
}
}

// SWORD

Expand Down Expand Up @@ -563,6 +625,7 @@ void Item_Plank::addToRecipeManager()
{
if ( interactionType==0) /* Build floor */
{
Console("Building floor");
obj->hasFloor = 2;
}
else /* Demolish floor */
Expand Down
23 changes: 14 additions & 9 deletions LocalTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ Texture* LocalTile::currentTexture()
return &TEX_LOCAL_FLOOR;
}
else if (hasFloor==2)
{ return &TEX_FLOOR_WOOD;
{
return &TEX_FLOOR_WOOD;
}

//enum enumBiome { NOTHING=0, OCEAN=1, GRASSLAND=2, FOREST=3, DESERT=4, MOUNTAIN=5, SNOW=6, HILLY=7, JUNGLE=8, WETLAND=9, STEPPES=10, CAVE=11, RUIN=12, ICE=13};
Expand Down Expand Up @@ -254,6 +255,8 @@ Texture* LocalTile::currentTexture()
return &TEX_WORLD_TEST_00;
}


// Push in reverse rendering order
Vector <Texture*> * LocalTile::currentTextures()
{
auto vTexture = new Vector <Texture*>;
Expand All @@ -263,14 +266,7 @@ Vector <Texture*> * LocalTile::currentTextures()

//return &TEX_LOCAL_FLOOR;

if ( hasFloor==1 )
{
vTexture->push(&TEX_LOCAL_FLOOR);
}
else if (hasFloor==2)
{
vTexture->push(&TEX_FLOOR_WOOD);
}


//enum enumBiome { NOTHING=0, OCEAN=1, GRASSLAND=2, FOREST=3, DESERT=4, MOUNTAIN=5, SNOW=6, HILLY=7, JUNGLE=8, WETLAND=9, STEPPES=10, CAVE=11, RUIN=12, ICE=13};
if ( baseTerrain == NOTHING )
Expand Down Expand Up @@ -340,6 +336,15 @@ Vector <Texture*> * LocalTile::currentTextures()
//vTexture->push(&TEX_WORLD_ARTIFACT_GEMS);
}

if ( hasFloor==1 )
{
vTexture->push(&TEX_LOCAL_FLOOR);
}
else if (hasFloor==2)
{
vTexture->push(&TEX_FLOOR_WOOD);
}

if ( shotOverlay )
{
vTexture->push(&TEX_GUI_TILE_SELECTION_FULL);
Expand Down
28 changes: 13 additions & 15 deletions World_Viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,21 +992,19 @@ void switchTarget(World_Local* _worldLocal)

for (int currentX = pixelTileX; currentX<mainViewNX+tileSize; currentX+=tileSize)
{

// Check if we're supposed to render a local map on this tile.
World_Local * localMap = 0;
if ( tileSize >= 12 && world->isSafe(tileX,tileY) )
{

for ( int i=0;i<world->vWorldLocal.size();++i)
{
if ( world->vWorldLocal(i)->globalX == tileX && world->vWorldLocal(i)->globalY == tileY )
{
localMap = world->vWorldLocal(i);
break;
}
}
}
// Check if we're supposed to render a local map on this tile.
World_Local * localMap = 0;
if ( tileSize >= 12 && world->isSafe(tileX,tileY) )
{
for ( int i=0;i<world->vWorldLocal.size();++i)
{
if ( world->vWorldLocal(i)->globalX == tileX && world->vWorldLocal(i)->globalY == tileY )
{
localMap = world->vWorldLocal(i);
break;
}
}
}

// RENDER THE LOCAL TILE
// Should be it's own function
Expand Down

0 comments on commit d7517b2

Please sign in to comment.