[Scummvm-git-logs] scummvm master -> fb9d813ef45d5fa3e70e6620f1ef8347a3cd0221

dreammaster dreammaster at scummvm.org
Sun Nov 19 21:30:01 CET 2017


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0878d8f573 XEEN: Extra comments for script methods
fb9d813ef4 XEEN: Cleaner implementation of changing script line number


Commit: 0878d8f573aecde6d8387ce6095c7ec8cc2d34dc
    https://github.com/scummvm/scummvm/commit/0878d8f573aecde6d8387ce6095c7ec8cc2d34dc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-11-19T15:25:12-05:00

Commit Message:
XEEN: Extra comments for script methods

Changed paths:
    engines/xeen/scripts.cpp
    engines/xeen/scripts.h


diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index a2c5bca..a78bc23 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -335,14 +335,14 @@ bool Scripts::doOpcode(MazeEvent &event) {
 		&Scripts::cmdTeleport, &Scripts::cmdWhoWill,
 		&Scripts::cmdRndDamage, &Scripts::cmdMoveWallObj, &Scripts::cmdAlterCellFlag,
 		&Scripts::cmdAlterHed, &Scripts::cmdDisplayStat, &Scripts::cmdTakeOrGive,
-		&Scripts::cmdSeatTextSml, &Scripts::cmdPlayEventVoc, &Scripts::cmdDisplayBottom,
-		&Scripts::cmdIfMapFlag, &Scripts::cmdSelRndChar, &Scripts::cmdGiveEnchanted,
+		&Scripts::cmdSignTextSml, &Scripts::cmdPlayEventVoc, &Scripts::cmdDisplayBottom,
+		&Scripts::cmdIfMapFlag, &Scripts::cmdSelectRandomChar, &Scripts::cmdGiveEnchanted,
 		&Scripts::cmdItemType, &Scripts::cmdMakeNothingHere, &Scripts::cmdCheckProtection,
 		&Scripts::cmdChooseNumeric, &Scripts::cmdDisplayBottomTwoLines,
 		&Scripts::cmdDisplayLarge, &Scripts::cmdExchObj, &Scripts::cmdFallToMap,
 		&Scripts::cmdDisplayMain, &Scripts::cmdGoto, &Scripts::cmdConfirmEnding,
 		&Scripts::cmdGotoRandom, &Scripts::cmdCutsceneEndDarkside,
-		&Scripts::cmdCutsceneEdWorld, &Scripts::cmdFlipWorld, &Scripts::cmdPlayCD
+		&Scripts::cmdCutsceneEndWorld, &Scripts::cmdFlipWorld, &Scripts::cmdPlayCD
 	};
 
 	_event = &event;
@@ -1085,7 +1085,7 @@ bool Scripts::cmdDisplayStat(Common::Array<byte> &params) {
 	return true;
 }
 
