Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ready] Respawn functionality #446

Merged
merged 2 commits into from May 18, 2018
Merged

[Ready] Respawn functionality #446

merged 2 commits into from May 18, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 9, 2018

Respawning is now handled, related opcodes seemed to work.

Closes #48

  • Respawning to closest place
  • Island overrides for hospitals and jails
  • Raw position overrides
  • Handling money
  • Free health care
  • Getting out of jail free
  • Penalty calculation based on number of wanted stars
  • Fading with correct timing and colours
  • Advancing time
  • Clearing weapons
  • Improve dying state for character object
  • Opcodes
  • Refactor? fading stuff, so you can fade by calling a function
  • Show wasted / busted text
  • ~~~Camera flying away~~~ (not going to do now)
  • Increment death/jail stat
  • Mission override restart fixed

@ghost ghost mentioned this pull request May 9, 2018
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;)

bool isWasted();
bool isBusted();

void restartLogic();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comment would be useful. ;)

}

void addPoliceRestart(const glm::vec4 location) {
policeRestarts.push_back(location);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reformat.

@@ -319,8 +319,55 @@ class GameState {
/** Objects created by the current mission */
std::vector<GameObject*> missionObjects;

bool overrideNextStart;
bool overrideNextRestart;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be initialized.

@@ -645,3 +645,9 @@ void CharacterObject::useItem(bool active, bool primary) {
}
}
}

void CharacterObject::clearInventory() {
for (int slot = 0; slot < kMaxInventorySlots; ++slot) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Range loop?

Copy link
Author

@ghost ghost May 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case range loop makes things complicated, because we are getting a value which we need to unpack

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I haven't noticed usage of slot.

@@ -33,6 +33,11 @@ class PlayerController : public CharacterController {

void enterNearestVehicle();

bool isWasted();
bool isBusted();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe todo comment?

dracc added a commit to dracc/openrw that referenced this pull request May 10, 2018
dracc added a commit to dracc/openrw that referenced this pull request May 10, 2018
dracc added a commit to dracc/openrw that referenced this pull request May 10, 2018
@ghost ghost mentioned this pull request May 13, 2018
Copy link
Member

@danhedron danhedron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming along great.

int islandOverride;

if (type == Hospital) {
iter = hospitalRestarts;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could avoid copying the list here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

RW_UNUSED(args);
void opcode_016c(const ScriptArguments& args, ScriptVec3 coord, const ScriptFloat heading) {
coord = script::getGround(args, coord);
args.getState()->addHospitalRestart(glm::vec4(coord, heading));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixing tabs and spaces?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I can fix these exact lines, but whole file should be reformatted anyway

@ghost
Copy link
Author

ghost commented May 13, 2018

when fail the mission the game dont restart after this merge, looks like gtasa but in gta3 the game restart right ?

@ghost
Copy link
Author

ghost commented May 13, 2018

@mythrillex I don't understand what you meant by that

@ghost
Copy link
Author

ghost commented May 13, 2018

hmm sorry, if u fail the first mission (newgame), the game will restart the mission, but with this respawn the restart dont occur
image

@ghost
Copy link
Author

ghost commented May 13, 2018

#443 patch required to make missions failable upon death

@ghost ghost changed the title Very basic respawn functionality [WIP] Very basic respawn functionality May 13, 2018
@ghost ghost changed the title [WIP] Very basic respawn functionality [WIP] Respawn functionality May 13, 2018
@ghost ghost changed the title [WIP] Respawn functionality Respawn functionality May 13, 2018
@ghost
Copy link
Author

ghost commented May 14, 2018

if u kill 8-ball the game will make a respawn loop, restarting the mission over and over, its cause the game dont restart things when start the mission again (example if u break a lampost, when restart the lampost still broken)
i make this mistake of kill 8-ball when the mission restart, before he gets into the car, I kept the mouse pressed and killed him with the gun :v

i think u need remove the weapons when restart or block the shoot action ?

image

@ghost
Copy link
Author

ghost commented May 14, 2018

Yes, you are not supposed to shoot or move or do anything during cutscenes, also when cutscene starts it should clear all projectiles and make player safe. But that's not related to this PR. Maybe I'll do it later.

@ghost ghost changed the title Respawn functionality [Ready] Respawn functionality May 14, 2018
dracc added a commit to dracc/openrw that referenced this pull request May 14, 2018
dracc added a commit to dracc/openrw that referenced this pull request May 14, 2018
dracc added a commit to dracc/openrw that referenced this pull request May 15, 2018
dracc added a commit to dracc/openrw that referenced this pull request May 15, 2018
@danhedron danhedron merged commit b77ca47 into rwengine:master May 18, 2018
@ghost ghost deleted the respawn branch May 18, 2018 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The player doesn't respawn when dead
1 participant