Permalink
Browse files

STARTREK: Move VENG function into common code

  • Loading branch information...
Drenn1 committed Aug 8, 2018
1 parent 2c36571 commit 4017b0e306c62617444181272359524826242046
@@ -76,7 +76,8 @@ MODULE_OBJS = \
rooms/veng5.o \
rooms/veng6.o \
rooms/veng7.o \
rooms/veng8.o
rooms/veng8.o \
rooms/venga.o



@@ -2523,7 +2523,6 @@ class Room {
void veng1GetDebris();
void veng1ReachedDebrisToGet();
void veng1TriedToGetDebris();
void veng1UseMccoyOnDeadGuy();
// TODO: common code

// VENG2
@@ -2637,7 +2636,6 @@ class Room {
void veng3GetCable();
void veng3ReachedCable();
void veng3PickedUpCable();
void veng3UseMccoyOnDeadGuy();
// TODO: Common code

// VENG4
@@ -2714,7 +2712,7 @@ class Room {
void veng5GetPowerPack();
void veng5ReachedPowerPack();
void veng5PickedUpPowerPack();
// TODO: common code (and scanning the dead guy)
// TODO: common code

// VENG6
void veng6Tick1();
@@ -2725,6 +2723,9 @@ class Room {
// VENG8
void veng8Tick1();

// VENGA (common code)
void vengaUseMccoyOnDeadGuy();

public:
// Room-specific variables. This is memset'ed to 0 when the room is initialized.
// NOTE: Any changes here must be reflected in the corresponding serializer functions.
@@ -116,9 +116,10 @@ extern const RoomAction veng1ActionList[] = {
{ {ACTION_DONE_WALK, 11, 0, 0}, &Room::veng1ReachedDebrisToGet },
{ {ACTION_DONE_ANIM, 12, 0, 0}, &Room::veng1TriedToGetDebris },

{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_DEAD_GUY, 0}, &Room::veng1UseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_DEAD_GUY, 0}, &Room::veng1UseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_DEAD_GUY, 0}, &Room::veng1UseMccoyOnDeadGuy },
// Common code
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
};

extern const int veng1NumActions = ARRAYSIZE(veng1ActionList);
@@ -390,31 +391,4 @@ void Room::veng1TriedToGetDebris() {
}
}

void Room::veng1UseMccoyOnDeadGuy() { // NOTE: Identical to function in VENG3
int val = getRandomWordInRange(0, 5);

switch (val) {
case 0:
// NOTE: The exact text differs from the text used in DEM3. But, in order for this
// text indexing scheme to work, two rooms can't use the same audio with different
// text. Original was "He's dead, jim." instead of "He's dead, Jim...".
showText(TX_SPEAKER_MCCOY, TX_DEM3_019);
break;

case 1:
showText(TX_SPEAKER_MCCOY, TX_VEN4_016);
break;

case 2:
case 3:
showText(TX_SPEAKER_MCCOY, TX_G_014);
break;

case 4:
case 5:
showText(TX_SPEAKER_MCCOY, TX_VEN0_016);
break;
}
}

}
@@ -91,9 +91,10 @@ extern const RoomAction veng3ActionList[] = {
{ {ACTION_DONE_WALK, 11, 0, 0}, &Room::veng3ReachedCable },
{ {ACTION_DONE_ANIM, 12, 0, 0}, &Room::veng3PickedUpCable },

{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_DEAD_GUY, 0}, &Room::veng3UseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_DEAD_GUY, 0}, &Room::veng3UseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_DEAD_GUY, 0}, &Room::veng3UseMccoyOnDeadGuy },
// Common code
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
};

extern const int veng3NumActions = ARRAYSIZE(veng3ActionList);
@@ -353,31 +354,4 @@ void Room::veng3PickedUpCable() {
_awayMission->veng.tookCableFromSickbayHallway = true;
}

void Room::veng3UseMccoyOnDeadGuy() { // NOTE: Identical to function in VENG1
int val = getRandomWordInRange(0, 5);

switch (val) {
case 0:
// NOTE: The exact text differs from the text used in DEM3. But, in order for this
// text indexing scheme to work, two rooms can't use the same audio with different
// text. Original was "He's dead, jim." instead of "He's dead, Jim...".
showText(TX_SPEAKER_MCCOY, TX_DEM3_019);
break;

case 1:
showText(TX_SPEAKER_MCCOY, TX_VEN4_016);
break;

case 2:
case 3:
showText(TX_SPEAKER_MCCOY, TX_G_014);
break;

case 4:
case 5:
showText(TX_SPEAKER_MCCOY, TX_VEN0_016);
break;
}
}

}
@@ -76,6 +76,11 @@ extern const RoomAction veng5ActionList[] = {
{ {ACTION_GET, OBJECT_POWER_PACK, 0, 0}, &Room::veng5GetPowerPack },
{ {ACTION_DONE_WALK, 6, 0, 0}, &Room::veng5ReachedPowerPack },
{ {ACTION_DONE_ANIM, 7, 0, 0}, &Room::veng5PickedUpPowerPack },

// Common code
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
};

extern const int veng5NumActions = ARRAYSIZE(veng5ActionList);
@@ -0,0 +1,54 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "startrek/room.h"

namespace StarTrek {

void Room::vengaUseMccoyOnDeadGuy() {
int val = getRandomWordInRange(0, 5);

switch (val) {
case 0:
// NOTE: The exact text differs from the text used in DEM3. But, in order for this
// text indexing scheme to work, two rooms can't use the same audio with different
// text. Original was "He's dead, jim." instead of "He's dead, Jim...".
showText(TX_SPEAKER_MCCOY, TX_DEM3_019);
break;

case 1:
showText(TX_SPEAKER_MCCOY, TX_VEN4_016);
break;

case 2:
case 3:
showText(TX_SPEAKER_MCCOY, TX_G_014);
break;

case 4:
case 5:
showText(TX_SPEAKER_MCCOY, TX_VEN0_016);
break;
}
}

}

0 comments on commit 4017b0e

Please sign in to comment.