-bool Scripts::cmdSeatTextSml(Common::Array<byte> &params) {
+bool Scripts::cmdSignTextSml(Common::Array<byte> &params) {
 	Interface &intf = *_vm->_interface;
 
 	intf._screenText = Common::String::format("\x2\f08\x3""c\t116\v090%s\x3l\fd\x1",
@@ -1122,7 +1122,7 @@ bool Scripts::cmdIfMapFlag(Common::Array<byte> &params) {
 	return true;
 }
 
-bool Scripts::cmdSelRndChar(Common::Array<byte> &params) {
+bool Scripts::cmdSelectRandomChar(Common::Array<byte> &params) {
 	_charIndex = _vm->getRandomNumber(1, _vm->_party->_activeParty.size());
 	return true;
 }
@@ -1306,7 +1306,7 @@ bool Scripts::cmdCutsceneEndDarkside(Common::Array<byte> &params) {
 	return false;
 }
 
-bool Scripts::cmdCutsceneEdWorld(Common::Array<byte> &params) {
+bool Scripts::cmdCutsceneEndWorld(Common::Array<byte> &params) {
 	_vm->_saves->_wonWorld = true;
 	_vm->_party->_worldEnd = true;
 
diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h
index cd548f8..e1c4fa8 100644
--- a/engines/xeen/scripts.h
+++ b/engines/xeen/scripts.h
@@ -77,7 +77,7 @@ enum Opcode {
 	OP_PlayEventVoc = 0x28,
 	OP_DisplayBottom = 0x29,
 	OP_IfMapFlag	= 0x2A,
-	OP_SelRndChar	= 0x2B,
+	OP_SelectRandomChar = 0x2B,
 	OP_GiveEnchanted= 0x2C,
 	OP_ItemType		= 0x2D,
 	OP_MakeNothingHere = 0x2E,
@@ -282,26 +282,96 @@ private:
 	 * called the script
 	 */
 	bool cmdReturn(Common::Array<byte> &params);
+
+	/**
+	 * Sets variables on characters like race, sex, and class
+	 */
 	bool cmdSetVar(Common::Array<byte> &params);
+
+	/**
+	 * Play the Clouds endgame
+	 */
 	bool cmdCutsceneEndClouds(Common::Array<byte> &params);
+
+	/**
+	 * Prompts the user for which character will do an action
+	 */
 	bool cmdWhoWill(Common::Array<byte> &params);
+
+	/**
+	 * Deals a random amount of damage to a character
+	 */
 	bool cmdRndDamage(Common::Array<byte> &params);
+
+	/**
+	 * Moves the wall object to the given coordinates. Doesn't change it's orientation.
+	 * Wall objects are only visible when viewed straight on, and were never intended
+	 * to be anywhere but on squares directly facing walls
+	 */
 	bool cmdMoveWallObj(Common::Array<byte> &params);
+
+	/**
+	 * Sets the cell flag at the specified X/Y coordinate on the current map
+	 */
 	bool cmdAlterCellFlag(Common::Array<byte> &params);
+
+	/**
+	 * Sets the word value at the current X/Y location in the HED file
+	 * in memory to the given two bytes
+	 */
 	bool cmdAlterHed(Common::Array<byte> &params);
+
+	/**
+	 * Displays a text string which includes some stat of the currently selected character
+	 */
 	bool cmdDisplayStat(Common::Array<byte> &params);
-	bool cmdSeatTextSml(Common::Array<byte> &params);
+
+	/**
+	 * Displays text in the scene window for various objects
+	 * the user interacts with
+	 */
+	bool cmdSignTextSml(Common::Array<byte> &params);
+
+	/**
+	 * An array of six VOC filenames are hard-coded into the game executable file.
+	 * This function plays the VOC file at the specified index in this array
+	 */
 	bool cmdPlayEventVoc(Common::Array<byte> &params);
+
+	/**
+	 * Displays a large text message across the bottom of the screen
+	 */
 	bool cmdDisplayBottom(Common::Array<byte> &params);
+
+	/**
+	 * Checks if a given map flag/monster has been set, and if so
+	 * jumps to a given line
+	 */
 	bool cmdIfMapFlag(Common::Array<byte> &params);
-	bool cmdSelRndChar(Common::Array<byte> &params);
+
+	/**
+	 * Selects a random character for further other actions
+	 */
+	bool cmdSelectRandomChar(Common::Array<byte> &params);
+
+	/**
+	 * Gives an enchanted item to a character
+	 */
 	bool cmdGiveEnchanted(Common::Array<byte> &params);
+
+	/**
+	 * Sets the item category for used in character operations
+	 */
 	bool cmdItemType(Common::Array<byte> &params);
 
 	/**
 	 * Disable all the scripts at the party's current position
 	 */
 	bool cmdMakeNothingHere(Common::Array<byte> &params);
+
+	/**
+	 * Does a copy protection check
+	 */
 	bool cmdCheckProtection(Common::Array<byte> &params);
 
 	/**
@@ -309,14 +379,30 @@ private:
 	 * those options, jumps to whichever line for the option the user selects
 	 */
 	bool cmdChooseNumeric(Common::Array<byte> &params);
+
+	/**
+	 * Displays a two line message at the bottom of the screen
+	 */
 	bool cmdDisplayBottomTwoLines(Common::Array<byte> &params);
+
+	/**
+	 * Displays a message
+	 */
 	bool cmdDisplayLarge(Common::Array<byte> &params);
 
 	/**
 	 * Exchange the positions of two objects in the maze
 	 */
 	bool cmdExchObj(Common::Array<byte> &params);
+
+	/**
+	 * Handles making the player fall down to the ground
+	 */
 	bool cmdFallToMap(Common::Array<byte> &params);
+
+	/**
+	 * Displays a message
+	 */
 	bool cmdDisplayMain(Common::Array<byte> &params);
 
 	/**
@@ -330,9 +416,25 @@ private:
 	 * Pick a random value from the parameter list and jump to that line number
 	 */
 	bool cmdGotoRandom(Common::Array<byte> &params);
+
+	/**
+	 * Plays the Dark Side of Xeen ending
+	 */
 	bool cmdCutsceneEndDarkside(Common::Array<byte> &params);
-	bool cmdCutsceneEdWorld(Common::Array<byte> &params);
+
+	/**
+	 * Plays the World of Xeen ending
+	 */
+	bool cmdCutsceneEndWorld(Common::Array<byte> &params);
+
+	/**
+	 * Switches the player between the Clouds and Dark Side
+	 */
 	bool cmdFlipWorld(Common::Array<byte> &params);
+
+	/**
+	 * Plays a CD track
+	 */
 	bool cmdPlayCD(Common::Array<byte> &params);
 
 	int whoWill(int v1, int v2, int v3);
@@ -350,8 +452,14 @@ private:
 	 */
 	bool ifProc(int action, uint32 mask, int mode, int charIndex);
 
+	/**
+	 * Prompts the user for a copy protection check
+	 */
 	bool copyProtectionCheck();
 
+	/**
+	 * Displays a message
+	 */
 	void display(bool justifyFlag, int var46);
 public:
 	int _animCounter;


Commit: fb9d813ef45d5fa3e70e6620f1ef8347a3cd0221
    https://github.com/scummvm/scummvm/commit/fb9d813ef45d5fa3e70e6620f1ef8347a3cd0221
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-11-19T15:29:51-05:00

Commit Message:
XEEN: Cleaner implementation of changing script line number

Changed paths:
    engines/xeen/scripts.cpp


diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index a78bc23..2d0123e 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -412,8 +412,10 @@ bool Scripts::cmdNPC(Common::Array<byte> &params) {
 	Map &map = *_vm->_map;
 
 	if (TownMessage::show(_vm, params[2], _message, map._events._text[params[1]],
-			params[3]))
-		_lineNum = params[4] - 1;
+			params[3])) {
+		_lineNum = params[4];
+		return false;
+	}
 
 	return true;
 }
@@ -528,8 +530,10 @@ bool Scripts::cmdIf(Common::Array<byte> &params) {
 		}
 	}
 
-	if (result)
-		_lineNum = newLineNum - 1;
+	if (result) {
+		_lineNum = newLineNum;
+		return false;
+	}
 
 	return true;
 }
@@ -863,8 +867,10 @@ bool Scripts::cmdGiveExtended(Common::Array<byte> &params) {
 		}
 	}
 
-	if (result)
-		_lineNum = newLineNum - 1;
+	if (result) {
+		_lineNum = newLineNum;
+		return false;
+	}
 
 	return true;
 }
@@ -938,8 +944,10 @@ bool Scripts::cmdDamage(Common::Array<byte> &params) {
 
 bool Scripts::cmdJumpRnd(Common::Array<byte> &params) {
 	int v = _vm->getRandomNumber(1, params[0]);
-	if (v == params[1])
-		_lineNum = params[2] - 1;
+	if (v == params[1]) {
+		_lineNum = params[2];
+		return false;
+	}
 
 	return true;
 }
@@ -963,9 +971,9 @@ bool Scripts::cmdAlterEvent(Common::Array<byte> &params) {
 bool Scripts::cmdCallEvent(Common::Array<byte> &params) {
 	_stack.push(StackEntry(_currentPos, _lineNum));
 	_currentPos = Common::Point(params[0], params[1]);
-	_lineNum = params[2] - 1;
+	_lineNum = params[2];
 
-	return true;
+	return false;
 }
 
 bool Scripts::cmdReturn(Common::Array<byte> &params) {
@@ -1116,7 +1124,8 @@ bool Scripts::cmdIfMapFlag(Common::Array<byte> &params) {
 	MazeMonster &monster = map._mobData._monsters[params[0]];
 
 	if (monster._position.x >= 32 || monster._position.y >= 32) {
-		_lineNum = params[1] - 1;
+		_lineNum = params[1];
+		return false;
 	}
 
 	return true;
@@ -1220,7 +1229,8 @@ bool Scripts::cmdCheckProtection(Common::Array<byte> &params) {
 bool Scripts::cmdChooseNumeric(Common::Array<byte> &params) {
 	int choice = Choose123::show(_vm, params[0]);
 	if (choice) {
-		_lineNum = params[choice] - 1;
+		_lineNum = params[choice];
+		return false;
 	}
 
 	return true;
@@ -1282,15 +1292,17 @@ bool Scripts::cmdDisplayMain(Common::Array<byte> &params) {
 bool Scripts::cmdGoto(Common::Array<byte> &params) {
 	Map &map = *_vm->_map;
 	map.getCell(1);
-	if (params[0] == map._currentSurfaceId)
-		_lineNum = params[1] - 1;
+	if (params[0] == map._currentSurfaceId) {
+		_lineNum = params[1];
+		return false;
+	}
 
 	return true;
 }
 
 bool Scripts::cmdGotoRandom(Common::Array<byte> &params) {
-	_lineNum = params[_vm->getRandomNumber(1, params[0])] - 1;
-	return true;
+	_lineNum = params[_vm->getRandomNumber(1, params[0])];
+	return false;
 }
 
 bool Scripts::cmdCutsceneEndDarkside(Common::Array<byte> &params) {





More information about the Scummvm-git-logs mailing list