diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 3a46e23dc..5ecb8ac00 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -211,11 +211,31 @@ void Client::notifyUpdateAvailable() } } +void Client::notifyAuthUserChanged() +{ + for (std::vector::iterator iterator = listeners.begin(), end = listeners.end(); iterator != end; ++iterator) + { + (*iterator)->NotifyAuthUserChanged(this); + } +} + void Client::AddListener(ClientListener * listener) { listeners.push_back(listener); } +void Client::RemoveListener(ClientListener * listener) +{ + for (std::vector::iterator iterator = listeners.begin(), end = listeners.end(); iterator != end; ++iterator) + { + if((*iterator) == listener) + { + listeners.erase(iterator); + return; + } + } +} + void Client::Shutdown() { ClearThumbnailRequests(); @@ -256,6 +276,7 @@ Client::~Client() void Client::SetAuthUser(User user) { authUser = user; + notifyAuthUserChanged(); } User Client::GetAuthUser() @@ -664,6 +685,67 @@ failure: return RequestFailure; } +RequestStatus Client::AddComment(int saveID, std::string comment) +{ + lastError = ""; + std::vector * tags = NULL; + std::stringstream urlStream; + char * data = NULL; + int dataStatus, dataLength; + urlStream << "http://" << SERVER << "/Browse/Comments.json?ID=" << saveID << "&Key=" << authUser.SessionKey; + if(authUser.ID) + { + std::stringstream userIDStream; + userIDStream << authUser.ID; + + char * postNames[] = { "Comment", NULL }; + char * postDatas[] = { (char*)(comment.c_str()) }; + int postLengths[] = { comment.length() }; + data = http_multipart_post((char *)urlStream.str().c_str(), postNames, postDatas, postLengths, (char *)(userIDStream.str().c_str()), NULL, (char *)(authUser.SessionID.c_str()), &dataStatus, &dataLength); + } + else + { + lastError = "Not authenticated"; + return RequestFailure; + } + if(dataStatus == 200 && data) + { + try + { + std::istringstream dataStream(data); + json::Object objDocument; + json::Reader::Read(objDocument, dataStream); + + int status = ((json::Number)objDocument["Status"]).Value(); + + if(status!=1) + { + lastError = ((json::Number)objDocument["Error"]).Value(); + } + + if(status!=1) + goto failure; + } + catch (json::Exception &e) + { + lastError = "Could not read response"; + goto failure; + } + } + else + { + lastError = http_ret_text(dataStatus); + goto failure; + } + if(data) + free(data); + return RequestOkay; +failure: + if(data) + free(data); + return RequestFailure; +} + RequestStatus Client::FavouriteSave(int saveID, bool favourite) { lastError = ""; diff --git a/src/client/Client.h b/src/client/Client.h index b2822d4d7..a2d8720a4 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -67,6 +67,7 @@ private: void updateStamps(); static vector explodePropertyString(std::string property); void notifyUpdateAvailable(); + void notifyAuthUserChanged(); //Config file handle json::Object configDocument; @@ -79,6 +80,7 @@ public: ~Client(); void AddListener(ClientListener * listener); + void RemoveListener(ClientListener * listener); RequestStatus ExecVote(int saveID, int direction); RequestStatus UploadSave(SaveInfo * save); @@ -90,6 +92,8 @@ public: int GetStampsCount(); SaveFile * GetFirstStamp(); + RequestStatus AddComment(int saveID, std::string comment); + unsigned char * GetSaveData(int saveID, int saveDate, int & dataLength); LoginStatus Login(string username, string password, User & user); void ClearThumbnailRequests(); diff --git a/src/client/ClientListener.h b/src/client/ClientListener.h index 308721c2e..4fc2d8921 100644 --- a/src/client/ClientListener.h +++ b/src/client/ClientListener.h @@ -16,6 +16,7 @@ public: virtual ~ClientListener() {} virtual void NotifyUpdateAvailable(Client * sender) {} + virtual void NotifyAuthUserChanged(Client * sender) {} }; diff --git a/src/game/DecorationTool.h b/src/game/DecorationTool.h index c45eca32d..be79e6bc2 100644 --- a/src/game/DecorationTool.h +++ b/src/game/DecorationTool.h @@ -16,8 +16,8 @@ public: unsigned char Blue; unsigned char Alpha; - DecorationTool(ToolType decoMode_, string name, int r, int g, int b): - Tool(0, name, r, g, b), + DecorationTool(ToolType decoMode_, string name, string description, int r, int g, int b): + Tool(0, name, description, r, g, b), decoMode(decoMode_), Red(0), Green(0), diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 8ece34b9d..72c38c0e7 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -402,6 +402,15 @@ void GameController::Exit() HasDone = true; } +void GameController::LoadRenderPreset(RenderPreset preset) +{ + Renderer * renderer = gameModel->GetRenderer(); + gameModel->SetInfoTip(preset.Name); + renderer->SetRenderMode(preset.RenderModes); + renderer->SetDisplayMode(preset.DisplayModes); + renderer->SetColourMode(preset.ColourMode); +} + void GameController::Update() { ui::Point pos = gameView->GetMousePosition(); @@ -681,7 +690,18 @@ void GameController::NotifyUpdateAvailable(Client * sender) } }; - gameModel->AddNotification(new UpdateNotification(this, "A new version is available - click here to download")); + switch(sender->GetUpdateInfo().Type) + { + case UpdateInfo::Snapshot: + gameModel->AddNotification(new UpdateNotification(this, std::string("A new snapshot is available - click here to update"))); + break; + case UpdateInfo::Stable: + gameModel->AddNotification(new UpdateNotification(this, std::string("A new version is available - click here to update"))); + break; + case UpdateInfo::Beta: + gameModel->AddNotification(new UpdateNotification(this, std::string("A new beta is available - click here to update"))); + break; + } } void GameController::RemoveNotification(Notification * notification) diff --git a/src/game/GameController.h b/src/game/GameController.h index 4e2b43adc..2388c5da8 100644 --- a/src/game/GameController.h +++ b/src/game/GameController.h @@ -17,6 +17,7 @@ #include "cat/LuaScriptInterface.h" #include "options/OptionsController.h" #include "client/ClientListener.h" +#include "RenderPreset.h" #include "Menu.h" using namespace std; @@ -63,6 +64,7 @@ public: void Tick(); void Exit(); + void LoadRenderPreset(RenderPreset preset); void SetZoomEnabled(bool zoomEnable); void SetZoomPosition(ui::Point position); void AdjustBrushSize(int direction, bool logarithmic = false); diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 668b75597..e4ee15ba8 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -61,7 +61,15 @@ GameModel::GameModel(): { if(sim->elements[i].MenuSection < 12 && sim->elements[i].Enabled && sim->elements[i].MenuVisible) { - Tool * tempTool = new ElementTool(i, sim->elements[i].Name, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour)); + Tool * tempTool; + if(i == PT_LIGH) + { + tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour)); + } + else + { + tempTool = new ElementTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour)); + } menuList[sim->elements[i].MenuSection]->AddTool(tempTool); } } @@ -69,14 +77,14 @@ GameModel::GameModel(): //Build menu for GOL types for(int i = 0; i < NGOL; i++) { - Tool * tempTool = new GolTool(i, sim->gmenu[i].name, PIXR(sim->gmenu[i].colour), PIXG(sim->gmenu[i].colour), PIXB(sim->gmenu[i].colour)); + Tool * tempTool = new GolTool(i, sim->gmenu[i].name, std::string(sim->gmenu[i].description), PIXR(sim->gmenu[i].colour), PIXG(sim->gmenu[i].colour), PIXB(sim->gmenu[i].colour)); menuList[SC_LIFE]->AddTool(tempTool); } //Build other menus from wall data for(int i = 0; i < UI_WALLCOUNT; i++) { - Tool * tempTool = new WallTool(i, "", PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour)); + Tool * tempTool = new WallTool(i, "", std::string(sim->wtypes[i].descs), PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour)); menuList[SC_WALL]->AddTool(tempTool); //sim->wtypes[i] } @@ -88,17 +96,18 @@ GameModel::GameModel(): //Build menu for simtools for(int i = 0; i < sim->tools.size(); i++) { - Tool * tempTool = new Tool(i, sim->tools[i]->Name, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour)); + Tool * tempTool; + tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour)); menuList[SC_TOOL]->AddTool(tempTool); } //Add decoration tools to menu - menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendAdd, "ADD", 0, 0, 0)); - menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendRemove, "SUB", 0, 0, 0)); - menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendMultiply, "MUL", 0, 0, 0)); - menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendDivide, "DIV", 0, 0, 0)); - menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSmudge, "SMDG", 0, 0, 0)); - menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendAdd, "ADD", "Colour blending: Add", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendRemove, "SUB", "Colour blending: Subtract", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendMultiply, "MUL", "Colour blending: Multiply", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendDivide, "DIV", "Colour blending: Divide" , 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSmudge, "SMDG", "Smudge colour", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", "Set colour (No blending)", 0, 0, 0)); //Set default brush palette brushList.push_back(new EllipseBrush(ui::Point(4, 4))); @@ -517,6 +526,28 @@ void GameModel::RemoveNotification(Notification * notification) notifyNotificationsChanged(); } +void GameModel::SetToolTip(std::string text) +{ + toolTip = text; + notifyToolTipChanged(); +} + +void GameModel::SetInfoTip(std::string text) +{ + infoTip = text; + notifyInfoTipChanged(); +} + +std::string GameModel::GetToolTip() +{ + return toolTip; +} + +std::string GameModel::GetInfoTip() +{ + return infoTip; +} + void GameModel::notifyNotificationsChanged() { for(std::vector::iterator iter = observers.begin(); iter != observers.end(); ++iter) @@ -644,3 +675,19 @@ void GameModel::notifyLogChanged(string entry) observers[i]->NotifyLogChanged(this, entry); } } + +void GameModel::notifyInfoTipChanged() +{ + for(int i = 0; i < observers.size(); i++) + { + observers[i]->NotifyInfoTipChanged(this); + } +} + +void GameModel::notifyToolTipChanged() +{ + for(int i = 0; i < observers.size(); i++) + { + observers[i]->NotifyToolTipChanged(this); + } +} \ No newline at end of file diff --git a/src/game/GameModel.h b/src/game/GameModel.h index 5f656c129..28b86e649 100644 --- a/src/game/GameModel.h +++ b/src/game/GameModel.h @@ -53,6 +53,9 @@ private: User currentUser; bool colourSelector; ui::Colour colour; + + std::string infoTip; + std::string toolTip; //bool zoomEnabled; void notifyRendererChanged(); void notifySimulationChanged(); @@ -71,6 +74,8 @@ private: void notifyColourSelectorVisibilityChanged(); void notifyNotificationsChanged(); void notifyLogChanged(string entry); + void notifyInfoTipChanged(); + void notifyToolTipChanged(); public: GameModel(); ~GameModel(); @@ -81,6 +86,11 @@ public: void SetColourSelectorColour(ui::Colour colour); ui::Colour GetColourSelectorColour(); + void SetToolTip(std::string text); + void SetInfoTip(std::string text); + std::string GetToolTip(); + std::string GetInfoTip(); + void SetVote(int direction); SaveInfo * GetSave(); Brush * GetBrush(); diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index dd03987e2..4f9c41a01 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -33,7 +33,11 @@ GameView::GameView(): placeSaveThumb(NULL), mousePosition(0, 0), lastOffset(0), - drawSnap(false) + drawSnap(false), + toolTip(""), + infoTip(""), + infoTipPresence(0), + toolTipPosition(-1, -1) { int currentX = 1; @@ -255,6 +259,59 @@ GameView::GameView(): tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2); tempButton->SetActionCallback(new ElementSearchAction(this)); AddComponent(tempButton); + + //Render mode presets. Possibly load from config in future? + renderModePresets = new RenderPreset[10]; + + renderModePresets[0].Name = "Alternative Velocity Display"; + renderModePresets[0].RenderModes.push_back(RENDER_EFFE); + renderModePresets[0].RenderModes.push_back(RENDER_BASC); + renderModePresets[0].DisplayModes.push_back(DISPLAY_AIRC); + + renderModePresets[1].Name = "Velocity Display"; + renderModePresets[1].RenderModes.push_back(RENDER_EFFE); + renderModePresets[1].RenderModes.push_back(RENDER_BASC); + renderModePresets[1].DisplayModes.push_back(DISPLAY_AIRV); + + renderModePresets[2].Name = "Pressure Display"; + renderModePresets[2].RenderModes.push_back(RENDER_EFFE); + renderModePresets[2].RenderModes.push_back(RENDER_BASC); + renderModePresets[2].DisplayModes.push_back(DISPLAY_AIRP); + + renderModePresets[3].Name = "Persistent Display"; + renderModePresets[3].RenderModes.push_back(RENDER_EFFE); + renderModePresets[3].RenderModes.push_back(RENDER_BASC); + renderModePresets[3].DisplayModes.push_back(DISPLAY_PERS); + + renderModePresets[4].Name = "Fire Display"; + renderModePresets[4].RenderModes.push_back(RENDER_FIRE); + renderModePresets[4].RenderModes.push_back(RENDER_EFFE); + renderModePresets[4].RenderModes.push_back(RENDER_BASC); + + renderModePresets[5].Name = "Blob Display"; + renderModePresets[5].RenderModes.push_back(RENDER_FIRE); + renderModePresets[5].RenderModes.push_back(RENDER_EFFE); + renderModePresets[5].RenderModes.push_back(RENDER_BLOB); + + renderModePresets[6].Name = "Heat Display"; + renderModePresets[6].RenderModes.push_back(RENDER_BASC); + renderModePresets[6].DisplayModes.push_back(DISPLAY_AIRH); + renderModePresets[6].ColourMode = COLOUR_HEAT; + + renderModePresets[7].Name = "Fancy Display"; + renderModePresets[7].RenderModes.push_back(RENDER_FIRE); + renderModePresets[7].RenderModes.push_back(RENDER_GLOW); + renderModePresets[7].RenderModes.push_back(RENDER_BLUR); + renderModePresets[7].RenderModes.push_back(RENDER_EFFE); + renderModePresets[7].RenderModes.push_back(RENDER_BASC); + renderModePresets[7].DisplayModes.push_back(DISPLAY_WARP); + + renderModePresets[8].Name = "Nothing Display"; + renderModePresets[8].RenderModes.push_back(RENDER_BASC); + + renderModePresets[9].Name = "Heat Gradient Display"; + renderModePresets[9].RenderModes.push_back(RENDER_BASC); + renderModePresets[9].ColourMode = COLOUR_GRAD; } class GameView::MenuAction: public ui::ButtonAction @@ -308,7 +365,7 @@ void GameView::NotifyMenuListChanged(GameModel * sender) std::string tempString = ""; Menu * item = *iter; tempString += item->GetIcon(); - ui::Button * tempButton = new ui::Button(ui::Point(XRES+BARSIZE-16, currentY), ui::Point(15, 15), tempString); + ui::Button * tempButton = new ui::Button(ui::Point(XRES+BARSIZE-16, currentY), ui::Point(15, 15), tempString, item->GetDescription()); tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2); tempButton->SetTogglable(true); tempButton->SetActionCallback(new MenuAction(this, item)); @@ -379,7 +436,7 @@ void GameView::NotifyToolListChanged(GameModel * sender) for(int i = 0; i < toolList.size(); i++) { //ToolButton * tempButton = new ToolButton(ui::Point(XRES+1, currentY), ui::Point(28, 15), toolList[i]->GetName()); - ToolButton * tempButton = new ToolButton(ui::Point(currentX, YRES+1), ui::Point(30, 18), toolList[i]->GetName()); + ToolButton * tempButton = new ToolButton(ui::Point(currentX, YRES+1), ui::Point(30, 18), toolList[i]->GetName(), toolList[i]->GetDescription()); //currentY -= 17; currentX -= 31; tempButton->SetActionCallback(new ToolAction(this, toolList[i])); @@ -467,6 +524,17 @@ void GameView::NotifyPausedChanged(GameModel * sender) pauseButton->SetToggleState(sender->GetPaused()); } +void GameView::NotifyToolTipChanged(GameModel * sender) +{ + toolTip = sender->GetToolTip(); +} + +void GameView::NotifyInfoTipChanged(GameModel * sender) +{ + infoTip = sender->GetInfoTip(); + infoTipPresence = 120; +} + void GameView::NotifySaveChanged(GameModel * sender) { if(sender->GetSave()) @@ -675,6 +743,12 @@ void GameView::OnMouseUp(int x, int y, unsigned button) } } +void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip) +{ + this->toolTip = toolTip; + toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), Size.Y-MENUSIZE-10); +} + void GameView::OnMouseWheel(int x, int y, int d) { if(!d) @@ -819,6 +893,11 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool c->AdjustBrushSize(-1, true); break; } + + if(key >= '0' && key <= '9') + { + c->LoadRenderPreset(renderModePresets[key-'0']); + } } void GameView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt) @@ -864,6 +943,12 @@ void GameView::OnTick(float dt) { c->DrawFill(toolIndex, currentMouse); } + if(infoTipPresence>0) + { + infoTipPresence -= int(dt)>0?int(dt):1; + if(infoTipPresence<0) + infoTipPresence = 0; + } c->Update(); if(lastLogEntry > -0.1f) lastLogEntry -= 0.16*dt; @@ -975,16 +1060,18 @@ void GameView::NotifyNotificationsChanged(GameModel * sender) } }; - for(std::vector::iterator iter = notificationComponents.begin(); iter != notificationComponents.end(); ++iter) { - RemoveComponent(*iter); - delete *iter; + for(std::vector::const_iterator iter = notificationComponents.begin(), end = notificationComponents.end(); iter != end; ++iter) { + ui::Component * cNotification = *iter; + RemoveComponent(cNotification); + delete cNotification; } notificationComponents.clear(); + std::vector notifications = sender->GetNotifications(); int currentY = YRES-17; - for(std::vector::iterator iter = notifications.begin(); iter != notifications.end(); ++iter) + for(std::vector::iterator iter = notifications.begin(), end = notifications.end(); iter != end; ++iter) { int width = (Graphics::textwidth((*iter)->Message.c_str()))+8; ui::Button * tempButton = new ui::Button(ui::Point(XRES-width-22, currentY), ui::Point(width, 15), (*iter)->Message); @@ -1046,13 +1133,7 @@ void GameView::OnDraw() if(ren) { ren->clearScreen(1.0f); - ren->draw_air(); - ren->render_parts(); - ren->render_fire(); - ren->draw_grav(); - ren->DrawWalls(); - ren->DrawSigns(); - ren->FinaliseParts(); + ren->RenderBegin(); if(activeBrush && currentMouse.X > 0 && currentMouse.X < XRES && currentMouse.Y > 0 && currentMouse.Y < YRES) { ui::Point finalCurrentMouse = c->PointTranslate(currentMouse); @@ -1082,7 +1163,7 @@ void GameView::OnDraw() activeBrush->RenderPoint(g, finalCurrentMouse); } } - ren->RenderZoom(); + ren->RenderEnd(); if(selectMode!=SelectNone) { @@ -1167,6 +1248,17 @@ void GameView::OnDraw() sampleInfo << ", Ctype: " << c->ElementResolve(sample.ctype); g->drawtext(XRES+BARSIZE-(10+Graphics::textwidth((char*)sampleInfo.str().c_str())), 10, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255); + + if(infoTipPresence) + { + int infoTipAlpha = (infoTipPresence>50?50:infoTipPresence)*5; + g->drawtext((XRES-Graphics::textwidth((char*)infoTip.c_str()))/2, (YRES/2)-2, (char*)infoTip.c_str(), 255, 255, 255, infoTipAlpha); + } + + if(toolTipPosition.X!=-1 && toolTipPosition.Y!=-1 && toolTip.length()) + { + g->drawtext(toolTipPosition.X, toolTipPosition.Y, (char*)toolTip.c_str(), 255, 255, 255, 255); + } } ui::Point GameView::lineSnapCoords(ui::Point point1, ui::Point point2) diff --git a/src/game/GameView.h b/src/game/GameView.h index 4576b1328..4a841c151 100644 --- a/src/game/GameView.h +++ b/src/game/GameView.h @@ -12,6 +12,7 @@ #include "interface/Button.h" #include "interface/Slider.h" #include "ToolButton.h" +#include "RenderPreset.h" #include "Brush.h" using namespace std; @@ -37,6 +38,12 @@ private: bool zoomCursorFixed; bool drawSnap; int toolIndex; + + int infoTipPresence; + std::string toolTip; + ui::Point toolTipPosition; + std::string infoTip; + queue pointQueue; GameController * c; Renderer * ren; @@ -76,6 +83,8 @@ private: ui::Point mousePosition; + RenderPreset * renderModePresets; + Thumbnail * placeSaveThumb; Particle sample; @@ -108,6 +117,11 @@ public: void NotifyPlaceSaveChanged(GameModel * sender); void NotifyNotificationsChanged(GameModel * sender); void NotifyLogChanged(GameModel * sender, string entry); + void NotifyToolTipChanged(GameModel * sender); + void NotifyInfoTipChanged(GameModel * sender); + + virtual void ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip); + virtual void OnMouseMove(int x, int y, int dx, int dy); virtual void OnMouseDown(int x, int y, unsigned button); virtual void OnMouseUp(int x, int y, unsigned button); diff --git a/src/game/RenderPreset.h b/src/game/RenderPreset.h new file mode 100644 index 000000000..9cc9f4cdb --- /dev/null +++ b/src/game/RenderPreset.h @@ -0,0 +1,19 @@ +#ifndef RENDER_PRESET_H +#define RENDER_PRESET_H +class RenderPreset +{ +public: + std::string Name; + std::vector RenderModes; + std::vector DisplayModes; + unsigned int ColourMode; + + RenderPreset(): Name(""), ColourMode(0) {} + RenderPreset(std::string name, std::vector renderModes, std::vector displayModes, unsigned int colourMode): + Name(name), + RenderModes(renderModes), + DisplayModes(displayModes), + ColourMode(colourMode) + {} +}; +#endif \ No newline at end of file diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp index 2467d3fb8..efe483112 100644 --- a/src/game/Tool.cpp +++ b/src/game/Tool.cpp @@ -12,15 +12,17 @@ using namespace std; -Tool::Tool(int id, string name, int r, int g, int b): +Tool::Tool(int id, string name, string description, int r, int g, int b): toolID(id), toolName(name), + toolDescription(description), colRed(r), colGreen(g), colBlue(b) { } string Tool::GetName() { return toolName; } +string Tool::GetDescription() { return toolDescription; } Tool::~Tool() {} void Tool::Click(Simulation * sim, Brush * brush, ui::Point position) { } void Tool::Draw(Simulation * sim, Brush * brush, ui::Point position) { @@ -34,8 +36,8 @@ void Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Po } void Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {}; -ElementTool::ElementTool(int id, string name, int r, int g, int b): - Tool(id, name, r, g, b) +ElementTool::ElementTool(int id, string name, string description, int r, int g, int b): + Tool(id, name, description, r, g, b) { } ElementTool::~ElementTool() {} @@ -53,8 +55,8 @@ void ElementTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) } -WallTool::WallTool(int id, string name, int r, int g, int b): -Tool(id, name, r, g, b) +WallTool::WallTool(int id, string name, string description, int r, int g, int b): +Tool(id, name, description, r, g, b) { } WallTool::~WallTool() {} @@ -72,8 +74,8 @@ void WallTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) { } -GolTool::GolTool(int id, string name, int r, int g, int b): - Tool(id, name, r, g, b) +GolTool::GolTool(int id, string name, string description, int r, int g, int b): + Tool(id, name, description, r, g, b) { } GolTool::~GolTool() {} @@ -90,5 +92,14 @@ void GolTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) { sim->FloodParts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0); } - - +void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position) +{ + int p = sim->create_part(-2, position.X, position.Y, toolID); + if (p != -1) + { + sim->parts[p].life = brush->GetRadius().X+brush->GetRadius().Y; + if (sim->parts[p].life > 55) + sim->parts[p].life = 55; + sim->parts[p].temp = sim->parts[p].life*150; // temperature of the lighting shows the power of the lighting + } +} \ No newline at end of file diff --git a/src/game/Tool.h b/src/game/Tool.h index 819620d2f..2cc33be9b 100644 --- a/src/game/Tool.h +++ b/src/game/Tool.h @@ -22,9 +22,11 @@ class Tool protected: int toolID; string toolName; + string toolDescription; public: - Tool(int id, string name, int r, int g, int b); + Tool(int id, string name, string description, int r, int g, int b); string GetName(); + string GetDescription(); virtual ~Tool(); virtual void Click(Simulation * sim, Brush * brush, ui::Point position); virtual void Draw(Simulation * sim, Brush * brush, ui::Point position); @@ -38,7 +40,7 @@ class SignTool: public Tool { public: SignTool(): - Tool(0, "SIGN", 0, 0, 0) + Tool(0, "SIGN", "Sign. Click a sign to edit or anywhere else to create a new one", 0, 0, 0) { } virtual ~SignTool() {} @@ -53,7 +55,7 @@ class PropertyTool: public Tool { public: PropertyTool(): - Tool(0, "PROP", 0, 0, 0) + Tool(0, "PROP", "Property Edit. Click to alter the properties of elements in the field", 0, 0, 0) { } virtual ~PropertyTool() {} @@ -64,10 +66,25 @@ public: virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { } }; +class Element_LIGH_Tool: public Tool +{ +public: + Element_LIGH_Tool(int id, string name, string description, int r, int g, int b): + Tool(id, name, description, r, g, b) + { + } + virtual ~Element_LIGH_Tool() {} + virtual void Draw(Simulation * sim, Brush * brush, ui::Point position); + virtual void Click(Simulation * sim, Brush * brush, ui::Point position) { } + virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { } + virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { } + virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { } +}; + class ElementTool: public Tool { public: - ElementTool(int id, string name, int r, int g, int b); + ElementTool(int id, string name, string description, int r, int g, int b); virtual ~ElementTool(); virtual void Draw(Simulation * sim, Brush * brush, ui::Point position); virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2); @@ -78,7 +95,7 @@ public: class WallTool: public Tool { public: - WallTool(int id, string name, int r, int g, int b); + WallTool(int id, string name, string description, int r, int g, int b); virtual ~WallTool(); virtual void Draw(Simulation * sim, Brush * brush, ui::Point position); virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2); @@ -89,7 +106,7 @@ public: class GolTool: public Tool { public: - GolTool(int id, string name, int r, int g, int b); + GolTool(int id, string name, string description, int r, int g, int b); virtual ~GolTool(); virtual void Draw(Simulation * sim, Brush * brush, ui::Point position); virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2); diff --git a/src/game/ToolButton.cpp b/src/game/ToolButton.cpp index f1c5583b0..5c9f2d455 100644 --- a/src/game/ToolButton.cpp +++ b/src/game/ToolButton.cpp @@ -8,8 +8,8 @@ #include "ToolButton.h" #include "interface/Keys.h" -ToolButton::ToolButton(ui::Point position, ui::Point size, std::string text_): - ui::Button(position, size, text_) +ToolButton::ToolButton(ui::Point position, ui::Point size, std::string text_, std::string toolTip): + ui::Button(position, size, text_, toolTip) { SetSelectionState(-1); Appearance.BorderActive = ui::Colour(255, 0, 0); diff --git a/src/game/ToolButton.h b/src/game/ToolButton.h index 94042a902..db0cfac0c 100644 --- a/src/game/ToolButton.h +++ b/src/game/ToolButton.h @@ -13,7 +13,7 @@ class ToolButton: public ui::Button { int currentSelection; public: - ToolButton(ui::Point position, ui::Point size, std::string text_); + ToolButton(ui::Point position, ui::Point size, std::string text_, std::string toolTip = ""); virtual void OnMouseUp(int x, int y, unsigned int button); virtual void OnMouseClick(int x, int y, unsigned int button); virtual void Draw(const ui::Point& screenPos); diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index ef3b8aaa2..30f1bfdec 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -35,6 +35,29 @@ extern "C" #define drawrect(args) g->drawrect(args) #endif +void Renderer::RenderBegin() +{ + + draw_air(); + render_parts(); + render_fire(); + draw_grav(); + DrawWalls(); + DrawSigns(); +#ifndef OGLR + RenderZoom(); + FinaliseParts(); +#endif +} + +void Renderer::RenderEnd() +{ +#ifdef OGLR + RenderZoom(); + FinaliseParts(); +#endif +} + void Renderer::clearScreen(float alpha) { #ifdef OGLR @@ -245,7 +268,7 @@ void Renderer::FinaliseParts() } glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable( GL_TEXTURE_2D ); -#else +#elif defined(OGLI) g->draw_image(vid, 0, 0, VIDXRES, VIDYRES, 255); #endif } @@ -254,7 +277,7 @@ void Renderer::RenderZoom() { if(!zoomEnabled) return; - #ifdef OGLR + #if defined(OGLR) int sdl_scale = 1; int origBlendSrc, origBlendDst; float zcx1, zcx0, zcy1, zcy0, yfactor, xfactor, i; //X-Factor is shit, btw @@ -344,8 +367,8 @@ void Renderer::RenderZoom() int x, y, i, j; pixel pix; pixel * img = vid; - drawrect(zoomWindowPosition.X-2, zoomWindowPosition.Y-2, zoomScopeSize*ZFACTOR+2, zoomScopeSize*ZFACTOR+2, 192, 192, 192, 255); - drawrect(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR, zoomScopeSize*ZFACTOR, 0, 0, 0, 255); + drawrect(zoomWindowPosition.X-2, zoomWindowPosition.Y-2, zoomScopeSize*ZFACTOR+4, zoomScopeSize*ZFACTOR+4, 192, 192, 192, 255); + drawrect(zoomWindowPosition.X-1, zoomWindowPosition.Y-1, zoomScopeSize*ZFACTOR+2, zoomScopeSize*ZFACTOR+2, 0, 0, 0, 255); clearrect(zoomWindowPosition.X, zoomWindowPosition.Y, zoomScopeSize*ZFACTOR, zoomScopeSize*ZFACTOR); for (j=0; jMouseEnterCallback(this); + if(toolTip.length()>0 && GetParentWindow()) + { + GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip); + } } diff --git a/src/interface/Button.h b/src/interface/Button.h index 19f7fe7e3..2358d49a7 100644 --- a/src/interface/Button.h +++ b/src/interface/Button.h @@ -27,7 +27,7 @@ public: class Button : public Component { public: - Button(Point position = Point(0, 0), Point size = Point(0, 0), std::string buttonText = ""); + Button(Point position = Point(0, 0), Point size = Point(0, 0), std::string buttonText = "", std::string toolTip = ""); virtual ~Button(); bool Toggleable; @@ -55,6 +55,7 @@ public: void SetIcon(Icon icon); protected: + std::string toolTip; std::string buttonDisplayText; std::string ButtonText; diff --git a/src/interface/Component.cpp b/src/interface/Component.cpp index a0c55f40a..648635c53 100644 --- a/src/interface/Component.cpp +++ b/src/interface/Component.cpp @@ -79,7 +79,7 @@ void Component::TextPosition(std::string displayText) switch(Appearance.VerticalAlign) { case ui::Appearance::AlignTop: - textPosition.Y = Appearance.Margin.Top; + textPosition.Y = Appearance.Margin.Top+2; break; case ui::Appearance::AlignMiddle: textPosition.Y = Appearance.Margin.Top+((textAreaHeight-textHeight)/2); diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp index 12a469839..7d939fd64 100644 --- a/src/interface/Textbox.cpp +++ b/src/interface/Textbox.cpp @@ -8,13 +8,15 @@ using namespace ui; -Textbox::Textbox(Point position, Point size, std::string textboxText): +Textbox::Textbox(Point position, Point size, std::string textboxText, std::string textboxPlaceholder): Label(position, size, ""), actionCallback(NULL), masked(false), border(true), mouseDown(false) { + placeHolder = textboxPlaceholder; + SetText(textboxText); cursor = text.length(); } @@ -25,6 +27,11 @@ Textbox::~Textbox() delete actionCallback; } +void Textbox::SetPlaceholder(std::string text) +{ + placeHolder = text; +} + void Textbox::SetText(std::string newText) { backingText = newText; @@ -40,11 +47,11 @@ void Textbox::SetText(std::string newText) if(cursor) { - cursorPosition = Graphics::textnwidth((char *)text.c_str(), cursor); + Graphics::PositionAtCharIndex(multiline?((char*)textLines.c_str()):((char*)text.c_str()), cursor, cursorPositionX, cursorPositionY); } else { - cursorPosition = 0; + cursorPositionY = cursorPositionX = 0; } } @@ -173,25 +180,25 @@ void Textbox::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool if(cursor) { - cursorPosition = Graphics::textnwidth((char *)text.c_str(), cursor); + Graphics::PositionAtCharIndex(multiline?((char*)textLines.c_str()):((char*)text.c_str()), cursor, cursorPositionX, cursorPositionY); } else { - cursorPosition = 0; + cursorPositionY = cursorPositionX = 0; } } void Textbox::OnMouseClick(int x, int y, unsigned button) { mouseDown = true; - cursor = Graphics::CharIndexAtPosition((char*)text.c_str(), x-textPosition.X, y-textPosition.Y); + cursor = Graphics::CharIndexAtPosition(multiline?((char*)textLines.c_str()):((char*)text.c_str()), x-textPosition.X, y-textPosition.Y); if(cursor) { - cursorPosition = Graphics::textnwidth((char *)text.c_str(), cursor); + Graphics::PositionAtCharIndex(multiline?((char*)textLines.c_str()):((char*)text.c_str()), cursor, cursorPositionX, cursorPositionY); } else { - cursorPosition = 0; + cursorPositionY = cursorPositionX = 0; } Label::OnMouseClick(x, y, button); } @@ -206,14 +213,14 @@ void Textbox::OnMouseMoved(int localx, int localy, int dx, int dy) { if(mouseDown) { - cursor = Graphics::CharIndexAtPosition((char*)text.c_str(), localx-textPosition.X, localy-textPosition.Y); + cursor = Graphics::CharIndexAtPosition(multiline?((char*)textLines.c_str()):((char*)text.c_str()), localx-textPosition.X, localy-textPosition.Y); if(cursor) { - cursorPosition = Graphics::textnwidth((char *)text.c_str(), cursor); + Graphics::PositionAtCharIndex(multiline?((char*)textLines.c_str()):((char*)text.c_str()), cursor, cursorPositionX, cursorPositionY); } else { - cursorPosition = 0; + cursorPositionY = cursorPositionX = 0; } } Label::OnMouseMoved(localx, localy, dx, dy); @@ -227,10 +234,14 @@ void Textbox::Draw(const Point& screenPos) if(IsFocused()) { if(border) g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255); - g->draw_line(screenPos.X+textPosition.X+cursorPosition, screenPos.Y+3, screenPos.X+textPosition.X+cursorPosition, screenPos.Y+12, 255, 255, 255, XRES+BARSIZE); + g->draw_line(screenPos.X+textPosition.X+cursorPositionX+1, screenPos.Y-2+textPosition.Y+cursorPositionY, screenPos.X+textPosition.X+cursorPositionX+1, screenPos.Y+10+textPosition.Y+cursorPositionY, 255, 255, 255, XRES+BARSIZE); } else { + if(!text.length()) + { + g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, placeHolder, textColour.Red, textColour.Green, textColour.Blue, 170); + } if(border) g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 160, 160, 160, 255); } } diff --git a/src/interface/Textbox.h b/src/interface/Textbox.h index 120194e81..e8e9d221c 100644 --- a/src/interface/Textbox.h +++ b/src/interface/Textbox.h @@ -22,17 +22,20 @@ class Textbox : public Label protected: bool mouseDown; bool masked, border; - int cursor, cursorPosition; + int cursor, cursorPositionX, cursorPositionY; TextboxAction *actionCallback; std::string backingText; + std::string placeHolder; public: - Textbox(Point position, Point size, std::string textboxText); + Textbox(Point position, Point size, std::string textboxText = "", std::string textboxPlaceholder = ""); virtual ~Textbox(); virtual void SetDisplayText(std::string text); virtual void SetText(std::string text); virtual std::string GetText(); + virtual void SetPlaceholder(std::string text); + void SetBorder(bool border) { this->border = border; }; void SetHidden(bool hidden) { masked = hidden; } bool GetHidden() { return masked; } diff --git a/src/interface/Window.h b/src/interface/Window.h index c077abb31..c2c5e16e1 100644 --- a/src/interface/Window.h +++ b/src/interface/Window.h @@ -46,6 +46,8 @@ enum ChromeStyle // Remove a component from state. NOTE: This WILL free component from memory. void RemoveComponent(unsigned idx); + virtual void ToolTip(Component * sender, ui::Point mousePosition, std::string toolTip) {} + virtual void DoInitialized(); virtual void DoExit(); virtual void DoTick(float dt); diff --git a/src/login/LoginController.cpp b/src/login/LoginController.cpp index a44e9ea13..f27ad5995 100644 --- a/src/login/LoginController.cpp +++ b/src/login/LoginController.cpp @@ -7,6 +7,7 @@ #include "LoginController.h" #include "client/User.h" +#include "client/Client.h" LoginController::LoginController(ControllerCallback * callback): HasExited(false) @@ -40,6 +41,10 @@ void LoginController::Exit() } if(callback) callback->ControllerExit(); + else + { + Client::Ref().SetAuthUser(loginModel->GetUser()); + } HasExited = true; } diff --git a/src/preview/PreviewController.cpp b/src/preview/PreviewController.cpp index 63d37c3a7..a922bc631 100644 --- a/src/preview/PreviewController.cpp +++ b/src/preview/PreviewController.cpp @@ -12,11 +12,13 @@ #include "PreviewModel.h" #include "PreviewModelException.h" #include "dialogues/ErrorMessage.h" +#include "login/LoginController.h" #include "Controller.h" PreviewController::PreviewController(int saveID, ControllerCallback * callback): HasExited(false), - saveId(saveID) + saveId(saveID), + loginWindow(NULL) { previewModel = new PreviewModel(); previewView = new PreviewView(); @@ -25,11 +27,24 @@ PreviewController::PreviewController(int saveID, ControllerCallback * callback): previewModel->UpdateSave(saveID, 0); + if(Client::Ref().GetAuthUser().ID) + { + previewModel->SetCommentBoxEnabled(true); + } + + Client::Ref().AddListener(this); + this->callback = callback; } void PreviewController::Update() { + if(loginWindow && loginWindow->HasExited == true) + { + delete loginWindow; + loginWindow = NULL; + } + try { previewModel->Update(); @@ -45,6 +60,37 @@ void PreviewController::Update() } } +void PreviewController::SubmitComment(std::string comment) +{ + if(comment.length() < 4) + { + new ErrorMessage("Error", "Comment is too short"); + } + else + { + RequestStatus status = Client::Ref().AddComment(saveId, comment); + if(status != RequestOkay) + { + new ErrorMessage("Error Submitting comment", Client::Ref().GetLastError()); + } + else + { + previewModel->UpdateComments(1); + } + } +} + +void PreviewController::ShowLogin() +{ + loginWindow = new LoginController(); + ui::Engine::Ref().ShowWindow(loginWindow->GetView()); +} + +void PreviewController::NotifyAuthUserChanged(Client * sender) +{ + previewModel->SetCommentBoxEnabled(sender->GetAuthUser().ID); +} + SaveInfo * PreviewController::GetSave() { return previewModel->GetSave(); @@ -114,6 +160,7 @@ PreviewController::~PreviewController() { { ui::Engine::Ref().CloseWindow(); } + Client::Ref().RemoveListener(this); delete previewModel; delete previewView; if(callback) diff --git a/src/preview/PreviewController.h b/src/preview/PreviewController.h index 815ca5db8..e6b8caa84 100644 --- a/src/preview/PreviewController.h +++ b/src/preview/PreviewController.h @@ -12,26 +12,33 @@ #include "preview/PreviewView.h" #include "Controller.h" #include "client/SaveInfo.h" +#include "client/ClientListener.h" +class LoginController; class PreviewModel; class PreviewView; -class PreviewController { +class PreviewController: public ClientListener { int saveId; PreviewModel * previewModel; PreviewView * previewView; + LoginController * loginWindow; ControllerCallback * callback; public: + virtual void NotifyAuthUserChanged(Client * sender); + bool HasExited; PreviewController(int saveID, ControllerCallback * callback); void Exit(); void DoOpen(); void OpenInBrowser(); void Report(std::string message); + void ShowLogin(); bool GetDoOpen(); SaveInfo * GetSave(); PreviewView * GetView() { return previewView; } void Update(); void FavouriteSave(); + void SubmitComment(std::string comment); void NextCommentPage(); void PrevCommentPage(); diff --git a/src/preview/PreviewModel.cpp b/src/preview/PreviewModel.cpp index f62e3f5c6..59c1c0b9a 100644 --- a/src/preview/PreviewModel.cpp +++ b/src/preview/PreviewModel.cpp @@ -21,7 +21,8 @@ PreviewModel::PreviewModel(): updateSaveCommentsWorking(false), updateSaveCommentsFinished(false), commentsTotal(0), - commentsPageNumber(1) + commentsPageNumber(1), + commentBoxEnabled(false) { // TODO Auto-generated constructor stub @@ -77,6 +78,20 @@ void PreviewModel::SetFavourite(bool favourite) } } +bool PreviewModel::GetCommentBoxEnabled() +{ + return commentBoxEnabled; +} + +void PreviewModel::SetCommentBoxEnabled(bool enabledState) +{ + if(enabledState != commentBoxEnabled) + { + commentBoxEnabled = enabledState; + notifyCommentBoxEnabledChanged(); + } +} + void PreviewModel::UpdateSave(int saveID, int saveDate) { this->tSaveID = saveID; @@ -189,6 +204,14 @@ void PreviewModel::notifySaveChanged() } } +void PreviewModel::notifyCommentBoxEnabledChanged() +{ + for(int i = 0; i < observers.size(); i++) + { + observers[i]->NotifyCommentBoxEnabledChanged(this); + } +} + void PreviewModel::notifyCommentsPageChanged() { for(int i = 0; i < observers.size(); i++) @@ -210,6 +233,7 @@ void PreviewModel::AddObserver(PreviewView * observer) { observer->NotifySaveChanged(this); observer->NotifyCommentsChanged(this); observer->NotifyCommentsPageChanged(this); + observer->NotifyCommentBoxEnabledChanged(this); } void PreviewModel::Update() diff --git a/src/preview/PreviewModel.h b/src/preview/PreviewModel.h index f00a4182b..11618a041 100644 --- a/src/preview/PreviewModel.h +++ b/src/preview/PreviewModel.h @@ -27,6 +27,7 @@ struct SaveData class PreviewView; class PreviewModel { bool doOpen; + bool commentBoxEnabled; vector observers; SaveInfo * save; vector saveDataBuffer; @@ -34,6 +35,7 @@ class PreviewModel { void notifySaveChanged(); void notifySaveCommentsChanged(); void notifyCommentsPageChanged(); + void notifyCommentBoxEnabledChanged(); //Background retrieval int tSaveID; @@ -66,6 +68,9 @@ public: SaveInfo * GetSave(); std::vector * GetComments(); + bool GetCommentBoxEnabled(); + void SetCommentBoxEnabled(bool enabledState); + bool GetCommentsLoaded(); int GetCommentsPageNum(); int GetCommentsPageCount(); diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp index b6b2e02b1..79d2cddf3 100644 --- a/src/preview/PreviewView.cpp +++ b/src/preview/PreviewView.cpp @@ -13,9 +13,42 @@ #include "simulation/SaveRenderer.h" #include "interface/Point.h" #include "interface/Window.h" +#include "interface/Textbox.h" #include "Style.h" #include "search/Thumbnail.h" +class PreviewView::LoginAction: public ui::ButtonAction +{ + PreviewView * v; +public: + LoginAction(PreviewView * v_){ v = v_; } + virtual void ActionCallback(ui::Button * sender) + { + v->c->ShowLogin(); + } +}; + +class PreviewView::SubmitCommentAction: public ui::ButtonAction +{ + PreviewView * v; +public: + SubmitCommentAction(PreviewView * v_){ v = v_; } + virtual void ActionCallback(ui::Button * sender) + { + v->submitComment(); + } +}; + +class PreviewView::AutoCommentSizeAction: public ui::TextboxAction +{ + PreviewView * v; +public: + AutoCommentSizeAction(PreviewView * v): v(v) {} + virtual void TextChangedCallback(ui::Textbox * sender) { + v->commentBoxAutoHeight(); + } +}; + PreviewView::PreviewView(): ui::Window(ui::Point(-1, -1), ui::Point((XRES/2)+200, (YRES/2)+150)), savePreview(NULL), @@ -24,7 +57,10 @@ PreviewView::PreviewView(): commentsVel(0), maxOffset(0), commentsBegin(true), - commentsEnd(false) + commentsEnd(false), + addCommentBox(NULL), + submitCommentButton(NULL), + commentBoxHeight(20) { class OpenAction: public ui::ButtonAction { @@ -118,11 +154,42 @@ PreviewView::PreviewView(): authorDateLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; authorDateLabel->Appearance.VerticalAlign = ui::Appearance::AlignBottom; AddComponent(authorDateLabel); - pageInfo = new ui::Label(ui::Point((XRES/2) + 5, Size.Y-15), ui::Point(Size.X-((XRES/2) + 10), 15), "Page 1 of 1"); + pageInfo = new ui::Label(ui::Point((XRES/2) + 5, Size.Y+1), ui::Point(Size.X-((XRES/2) + 10), 15), "Page 1 of 1"); pageInfo->Appearance.HorizontalAlign = ui::Appearance::AlignCentre; authorDateLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; + AddComponent(pageInfo); } +void PreviewView::commentBoxAutoHeight() +{ + if(!addCommentBox) + return; + int textWidth = Graphics::textwidth(addCommentBox->GetText().c_str()); + if(textWidth+5 > Size.X-(XRES/2)-48) + { + commentBoxHeight = 58; + addCommentBox->SetMultiline(true); + addCommentBox->Appearance.VerticalAlign = ui::Appearance::AlignTop; + + commentBoxPositionX = (XRES/2)+4; + commentBoxPositionY = Size.Y-58; + commentBoxSizeX = Size.X-(XRES/2)-8; + commentBoxSizeY = 37; + } + else + { + commentBoxHeight = 20; + addCommentBox->SetMultiline(false); + addCommentBox->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; + + commentBoxPositionX = (XRES/2)+4; + commentBoxPositionY = Size.Y-19; + commentBoxSizeX = Size.X-(XRES/2)-48; + commentBoxSizeY = 17; + } + displayComments(commentsOffset); +} + void PreviewView::DoDraw() { Window::DoDraw(); @@ -149,7 +216,7 @@ void PreviewView::OnDraw() g->draw_image(savePreview->Data, (Position.X+1)+(((XRES/2)-savePreview->Size.X)/2), (Position.Y+1)+(((YRES/2)-savePreview->Size.Y)/2), savePreview->Size.X, savePreview->Size.Y, 255); } g->drawrect(Position.X, Position.Y, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 100); - g->draw_line(Position.X+XRES/2, Position.Y+1, Position.X+XRES/2, Position.Y+Size.Y-2, 200, 200, 200, 255); + g->draw_line(Position.X+1+XRES/2, Position.Y+1, Position.X+XRES/2, Position.Y+Size.Y-2, 200, 200, 200, 255); g->draw_line(Position.X+1, Position.Y+12+YRES/2, Position.X-1+XRES/2, Position.Y+12+YRES/2, 100, 100, 100,255); @@ -213,6 +280,42 @@ void PreviewView::OnTick(float dt) displayComments(commentsOffset); } + if(addCommentBox) + { + ui::Point positionDiff = ui::Point(commentBoxPositionX, commentBoxPositionY)-addCommentBox->Position; + ui::Point sizeDiff = ui::Point(commentBoxSizeX, commentBoxSizeY)-addCommentBox->Size; + + if(positionDiff.X!=0) + { + int xdiff = positionDiff.X/5; + if(xdiff == 0) + xdiff = 1*isign(positionDiff.X); + addCommentBox->Position.X += xdiff; + } + if(positionDiff.Y!=0) + { + int ydiff = positionDiff.Y/5; + if(ydiff == 0) + ydiff = 1*isign(positionDiff.Y); + addCommentBox->Position.Y += ydiff; + } + + if(sizeDiff.X!=0) + { + int xdiff = sizeDiff.X/5; + if(xdiff == 0) + xdiff = 1*isign(sizeDiff.X); + addCommentBox->Size.X += xdiff; + } + if(sizeDiff.Y!=0) + { + int ydiff = sizeDiff.Y/5; + if(ydiff == 0) + ydiff = 1*isign(sizeDiff.Y); + addCommentBox->Size.Y += ydiff; + } + } + c->Update(); } @@ -269,6 +372,23 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender) } } +void PreviewView::submitComment() +{ + if(addCommentBox) + { + std::string comment = std::string(addCommentBox->GetText()); + submitCommentButton->Enabled = false; + addCommentBox->SetText(""); + addCommentBox->SetPlaceholder("Submitting comment"); + FocusComponent(NULL); + + c->SubmitComment(comment); + + addCommentBox->SetPlaceholder("Add comment"); + submitCommentButton->Enabled = true; + } +} + void PreviewView::displayComments(int yOffset) { for(int i = 0; i < commentComponents.size(); i++) @@ -289,10 +409,10 @@ void PreviewView::displayComments(int yOffset) tempUsername->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; tempUsername->Appearance.VerticalAlign = ui::Appearance::AlignBottom; currentY += 16; - if(currentY > Size.Y || usernameY < 0) + if(currentY+5 > Size.Y-commentBoxHeight || usernameY < 0) { delete tempUsername; - if(currentY > Size.Y) + if(currentY+5 > Size.Y-commentBoxHeight) break; } else @@ -308,10 +428,10 @@ void PreviewView::displayComments(int yOffset) tempComment->SetTextColour(ui::Colour(180, 180, 180)); currentY += tempComment->Size.Y+4; - if(currentY > Size.Y || commentY < 0) + if(currentY+5 > Size.Y-commentBoxHeight || commentY < 0) { delete tempComment; - if(currentY > Size.Y) + if(currentY+5 > Size.Y-commentBoxHeight) break; } else @@ -323,6 +443,44 @@ void PreviewView::displayComments(int yOffset) } } +void PreviewView::NotifyCommentBoxEnabledChanged(PreviewModel * sender) +{ + if(addCommentBox) + { + RemoveComponent(addCommentBox); + addCommentBox = NULL; + delete addCommentBox; + } + if(submitCommentButton) + { + RemoveComponent(submitCommentButton); + submitCommentButton = NULL; + delete submitCommentButton; + } + if(sender->GetCommentBoxEnabled()) + { + commentBoxPositionX = (XRES/2)+4; + commentBoxPositionY = Size.Y-19; + commentBoxSizeX = Size.X-(XRES/2)-48; + commentBoxSizeY = 17; + + addCommentBox = new ui::Textbox(ui::Point((XRES/2)+4, Size.Y-19), ui::Point(Size.X-(XRES/2)-48, 17), "", "Add Comment"); + addCommentBox->SetActionCallback(new AutoCommentSizeAction(this)); + addCommentBox->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; + AddComponent(addCommentBox); + submitCommentButton = new ui::Button(ui::Point(Size.X-40, Size.Y-19), ui::Point(40, 19), "Submit"); + submitCommentButton->SetActionCallback(new SubmitCommentAction(this)); + //submitCommentButton->Enabled = false; + AddComponent(submitCommentButton); + } + else + { + submitCommentButton = new ui::Button(ui::Point(XRES/2, Size.Y-19), ui::Point(Size.X-(XRES/2), 19), "Login to comment"); + submitCommentButton->SetActionCallback(new LoginAction(this)); + AddComponent(submitCommentButton); + } +} + void PreviewView::NotifyCommentsPageChanged(PreviewModel * sender) { std::stringstream pageInfoStream; @@ -361,7 +519,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender) } - maxOffset = (maxY-Size.Y)+16; + maxOffset = (maxY-(Size.Y-commentBoxHeight))+16; commentsBegin = true; commentsEnd = false; commentsOffset = 0; diff --git a/src/preview/PreviewView.h b/src/preview/PreviewView.h index fbc2adce3..2e94b85fc 100644 --- a/src/preview/PreviewView.h +++ b/src/preview/PreviewView.h @@ -16,16 +16,22 @@ #include "interface/Button.h" #include "search/Thumbnail.h" #include "interface/Label.h" +#include "interface/Textbox.h" class PreviewModel; class PreviewController; class PreviewView: public ui::Window { + class SubmitCommentAction; + class LoginAction; + class AutoCommentSizeAction; PreviewController * c; Thumbnail * savePreview; ui::Button * openButton; ui::Button * browserOpenButton; ui::Button * favButton; ui::Button * reportButton; + ui::Button * submitCommentButton; + ui::Textbox * addCommentBox; ui::Label * saveNameLabel; ui::Label * authorDateLabel; ui::Label * pageInfo; @@ -43,13 +49,22 @@ class PreviewView: public ui::Window { float commentsOffset; float commentsVel; + int commentBoxHeight; + float commentBoxPositionX; + float commentBoxPositionY; + float commentBoxSizeX; + float commentBoxSizeY; + void displayComments(int yOffset); + void commentBoxAutoHeight(); + void submitComment(); public: void AttachController(PreviewController * controller) { c = controller;} PreviewView(); void NotifySaveChanged(PreviewModel * sender); void NotifyCommentsChanged(PreviewModel * sender); void NotifyCommentsPageChanged(PreviewModel * sender); + void NotifyCommentBoxEnabledChanged(PreviewModel * sender); virtual void OnDraw(); virtual void DoDraw(); virtual void OnTick(float dt); diff --git a/src/render/RenderView.cpp b/src/render/RenderView.cpp index 7bf5bf2d7..4f79d4cb3 100644 --- a/src/render/RenderView.cpp +++ b/src/render/RenderView.cpp @@ -240,13 +240,8 @@ void RenderView::OnDraw() if(ren) { ren->clearScreen(1.0f); - ren->draw_air(); - ren->render_parts(); - ren->render_fire(); - ren->draw_grav(); - ren->DrawWalls(); - ren->DrawSigns(); - ren->FinaliseParts(); + ren->RenderBegin(); + ren->RenderEnd(); } g->draw_line(0, YRES, XRES-1, YRES, 255, 255, 255, XRES+BARSIZE); g->draw_line(180, YRES, 180, YRES+MENUSIZE, 200, 200, 200, XRES+BARSIZE); diff --git a/src/simulation/SaveRenderer.cpp b/src/simulation/SaveRenderer.cpp index 73b486e0a..f3b419fc4 100644 --- a/src/simulation/SaveRenderer.cpp +++ b/src/simulation/SaveRenderer.cpp @@ -55,9 +55,12 @@ Thumbnail * SaveRenderer::Render(GameSave * save) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); + ren->clearScreen(1.0f); - ren->render_parts(); - ren->FinaliseParts(); + ren->ClearAccumulation(); + ren->RenderBegin(); + ren->RenderEnd(); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glTranslated(0, -MENUSIZE, 0); @@ -90,8 +93,10 @@ Thumbnail * SaveRenderer::Render(GameSave * save) pixel * pData = NULL; pixel * dst; pixel * src = g->vid; - ren->render_parts(); - ren->FinaliseParts(); + + ren->ClearAccumulation(); + ren->RenderBegin(); + ren->RenderEnd(); pData = (pixel *)malloc(PIXELSIZE * ((width*CELL)*(height*CELL))); dst = pData; diff --git a/src/simulation/elements/116.cpp b/src/simulation/elements/116.cpp index 9b939ffcd..9697c9705 100644 --- a/src/simulation/elements/116.cpp +++ b/src/simulation/elements/116.cpp @@ -43,7 +43,7 @@ Element_116::Element_116() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_116::~Element_116() {} \ No newline at end of file diff --git a/src/simulation/elements/146.cpp b/src/simulation/elements/146.cpp index 8afb8e45b..51f4d3b3d 100644 --- a/src/simulation/elements/146.cpp +++ b/src/simulation/elements/146.cpp @@ -43,7 +43,7 @@ Element_146::Element_146() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_146::~Element_146() {} \ No newline at end of file diff --git a/src/simulation/elements/147.cpp b/src/simulation/elements/147.cpp index 868c766e6..902db2d72 100644 --- a/src/simulation/elements/147.cpp +++ b/src/simulation/elements/147.cpp @@ -43,7 +43,7 @@ Element_147::Element_147() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_147::~Element_147() {} \ No newline at end of file diff --git a/src/simulation/elements/AMTR.cpp b/src/simulation/elements/AMTR.cpp index a93d1cd17..ff25bb62a 100644 --- a/src/simulation/elements/AMTR.cpp +++ b/src/simulation/elements/AMTR.cpp @@ -43,7 +43,7 @@ Element_AMTR::Element_AMTR() HighTemperatureTransition = NT; Update = &Element_AMTR::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_AMTR static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/ANAR.cpp b/src/simulation/elements/ANAR.cpp index c35c58cf0..f8bcd499a 100644 --- a/src/simulation/elements/ANAR.cpp +++ b/src/simulation/elements/ANAR.cpp @@ -43,7 +43,7 @@ Element_ANAR::Element_ANAR() HighTemperatureTransition = NT; Update = &Element_ANAR::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_ANAR static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/ARAY.cpp b/src/simulation/elements/ARAY.cpp index c455f072e..29d3b9593 100644 --- a/src/simulation/elements/ARAY.cpp +++ b/src/simulation/elements/ARAY.cpp @@ -43,7 +43,7 @@ Element_ARAY::Element_ARAY() HighTemperatureTransition = NT; Update = &Element_ARAY::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_ARAY static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/BANG.cpp b/src/simulation/elements/BANG.cpp index 264b4f1ea..d2441caa3 100644 --- a/src/simulation/elements/BANG.cpp +++ b/src/simulation/elements/BANG.cpp @@ -43,7 +43,7 @@ Element_BANG::Element_BANG() HighTemperatureTransition = NT; Update = &Element_BANG::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_BANG static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/BCLN.cpp b/src/simulation/elements/BCLN.cpp index 281ecb24e..0e93011a2 100644 --- a/src/simulation/elements/BCLN.cpp +++ b/src/simulation/elements/BCLN.cpp @@ -43,7 +43,7 @@ Element_BCLN::Element_BCLN() HighTemperatureTransition = NT; Update = &Element_BCLN::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_BCLN static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/BGLA.cpp b/src/simulation/elements/BGLA.cpp index 756842a92..e85b95d9a 100644 --- a/src/simulation/elements/BGLA.cpp +++ b/src/simulation/elements/BGLA.cpp @@ -43,7 +43,7 @@ Element_BGLA::Element_BGLA() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_BGLA::~Element_BGLA() {} \ No newline at end of file diff --git a/src/simulation/elements/BHOL.cpp b/src/simulation/elements/BHOL.cpp index 7a119855d..35eda8c60 100644 --- a/src/simulation/elements/BHOL.cpp +++ b/src/simulation/elements/BHOL.cpp @@ -43,7 +43,7 @@ Element_BHOL::Element_BHOL() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_BHOL::~Element_BHOL() {} \ No newline at end of file diff --git a/src/simulation/elements/BMTL.cpp b/src/simulation/elements/BMTL.cpp index 66a9af2e2..adc5289bc 100644 --- a/src/simulation/elements/BMTL.cpp +++ b/src/simulation/elements/BMTL.cpp @@ -43,7 +43,7 @@ Element_BMTL::Element_BMTL() HighTemperatureTransition = PT_LAVA; Update = &Element_BMTL::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_BMTL static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/BOYL.cpp b/src/simulation/elements/BOYL.cpp index 3fd36c960..18ebee814 100644 --- a/src/simulation/elements/BOYL.cpp +++ b/src/simulation/elements/BOYL.cpp @@ -43,7 +43,7 @@ Element_BOYL::Element_BOYL() HighTemperatureTransition = NT; Update = &Element_BOYL::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_BOYL static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/BRCK.cpp b/src/simulation/elements/BRCK.cpp index 0a1bba7ee..b7304189f 100644 --- a/src/simulation/elements/BRCK.cpp +++ b/src/simulation/elements/BRCK.cpp @@ -43,7 +43,7 @@ Element_BRCK::Element_BRCK() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_BRCK::~Element_BRCK() {} \ No newline at end of file diff --git a/src/simulation/elements/BREC.cpp b/src/simulation/elements/BREC.cpp index 807d650c7..e260a7cf4 100644 --- a/src/simulation/elements/BREC.cpp +++ b/src/simulation/elements/BREC.cpp @@ -43,7 +43,7 @@ Element_BREC::Element_BREC() HighTemperatureTransition = NT; Update = &Element_BREC::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_BREC static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/BRMT.cpp b/src/simulation/elements/BRMT.cpp index 11773e223..55eb24377 100644 --- a/src/simulation/elements/BRMT.cpp +++ b/src/simulation/elements/BRMT.cpp @@ -43,7 +43,7 @@ Element_BRMT::Element_BRMT() HighTemperatureTransition = PT_LAVA; Update = &Element_BRMT::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_BRMT static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/BTRY.cpp b/src/simulation/elements/BTRY.cpp index 6aa00ecbf..42c8e5388 100644 --- a/src/simulation/elements/BTRY.cpp +++ b/src/simulation/elements/BTRY.cpp @@ -43,7 +43,7 @@ Element_BTRY::Element_BTRY() HighTemperatureTransition = PT_PLSM; Update = &Element_BTRY::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_BTRY static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/C5.cpp b/src/simulation/elements/C5.cpp index 8524f9bd0..e7d8f22bb 100644 --- a/src/simulation/elements/C5.cpp +++ b/src/simulation/elements/C5.cpp @@ -43,7 +43,7 @@ Element_C5::Element_C5() HighTemperatureTransition = NT; Update = &Element_C5::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_C5 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/CAUS.cpp b/src/simulation/elements/CAUS.cpp index b336f9ef9..a8fc0da8e 100644 --- a/src/simulation/elements/CAUS.cpp +++ b/src/simulation/elements/CAUS.cpp @@ -43,7 +43,7 @@ Element_CAUS::Element_CAUS() HighTemperatureTransition = NT; Update = &Element_CAUS::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_CAUS static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/CLNE.cpp b/src/simulation/elements/CLNE.cpp index 939feb0f8..f76ed7541 100644 --- a/src/simulation/elements/CLNE.cpp +++ b/src/simulation/elements/CLNE.cpp @@ -43,7 +43,7 @@ Element_CLNE::Element_CLNE() HighTemperatureTransition = NT; Update = &Element_CLNE::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_CLNE static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/CNCT.cpp b/src/simulation/elements/CNCT.cpp index 3ef01369f..77f70be97 100644 --- a/src/simulation/elements/CNCT.cpp +++ b/src/simulation/elements/CNCT.cpp @@ -43,7 +43,7 @@ Element_CNCT::Element_CNCT() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_CNCT::~Element_CNCT() {} \ No newline at end of file diff --git a/src/simulation/elements/CO2.cpp b/src/simulation/elements/CO2.cpp index 3e1f4d97c..e17093835 100644 --- a/src/simulation/elements/CO2.cpp +++ b/src/simulation/elements/CO2.cpp @@ -43,7 +43,7 @@ Element_CO2::Element_CO2() HighTemperatureTransition = NT; Update = &Element_CO2::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_CO2 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/CONV.cpp b/src/simulation/elements/CONV.cpp index 82e0594b0..4ee4682fd 100644 --- a/src/simulation/elements/CONV.cpp +++ b/src/simulation/elements/CONV.cpp @@ -43,7 +43,7 @@ Element_CONV::Element_CONV() HighTemperatureTransition = NT; Update = &Element_CONV::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_CONV static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/DESL.cpp b/src/simulation/elements/DESL.cpp index 6401b3cf5..a79086d0f 100644 --- a/src/simulation/elements/DESL.cpp +++ b/src/simulation/elements/DESL.cpp @@ -43,7 +43,7 @@ Element_DESL::Element_DESL() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_DESL::~Element_DESL() {} \ No newline at end of file diff --git a/src/simulation/elements/DMND.cpp b/src/simulation/elements/DMND.cpp index fe158f865..3c6d24ab8 100644 --- a/src/simulation/elements/DMND.cpp +++ b/src/simulation/elements/DMND.cpp @@ -43,7 +43,7 @@ Element_DMND::Element_DMND() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_DMND::~Element_DMND() {} \ No newline at end of file diff --git a/src/simulation/elements/DRIC.cpp b/src/simulation/elements/DRIC.cpp index 7112bbc69..ea2a3c8f3 100644 --- a/src/simulation/elements/DRIC.cpp +++ b/src/simulation/elements/DRIC.cpp @@ -43,7 +43,7 @@ Element_DRIC::Element_DRIC() HighTemperatureTransition = PT_CO2; Update = NULL; - Graphics = NULL; + } Element_DRIC::~Element_DRIC() {} \ No newline at end of file diff --git a/src/simulation/elements/DSTW.cpp b/src/simulation/elements/DSTW.cpp index c04bf5bfb..c2197869f 100644 --- a/src/simulation/elements/DSTW.cpp +++ b/src/simulation/elements/DSTW.cpp @@ -43,7 +43,7 @@ Element_DSTW::Element_DSTW() HighTemperatureTransition = PT_WTRV; Update = &Element_DSTW::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_DSTW static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/DYST.cpp b/src/simulation/elements/DYST.cpp index 5db167fa9..fdf16bb90 100644 --- a/src/simulation/elements/DYST.cpp +++ b/src/simulation/elements/DYST.cpp @@ -43,7 +43,7 @@ Element_DYST::Element_DYST() HighTemperatureTransition = PT_DUST; Update = NULL; - Graphics = NULL; + } Element_DYST::~Element_DYST() {} \ No newline at end of file diff --git a/src/simulation/elements/ETRD.cpp b/src/simulation/elements/ETRD.cpp index b3eacfb3f..39b658142 100644 --- a/src/simulation/elements/ETRD.cpp +++ b/src/simulation/elements/ETRD.cpp @@ -43,7 +43,7 @@ Element_ETRD::Element_ETRD() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_ETRD::~Element_ETRD() {} \ No newline at end of file diff --git a/src/simulation/elements/FOG.cpp b/src/simulation/elements/FOG.cpp index ca2beb4ef..9cfbe62f0 100644 --- a/src/simulation/elements/FOG.cpp +++ b/src/simulation/elements/FOG.cpp @@ -43,7 +43,7 @@ Element_FOG::Element_FOG() HighTemperatureTransition = PT_WTRV; Update = &Element_FOG::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_FOG static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/FRAY.cpp b/src/simulation/elements/FRAY.cpp index b81db073d..6e85783be 100644 --- a/src/simulation/elements/FRAY.cpp +++ b/src/simulation/elements/FRAY.cpp @@ -43,7 +43,7 @@ Element_FRAY::Element_FRAY() HighTemperatureTransition = NT; Update = &Element_FRAY::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_FRAY static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/FRZW.cpp b/src/simulation/elements/FRZW.cpp index 5c124b44f..8ba954a14 100644 --- a/src/simulation/elements/FRZW.cpp +++ b/src/simulation/elements/FRZW.cpp @@ -43,7 +43,7 @@ Element_FRZW::Element_FRZW() HighTemperatureTransition = PT_ICEI; Update = &Element_FRZW::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_FRZW static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/FRZZ.cpp b/src/simulation/elements/FRZZ.cpp index 14d2f1a6f..816267286 100644 --- a/src/simulation/elements/FRZZ.cpp +++ b/src/simulation/elements/FRZZ.cpp @@ -43,7 +43,7 @@ Element_FRZZ::Element_FRZZ() HighTemperatureTransition = NT; Update = &Element_FRZZ::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_FRZZ static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/FSEP.cpp b/src/simulation/elements/FSEP.cpp index 80b10f4f5..52e4a6713 100644 --- a/src/simulation/elements/FSEP.cpp +++ b/src/simulation/elements/FSEP.cpp @@ -43,7 +43,7 @@ Element_FSEP::Element_FSEP() HighTemperatureTransition = NT; Update = &Element_FSEP::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_FSEP static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/FUSE.cpp b/src/simulation/elements/FUSE.cpp index e066afa05..946e86b72 100644 --- a/src/simulation/elements/FUSE.cpp +++ b/src/simulation/elements/FUSE.cpp @@ -43,7 +43,7 @@ Element_FUSE::Element_FUSE() HighTemperatureTransition = NT; Update = &Element_FUSE::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_FUSE static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/FWRK.cpp b/src/simulation/elements/FWRK.cpp index 6876447f0..66109f5ab 100644 --- a/src/simulation/elements/FWRK.cpp +++ b/src/simulation/elements/FWRK.cpp @@ -43,7 +43,7 @@ Element_FWRK::Element_FWRK() HighTemperatureTransition = NT; Update = &Element_FWRK::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_FWRK static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/GAS.cpp b/src/simulation/elements/GAS.cpp index 3c406a9d4..4e87b7625 100644 --- a/src/simulation/elements/GAS.cpp +++ b/src/simulation/elements/GAS.cpp @@ -43,7 +43,7 @@ Element_GAS::Element_GAS() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_GAS::~Element_GAS() {} \ No newline at end of file diff --git a/src/simulation/elements/GLAS.cpp b/src/simulation/elements/GLAS.cpp index 58fc55dce..b752a0bd7 100644 --- a/src/simulation/elements/GLAS.cpp +++ b/src/simulation/elements/GLAS.cpp @@ -43,7 +43,7 @@ Element_GLAS::Element_GLAS() HighTemperatureTransition = PT_LAVA; Update = &Element_GLAS::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_GLAS static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/GOO.cpp b/src/simulation/elements/GOO.cpp index c0ea21be6..3dcef314e 100644 --- a/src/simulation/elements/GOO.cpp +++ b/src/simulation/elements/GOO.cpp @@ -43,7 +43,7 @@ Element_GOO::Element_GOO() HighTemperatureTransition = NT; Update = &Element_GOO::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_GOO static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/GUNP.cpp b/src/simulation/elements/GUNP.cpp index fd5334c7f..798e0f714 100644 --- a/src/simulation/elements/GUNP.cpp +++ b/src/simulation/elements/GUNP.cpp @@ -43,7 +43,7 @@ Element_GUNP::Element_GUNP() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_GUNP::~Element_GUNP() {} \ No newline at end of file diff --git a/src/simulation/elements/H2.cpp b/src/simulation/elements/H2.cpp index 1e84502f2..8d5bf0d68 100644 --- a/src/simulation/elements/H2.cpp +++ b/src/simulation/elements/H2.cpp @@ -43,7 +43,7 @@ Element_H2::Element_H2() HighTemperatureTransition = NT; Update = &Element_H2::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_H2 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/ICEI.cpp b/src/simulation/elements/ICEI.cpp index 7352d6083..852b646a6 100644 --- a/src/simulation/elements/ICEI.cpp +++ b/src/simulation/elements/ICEI.cpp @@ -43,7 +43,7 @@ Element_ICEI::Element_ICEI() HighTemperatureTransition = ST; Update = &Element_ICEI::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_ICEI static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/IGNT.cpp b/src/simulation/elements/IGNT.cpp index 8e2af19e6..206b92b68 100644 --- a/src/simulation/elements/IGNT.cpp +++ b/src/simulation/elements/IGNT.cpp @@ -43,7 +43,7 @@ Element_IGNT::Element_IGNT() HighTemperatureTransition = PT_FIRE; Update = &Element_IGNT::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_IGNT static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/INSL.cpp b/src/simulation/elements/INSL.cpp index a7d1ce110..868577556 100644 --- a/src/simulation/elements/INSL.cpp +++ b/src/simulation/elements/INSL.cpp @@ -43,7 +43,7 @@ Element_INSL::Element_INSL() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_INSL::~Element_INSL() {} \ No newline at end of file diff --git a/src/simulation/elements/INST.cpp b/src/simulation/elements/INST.cpp index 78990ef00..a8a8d3e84 100644 --- a/src/simulation/elements/INST.cpp +++ b/src/simulation/elements/INST.cpp @@ -43,7 +43,7 @@ Element_INST::Element_INST() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_INST::~Element_INST() {} \ No newline at end of file diff --git a/src/simulation/elements/INWR.cpp b/src/simulation/elements/INWR.cpp index 0368f06ee..35d57ec10 100644 --- a/src/simulation/elements/INWR.cpp +++ b/src/simulation/elements/INWR.cpp @@ -43,7 +43,7 @@ Element_INWR::Element_INWR() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_INWR::~Element_INWR() {} \ No newline at end of file diff --git a/src/simulation/elements/IRON.cpp b/src/simulation/elements/IRON.cpp index a447a299c..1542da9e2 100644 --- a/src/simulation/elements/IRON.cpp +++ b/src/simulation/elements/IRON.cpp @@ -43,7 +43,7 @@ Element_IRON::Element_IRON() HighTemperatureTransition = PT_LAVA; Update = &Element_IRON::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_IRON static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/ISOZ.cpp b/src/simulation/elements/ISOZ.cpp index f98cb2548..05df48918 100644 --- a/src/simulation/elements/ISOZ.cpp +++ b/src/simulation/elements/ISOZ.cpp @@ -43,7 +43,7 @@ Element_ISOZ::Element_ISOZ() HighTemperatureTransition = NT; Update = &Element_ISOZ::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_ISOZ static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/ISZS.cpp b/src/simulation/elements/ISZS.cpp index 650ef1b82..b12f34ce5 100644 --- a/src/simulation/elements/ISZS.cpp +++ b/src/simulation/elements/ISZS.cpp @@ -43,7 +43,7 @@ Element_ISZS::Element_ISZS() HighTemperatureTransition = PT_ISOZ; Update = &Element_ISZS::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_ISZS static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/LIFE.cpp b/src/simulation/elements/LIFE.cpp index 84cec6720..420793111 100644 --- a/src/simulation/elements/LIFE.cpp +++ b/src/simulation/elements/LIFE.cpp @@ -1,4 +1,8 @@ #include "simulation/Elements.h" + +bool Element_GOL_colourInit = false; +pixel Element_GOL_colour[NGOL]; + //#TPT-Directive ElementClass Element_LIFE PT_LIFE 78 Element_LIFE::Element_LIFE() { @@ -44,8 +48,23 @@ Element_LIFE::Element_LIFE() Update = NULL; Graphics = &Element_LIFE::graphics; + + if(!Element_GOL_colourInit) + { + Element_GOL_colourInit = true; + + + int golMenuCount; + gol_menu * golMenuT = LoadGOLMenu(golMenuCount); + for(int i = 0; i < golMenuCount && i < NGOL; i++) + { + Element_GOL_colour[i] = golMenuT[i].colour; + } + free(golMenuT); + } } + //#TPT-Directive ElementHeader Element_LIFE static int graphics(GRAPHICS_FUNC_ARGS) int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS) @@ -94,7 +113,7 @@ int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS) else pc = PIXRGB(255, 255, 0); } else { - pc = PIXRGB(255, 255, 0);//sim->gmenu[cpart->ctype].colour; + pc = Element_GOL_colour[cpart->ctype]; } *colr = PIXR(pc); *colg = PIXG(pc); diff --git a/src/simulation/elements/LNTG.cpp b/src/simulation/elements/LNTG.cpp index ce776c801..ac9719136 100644 --- a/src/simulation/elements/LNTG.cpp +++ b/src/simulation/elements/LNTG.cpp @@ -43,7 +43,7 @@ Element_LNTG::Element_LNTG() HighTemperatureTransition = PT_NONE; Update = NULL; - Graphics = NULL; + } Element_LNTG::~Element_LNTG() {} \ No newline at end of file diff --git a/src/simulation/elements/LO2.cpp b/src/simulation/elements/LO2.cpp index cc0c55757..e032b9ea5 100644 --- a/src/simulation/elements/LO2.cpp +++ b/src/simulation/elements/LO2.cpp @@ -43,7 +43,7 @@ Element_LO2::Element_LO2() HighTemperatureTransition = PT_O2; Update = NULL; - Graphics = NULL; + } Element_LO2::~Element_LO2() {} \ No newline at end of file diff --git a/src/simulation/elements/LOLZ.cpp b/src/simulation/elements/LOLZ.cpp index 14c575771..6feae3f8c 100644 --- a/src/simulation/elements/LOLZ.cpp +++ b/src/simulation/elements/LOLZ.cpp @@ -43,7 +43,7 @@ Element_LOLZ::Element_LOLZ() HighTemperatureTransition = NT; Update = &Element_LOLZ::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_LOLZ static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/LOVE.cpp b/src/simulation/elements/LOVE.cpp index 977633603..28a20b7f5 100644 --- a/src/simulation/elements/LOVE.cpp +++ b/src/simulation/elements/LOVE.cpp @@ -43,7 +43,7 @@ Element_LOVE::Element_LOVE() HighTemperatureTransition = NT; Update = &Element_LOVE::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_LOVE static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/LRBD.cpp b/src/simulation/elements/LRBD.cpp index 445541fe4..f609cce59 100644 --- a/src/simulation/elements/LRBD.cpp +++ b/src/simulation/elements/LRBD.cpp @@ -43,7 +43,7 @@ Element_LRBD::Element_LRBD() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_LRBD::~Element_LRBD() {} \ No newline at end of file diff --git a/src/simulation/elements/MERC.cpp b/src/simulation/elements/MERC.cpp index 9e7ee3856..1fec32a99 100644 --- a/src/simulation/elements/MERC.cpp +++ b/src/simulation/elements/MERC.cpp @@ -43,7 +43,7 @@ Element_MERC::Element_MERC() HighTemperatureTransition = NT; Update = &Element_MERC::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_MERC static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/METL.cpp b/src/simulation/elements/METL.cpp index a0137089e..17b09d017 100644 --- a/src/simulation/elements/METL.cpp +++ b/src/simulation/elements/METL.cpp @@ -43,7 +43,7 @@ Element_METL::Element_METL() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_METL::~Element_METL() {} \ No newline at end of file diff --git a/src/simulation/elements/MORT.cpp b/src/simulation/elements/MORT.cpp index 3acaf0ce9..f8f1d8c02 100644 --- a/src/simulation/elements/MORT.cpp +++ b/src/simulation/elements/MORT.cpp @@ -43,7 +43,7 @@ Element_MORT::Element_MORT() HighTemperatureTransition = NT; Update = &Element_MORT::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_MORT static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/MWAX.cpp b/src/simulation/elements/MWAX.cpp index d9428eba9..4153893bb 100644 --- a/src/simulation/elements/MWAX.cpp +++ b/src/simulation/elements/MWAX.cpp @@ -43,7 +43,7 @@ Element_MWAX::Element_MWAX() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_MWAX::~Element_MWAX() {} \ No newline at end of file diff --git a/src/simulation/elements/NBHL.cpp b/src/simulation/elements/NBHL.cpp index feb42ef4a..2ccb86406 100644 --- a/src/simulation/elements/NBHL.cpp +++ b/src/simulation/elements/NBHL.cpp @@ -43,7 +43,7 @@ Element_NBHL::Element_NBHL() HighTemperatureTransition = NT; Update = &Element_NBHL::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_NBHL static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/NBLE.cpp b/src/simulation/elements/NBLE.cpp index 3cd02591b..d08710227 100644 --- a/src/simulation/elements/NBLE.cpp +++ b/src/simulation/elements/NBLE.cpp @@ -43,7 +43,7 @@ Element_NBLE::Element_NBLE() HighTemperatureTransition = NT; Update = &Element_NBLE::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_NBLE static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/NICE.cpp b/src/simulation/elements/NICE.cpp index 8c01ea40c..8a6086e71 100644 --- a/src/simulation/elements/NICE.cpp +++ b/src/simulation/elements/NICE.cpp @@ -43,7 +43,7 @@ Element_NICE::Element_NICE() HighTemperatureTransition = PT_LNTG; Update = NULL; - Graphics = NULL; + } Element_NICE::~Element_NICE() {} \ No newline at end of file diff --git a/src/simulation/elements/NITR.cpp b/src/simulation/elements/NITR.cpp index 45877f29b..bf0feeeee 100644 --- a/src/simulation/elements/NITR.cpp +++ b/src/simulation/elements/NITR.cpp @@ -43,7 +43,7 @@ Element_NITR::Element_NITR() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_NITR::~Element_NITR() {} \ No newline at end of file diff --git a/src/simulation/elements/NONE.cpp b/src/simulation/elements/NONE.cpp index 8029bee77..d271c902e 100644 --- a/src/simulation/elements/NONE.cpp +++ b/src/simulation/elements/NONE.cpp @@ -43,7 +43,7 @@ Element_NONE::Element_NONE() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_NONE::~Element_NONE() {} \ No newline at end of file diff --git a/src/simulation/elements/NSCN.cpp b/src/simulation/elements/NSCN.cpp index 3d9364561..c16e9c428 100644 --- a/src/simulation/elements/NSCN.cpp +++ b/src/simulation/elements/NSCN.cpp @@ -43,7 +43,7 @@ Element_NSCN::Element_NSCN() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_NSCN::~Element_NSCN() {} \ No newline at end of file diff --git a/src/simulation/elements/NTCT.cpp b/src/simulation/elements/NTCT.cpp index 0e4d67b38..224146809 100644 --- a/src/simulation/elements/NTCT.cpp +++ b/src/simulation/elements/NTCT.cpp @@ -43,7 +43,7 @@ Element_NTCT::Element_NTCT() HighTemperatureTransition = PT_LAVA; Update = &Element_NTCT::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_NTCT static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/NWHL.cpp b/src/simulation/elements/NWHL.cpp index aadce99aa..7fcda4a55 100644 --- a/src/simulation/elements/NWHL.cpp +++ b/src/simulation/elements/NWHL.cpp @@ -43,7 +43,7 @@ Element_NWHL::Element_NWHL() HighTemperatureTransition = NT; Update = &Element_NWHL::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_NWHL static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/O2.cpp b/src/simulation/elements/O2.cpp index 285fb3fcd..1167e76d8 100644 --- a/src/simulation/elements/O2.cpp +++ b/src/simulation/elements/O2.cpp @@ -43,7 +43,7 @@ Element_O2::Element_O2() HighTemperatureTransition = NT; Update = &Element_O2::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_O2 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/OIL.cpp b/src/simulation/elements/OIL.cpp index 3504a1f73..5dd7595f9 100644 --- a/src/simulation/elements/OIL.cpp +++ b/src/simulation/elements/OIL.cpp @@ -43,7 +43,7 @@ Element_OIL::Element_OIL() HighTemperatureTransition = PT_GAS; Update = NULL; - Graphics = NULL; + } Element_OIL::~Element_OIL() {} \ No newline at end of file diff --git a/src/simulation/elements/PLEX.cpp b/src/simulation/elements/PLEX.cpp index ec5ad1779..c2f157b18 100644 --- a/src/simulation/elements/PLEX.cpp +++ b/src/simulation/elements/PLEX.cpp @@ -43,7 +43,7 @@ Element_PLEX::Element_PLEX() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_PLEX::~Element_PLEX() {} \ No newline at end of file diff --git a/src/simulation/elements/PLNT.cpp b/src/simulation/elements/PLNT.cpp index 17feda798..91d29d0c8 100644 --- a/src/simulation/elements/PLNT.cpp +++ b/src/simulation/elements/PLNT.cpp @@ -43,7 +43,7 @@ Element_PLNT::Element_PLNT() HighTemperatureTransition = PT_FIRE; Update = &Element_PLNT::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_PLNT static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/PLUT.cpp b/src/simulation/elements/PLUT.cpp index 688ea35a3..c9b759acc 100644 --- a/src/simulation/elements/PLUT.cpp +++ b/src/simulation/elements/PLUT.cpp @@ -43,7 +43,7 @@ Element_PLUT::Element_PLUT() HighTemperatureTransition = NT; Update = &Element_PLUT::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_PLUT static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/PSCN.cpp b/src/simulation/elements/PSCN.cpp index 54d64a15c..b074f7b33 100644 --- a/src/simulation/elements/PSCN.cpp +++ b/src/simulation/elements/PSCN.cpp @@ -43,7 +43,7 @@ Element_PSCN::Element_PSCN() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_PSCN::~Element_PSCN() {} \ No newline at end of file diff --git a/src/simulation/elements/PSTE.cpp b/src/simulation/elements/PSTE.cpp index 50ff1d2f0..6efea5138 100644 --- a/src/simulation/elements/PSTE.cpp +++ b/src/simulation/elements/PSTE.cpp @@ -43,7 +43,7 @@ Element_PSTE::Element_PSTE() HighTemperatureTransition = PT_BRCK; Update = NULL; - Graphics = NULL; + } Element_PSTE::~Element_PSTE() {} \ No newline at end of file diff --git a/src/simulation/elements/PSTS.cpp b/src/simulation/elements/PSTS.cpp index cdd5cad40..5dd331c65 100644 --- a/src/simulation/elements/PSTS.cpp +++ b/src/simulation/elements/PSTS.cpp @@ -43,7 +43,7 @@ Element_PSTS::Element_PSTS() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_PSTS::~Element_PSTS() {} \ No newline at end of file diff --git a/src/simulation/elements/PTCT.cpp b/src/simulation/elements/PTCT.cpp index 9119e1a3c..bda58c7f5 100644 --- a/src/simulation/elements/PTCT.cpp +++ b/src/simulation/elements/PTCT.cpp @@ -43,7 +43,7 @@ Element_PTCT::Element_PTCT() HighTemperatureTransition = PT_LAVA; Update = &Element_PTCT::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_PTCT static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/RBDM.cpp b/src/simulation/elements/RBDM.cpp index 1b85a1526..90a332b4b 100644 --- a/src/simulation/elements/RBDM.cpp +++ b/src/simulation/elements/RBDM.cpp @@ -43,7 +43,7 @@ Element_RBDM::Element_RBDM() HighTemperatureTransition = PT_LRBD; Update = NULL; - Graphics = NULL; + } Element_RBDM::~Element_RBDM() {} \ No newline at end of file diff --git a/src/simulation/elements/REPL.cpp b/src/simulation/elements/REPL.cpp index e7eae1470..b2deaee57 100644 --- a/src/simulation/elements/REPL.cpp +++ b/src/simulation/elements/REPL.cpp @@ -43,7 +43,7 @@ Element_REPL::Element_REPL() HighTemperatureTransition = NT; Update = &Element_REPL::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_REPL static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/RIME.cpp b/src/simulation/elements/RIME.cpp index e9938628f..1ff2fade1 100644 --- a/src/simulation/elements/RIME.cpp +++ b/src/simulation/elements/RIME.cpp @@ -43,7 +43,7 @@ Element_RIME::Element_RIME() HighTemperatureTransition = PT_WATR; Update = &Element_RIME::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_RIME static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SALT.cpp b/src/simulation/elements/SALT.cpp index 5042c6597..a2e6274dd 100644 --- a/src/simulation/elements/SALT.cpp +++ b/src/simulation/elements/SALT.cpp @@ -43,7 +43,7 @@ Element_SALT::Element_SALT() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_SALT::~Element_SALT() {} \ No newline at end of file diff --git a/src/simulation/elements/SAND.cpp b/src/simulation/elements/SAND.cpp index c791a0ada..a1d9c0067 100644 --- a/src/simulation/elements/SAND.cpp +++ b/src/simulation/elements/SAND.cpp @@ -43,7 +43,7 @@ Element_SAND::Element_SAND() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_SAND::~Element_SAND() {} \ No newline at end of file diff --git a/src/simulation/elements/SHLD1.cpp b/src/simulation/elements/SHLD1.cpp index 2d48f9d09..605180a6f 100644 --- a/src/simulation/elements/SHLD1.cpp +++ b/src/simulation/elements/SHLD1.cpp @@ -43,7 +43,7 @@ Element_SHLD1::Element_SHLD1() HighTemperatureTransition = NT; Update = &Element_SHLD1::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SHLD1 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SHLD2.cpp b/src/simulation/elements/SHLD2.cpp index cdb72e930..c00e4c9c0 100644 --- a/src/simulation/elements/SHLD2.cpp +++ b/src/simulation/elements/SHLD2.cpp @@ -43,7 +43,7 @@ Element_SHLD2::Element_SHLD2() HighTemperatureTransition = NT; Update = &Element_SHLD2::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SHLD2 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SHLD3.cpp b/src/simulation/elements/SHLD3.cpp index c90a1d8e4..633a8c42b 100644 --- a/src/simulation/elements/SHLD3.cpp +++ b/src/simulation/elements/SHLD3.cpp @@ -43,7 +43,7 @@ Element_SHLD3::Element_SHLD3() HighTemperatureTransition = NT; Update = &Element_SHLD3::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SHLD3 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SHLD4.cpp b/src/simulation/elements/SHLD4.cpp index 0aa38e852..95c8ae4a3 100644 --- a/src/simulation/elements/SHLD4.cpp +++ b/src/simulation/elements/SHLD4.cpp @@ -43,7 +43,7 @@ Element_SHLD4::Element_SHLD4() HighTemperatureTransition = NT; Update = &Element_SHLD4::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SHLD4 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SING.cpp b/src/simulation/elements/SING.cpp index 8bd3f24e9..78641a85a 100644 --- a/src/simulation/elements/SING.cpp +++ b/src/simulation/elements/SING.cpp @@ -43,7 +43,7 @@ Element_SING::Element_SING() HighTemperatureTransition = NT; Update = &Element_SING::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SING static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SLTW.cpp b/src/simulation/elements/SLTW.cpp index 1b3c4b463..3dad33c7c 100644 --- a/src/simulation/elements/SLTW.cpp +++ b/src/simulation/elements/SLTW.cpp @@ -43,7 +43,7 @@ Element_SLTW::Element_SLTW() HighTemperatureTransition = ST; Update = &Element_SLTW::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SLTW static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SNOW.cpp b/src/simulation/elements/SNOW.cpp index 9d8a6a5be..4e592f77c 100644 --- a/src/simulation/elements/SNOW.cpp +++ b/src/simulation/elements/SNOW.cpp @@ -43,7 +43,7 @@ Element_SNOW::Element_SNOW() HighTemperatureTransition = ST; Update = &Element_SNOW::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SNOW static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SOAP.cpp b/src/simulation/elements/SOAP.cpp index 031c0d135..d4ed39d43 100644 --- a/src/simulation/elements/SOAP.cpp +++ b/src/simulation/elements/SOAP.cpp @@ -43,7 +43,7 @@ Element_SOAP::Element_SOAP() HighTemperatureTransition = NT; Update = &Element_SOAP::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SOAP static void attach(Particle * parts, int i1, int i2) diff --git a/src/simulation/elements/SPAWN.cpp b/src/simulation/elements/SPAWN.cpp index 092be1cc4..85295f28b 100644 --- a/src/simulation/elements/SPAWN.cpp +++ b/src/simulation/elements/SPAWN.cpp @@ -43,7 +43,7 @@ Element_SPAWN::Element_SPAWN() HighTemperatureTransition = NT; Update = &Element_SPAWN::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SPAWN static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/SPAWN2.cpp b/src/simulation/elements/SPAWN2.cpp index be2088369..3cc048b03 100644 --- a/src/simulation/elements/SPAWN2.cpp +++ b/src/simulation/elements/SPAWN2.cpp @@ -43,7 +43,7 @@ Element_SPAWN2::Element_SPAWN2() HighTemperatureTransition = NT; Update = &Element_SPAWN2::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_SPAWN2 static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/STNE.cpp b/src/simulation/elements/STNE.cpp index 2a2a2fdcd..ff5251de7 100644 --- a/src/simulation/elements/STNE.cpp +++ b/src/simulation/elements/STNE.cpp @@ -43,7 +43,7 @@ Element_STNE::Element_STNE() HighTemperatureTransition = PT_LAVA; Update = NULL; - Graphics = NULL; + } Element_STNE::~Element_STNE() {} \ No newline at end of file diff --git a/src/simulation/elements/TESC.cpp b/src/simulation/elements/TESC.cpp index 7c3cce6a3..025cd75dd 100644 --- a/src/simulation/elements/TESC.cpp +++ b/src/simulation/elements/TESC.cpp @@ -43,7 +43,7 @@ Element_TESC::Element_TESC() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_TESC::~Element_TESC() {} \ No newline at end of file diff --git a/src/simulation/elements/THRM.cpp b/src/simulation/elements/THRM.cpp index e87a37912..e7d1dde8e 100644 --- a/src/simulation/elements/THRM.cpp +++ b/src/simulation/elements/THRM.cpp @@ -43,7 +43,7 @@ Element_THRM::Element_THRM() HighTemperatureTransition = NT; Update = &Element_THRM::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_THRM static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/TTAN.cpp b/src/simulation/elements/TTAN.cpp index 66fc76be9..c51319dd5 100644 --- a/src/simulation/elements/TTAN.cpp +++ b/src/simulation/elements/TTAN.cpp @@ -44,7 +44,7 @@ Element_TTAN::Element_TTAN() HighTemperatureTransition = PT_LAVA; Update = &Element_TTAN::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_TTAN static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/URAN.cpp b/src/simulation/elements/URAN.cpp index 0a5fb798a..a988bf3e1 100644 --- a/src/simulation/elements/URAN.cpp +++ b/src/simulation/elements/URAN.cpp @@ -43,7 +43,7 @@ Element_URAN::Element_URAN() HighTemperatureTransition = NT; Update = &Element_URAN::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_URAN static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/VINE.cpp b/src/simulation/elements/VINE.cpp index 142e235a6..991dfc444 100644 --- a/src/simulation/elements/VINE.cpp +++ b/src/simulation/elements/VINE.cpp @@ -43,7 +43,7 @@ Element_VINE::Element_VINE() HighTemperatureTransition = PT_FIRE; Update = &Element_VINE::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_VINE static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/VOID.cpp b/src/simulation/elements/VOID.cpp index 1627ad266..05eb87224 100644 --- a/src/simulation/elements/VOID.cpp +++ b/src/simulation/elements/VOID.cpp @@ -43,7 +43,7 @@ Element_VOID::Element_VOID() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_VOID::~Element_VOID() {} \ No newline at end of file diff --git a/src/simulation/elements/WARP.cpp b/src/simulation/elements/WARP.cpp index bc19aa0e3..bcd71a38f 100644 --- a/src/simulation/elements/WARP.cpp +++ b/src/simulation/elements/WARP.cpp @@ -43,7 +43,7 @@ Element_WARP::Element_WARP() HighTemperatureTransition = NT; Update = &Element_WARP::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_WARP static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/WATR.cpp b/src/simulation/elements/WATR.cpp index 037c8c927..3c546e67b 100644 --- a/src/simulation/elements/WATR.cpp +++ b/src/simulation/elements/WATR.cpp @@ -43,7 +43,7 @@ Element_WATR::Element_WATR() HighTemperatureTransition = PT_WTRV; Update = &Element_WATR::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_WATR static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/WAX.cpp b/src/simulation/elements/WAX.cpp index 2ab705b13..5f9a113d1 100644 --- a/src/simulation/elements/WAX.cpp +++ b/src/simulation/elements/WAX.cpp @@ -43,7 +43,7 @@ Element_WAX::Element_WAX() HighTemperatureTransition = PT_MWAX; Update = NULL; - Graphics = NULL; + } Element_WAX::~Element_WAX() {} \ No newline at end of file diff --git a/src/simulation/elements/WHOL.cpp b/src/simulation/elements/WHOL.cpp index 572fca095..300796026 100644 --- a/src/simulation/elements/WHOL.cpp +++ b/src/simulation/elements/WHOL.cpp @@ -43,7 +43,7 @@ Element_WHOL::Element_WHOL() HighTemperatureTransition = NT; Update = NULL; - Graphics = NULL; + } Element_WHOL::~Element_WHOL() {} \ No newline at end of file diff --git a/src/simulation/elements/WOOD.cpp b/src/simulation/elements/WOOD.cpp index c53be8e57..398c657ad 100644 --- a/src/simulation/elements/WOOD.cpp +++ b/src/simulation/elements/WOOD.cpp @@ -43,7 +43,7 @@ Element_WOOD::Element_WOOD() HighTemperatureTransition = PT_FIRE; Update = NULL; - Graphics = NULL; + } Element_WOOD::~Element_WOOD() {} \ No newline at end of file diff --git a/src/simulation/elements/WTRV.cpp b/src/simulation/elements/WTRV.cpp index 8850cff98..fb72db8dc 100644 --- a/src/simulation/elements/WTRV.cpp +++ b/src/simulation/elements/WTRV.cpp @@ -43,7 +43,7 @@ Element_WTRV::Element_WTRV() HighTemperatureTransition = NT; Update = &Element_WTRV::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_WTRV static int update(UPDATE_FUNC_ARGS) diff --git a/src/simulation/elements/YEST.cpp b/src/simulation/elements/YEST.cpp index 1b1b8fed7..99df265f0 100644 --- a/src/simulation/elements/YEST.cpp +++ b/src/simulation/elements/YEST.cpp @@ -43,7 +43,7 @@ Element_YEST::Element_YEST() HighTemperatureTransition = PT_DYST; Update = &Element_YEST::update; - Graphics = NULL; + } //#TPT-Directive ElementHeader Element_YEST static int update(UPDATE_FUNC_ARGS)