Skip to content

Commit

Permalink
Merge pull request EasyRPG#123 from Ghabry/development
Browse files Browse the repository at this point in the history
Fake battle system
  • Loading branch information
fdelapena committed Apr 20, 2013
2 parents fd8e58f + 2dd45b6 commit b4bb11b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace {
{ "ChipSet", true, 480, 480, 256, 256 },
{ "FaceSet", true, 192, 192, 192, 192 },
{ "GameOver", false, 320, 320, 240, 240 },
{ "Monster", false, 16, 320, 16, 160 },
{ "Monster", true, 16, 320, 16, 160 },
{ "Panorama", false, 80, 640, 80, 480 },
{ "Picture", true, 1, 640, 1, 480 },
{ "System", true, 160, 160, 80, 80 },
Expand Down
29 changes: 21 additions & 8 deletions src/scene_battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@ void Scene_Battle::Start() {
auto_battle = false;
enemy_action = NULL;

CreateCursors();
//CreateCursors();
CreateWindows();

help_window->SetText("Battle System not implemented yet. Select result.");

animation.reset();
animations.clear();

Expand Down Expand Up @@ -191,6 +193,7 @@ void Scene_Battle::SetState(Scene_Battle::State new_state) {

switch (state) {
case State_Options:
help_window->SetVisible(true);
options_window->SetVisible(true);
status_window->SetVisible(true);
status_window->SetX(76);
Expand Down Expand Up @@ -736,15 +739,25 @@ void Scene_Battle::ProcessInput() {
case State_Options:
switch (options_window->GetIndex()) {
case 0:
auto_battle = false;
SetState(State_Battle);
Game_Temp::battle_result = Game_Temp::BattleVictory;
Scene::Pop();
//auto_battle = false;
//SetState(State_Battle);
break;
case 1:
auto_battle = true;
SetState(State_Battle);
if (Game_Temp::battle_defeat_mode != 0) {
Game_Temp::battle_result = Game_Temp::BattleDefeat;
Scene::Pop();
}
//auto_battle = true;
//SetState(State_Battle);
break;
case 2:
Escape();
if (Game_Temp::battle_escape_mode != 0) {
Game_Temp::battle_result = Game_Temp::BattleEscape;
Scene::Pop();
}
//Escape();
break;
}
break;
Expand Down Expand Up @@ -985,14 +998,14 @@ void Scene_Battle::Update() {
Game_Battle::SetActiveAlly(status_window->GetActiveCharacter());
command_window->SetActor(Game_Battle::GetActiveActor());

cycle++;
//cycle++;

ProcessActions();
ProcessInput();
DoAuto();

UpdateBackground();
UpdateCursors();
//UpdateCursors();
UpdateSprites();
UpdateFloaters();
UpdateAnimations();
Expand Down
22 changes: 17 additions & 5 deletions src/window_battleoption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
Window_BattleOption::Window_BattleOption(int x, int y, int width, int height) :
Window_Base(x, y, width, height) {

commands.push_back(Data::terms.battle_fight);
commands.push_back(Data::terms.battle_auto);
commands.push_back(Data::terms.battle_escape);
//commands.push_back(Data::terms.battle_fight);
//commands.push_back(Data::terms.battle_auto);
//commands.push_back(Data::terms.battle_escape);

commands.push_back("Victory");
commands.push_back("Defeat");
commands.push_back("Escape");

index = -1;
top_row = 0;
Expand Down Expand Up @@ -87,12 +91,20 @@ void Window_BattleOption::UpdateCursorRect() {

void Window_BattleOption::Refresh() {
contents->Clear();
for (int i = 0; i < (int) commands.size(); i++) {

Font::SystemColor color = Font::ColorDefault;

DrawItem(0, color);
color = Game_Temp::battle_defeat_mode == 0 ? Font::ColorDisabled : Font::ColorDefault;
DrawItem(1, color);
color = Game_Temp::battle_escape_mode == 0 ? Font::ColorDisabled : Font::ColorDefault;
DrawItem(2, color);
/*for (int i = 0; i < (int) commands.size(); i++) {
Font::SystemColor color = (i == 2 && Game_Temp::battle_escape_mode == 0)
? Font::ColorDisabled
: Font::ColorDefault;
DrawItem(i, color);
}
}*/
}

void Window_BattleOption::DrawItem(int index, Font::SystemColor color) {
Expand Down
8 changes: 4 additions & 4 deletions src/window_battlestatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void Window_BattleStatus::Refresh() {
DrawActorName(actor, 4, y);
DrawActorState(actor, 80, y);
DrawActorHp(actor, 136, y, true);
DrawGauge(actor, i, 192, y);
//DrawGauge(actor, i, 192, y);
DrawActorSp(actor, 202, y, false);
}
}
Expand All @@ -59,7 +59,7 @@ void Window_BattleStatus::RefreshGauge(int i) {
int y = i * 15;
contents->ClearRect(Rect(192, y, 44, 15));
Game_Actor* actor = Game_Battle::allies[i].game_actor;
DrawGauge(actor, i, 192, y);
//DrawGauge(actor, i, 192, y);
DrawActorSp(actor, 202, y, false);
}

Expand Down Expand Up @@ -113,8 +113,8 @@ void Window_BattleStatus::Update() {
Window_Base::Update();

int num_actors = Game_Battle::allies.size();
for (int i = 0; i < num_actors; i++)
RefreshGauge(i);
/*for (int i = 0; i < num_actors; i++)
RefreshGauge(i);*/

if (active && index >= 0) {
if (Input::IsRepeated(Input::DOWN)) {
Expand Down

0 comments on commit b4bb11b

Please sign in to comment.