From ae1f601855dfef89f01100ea4947639f66d032d0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 7 Jan 2010 21:22:41 +0200 Subject: WAGE: Resource file is loaded. Signed-off-by: Eugene Sandulenko --- engines/wage/util.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 engines/wage/util.cpp (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp new file mode 100644 index 0000000000..9420150afe --- /dev/null +++ b/engines/wage/util.cpp @@ -0,0 +1,56 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "wage/wage.h" + +#include "common/stream.h" + +namespace Wage { +Common::String WageEngine::readPascalString(Common::SeekableReadStream &in) { + Common::String s; + char *buf; + int len; + int i; + + len = in.readSByte(); + if (len < 0) + len += 256; + + buf = (char *)malloc(len + 1); + for (i = 0; i < len; i++) { + buf[i] = in.readByte(); + if (buf[i] == 0x0d) + buf[i] = '\n'; + } + + buf[i] = 0; + + s = buf; + free(buf); + + return s; +} + +} // End of namespace Wage -- cgit v1.2.3 From ce6aa4dd28c2c8054e6c6287c11c717376771d90 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 7 Jan 2010 23:52:31 +0200 Subject: WAGE: Added stubs for most classes. Implemented Obj and Scene classes. Signed-off-by: Eugene Sandulenko --- engines/wage/util.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 9420150afe..2598a01d86 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -28,7 +28,8 @@ #include "common/stream.h" namespace Wage { -Common::String WageEngine::readPascalString(Common::SeekableReadStream &in) { + +Common::String readPascalString(Common::SeekableReadStream &in) { Common::String s; char *buf; int len; -- cgit v1.2.3 From f48876270378849d93dda18553bc15974e297e58 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 11 Jan 2010 00:26:01 +0200 Subject: WAGE: Finished world loading. Signed-off-by: Eugene Sandulenko --- engines/wage/util.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 2598a01d86..ab36582c5b 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -54,4 +54,15 @@ Common::String readPascalString(Common::SeekableReadStream &in) { return s; } +Common::Rect *readRect(Common::SeekableReadStream &in) { + int x1, y1, x2, y2; + + y1 = in.readUint16LE(); + x1 = in.readUint16LE(); + y2 = in.readUint16LE() + 4; + x2 = in.readUint16LE() + 4; + + return new Common::Rect(x1, y1, x2, y2); +} + } // End of namespace Wage -- cgit v1.2.3 From 406a05aec194729a711e13f9be5163069c931ede Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 11 Jan 2010 21:30:48 +0200 Subject: WAGE: Implement reading of all entities. This completes the world loading. Signed-off-by: Eugene Sandulenko --- engines/wage/util.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index ab36582c5b..d38256193a 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -57,10 +57,10 @@ Common::String readPascalString(Common::SeekableReadStream &in) { Common::Rect *readRect(Common::SeekableReadStream &in) { int x1, y1, x2, y2; - y1 = in.readUint16LE(); - x1 = in.readUint16LE(); - y2 = in.readUint16LE() + 4; - x2 = in.readUint16LE() + 4; + y1 = in.readUint16BE(); + x1 = in.readUint16BE(); + y2 = in.readUint16BE() + 4; + x2 = in.readUint16BE() + 4; return new Common::Rect(x1, y1, x2, y2); } -- cgit v1.2.3 From bee9d5e2d9a9bd15e8602440011510289cf7ffb0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 14 Jan 2010 12:24:12 +0200 Subject: WAGE: Added MIT license to mll relevant files. Signed-off-by: Eugene Sandulenko --- engines/wage/util.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index d38256193a..4a9ca67f93 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -18,6 +18,31 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + * MIT License: + * + * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * * $URL$ * $Id$ * -- cgit v1.2.3 From 5d7c72c6b67ce67577b581ac4876b6903e432eab Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 19 Oct 2012 17:51:08 +0200 Subject: WAGE: Remove SVN keywords from the headers Signed-off-by: Eugene Sandulenko --- engines/wage/util.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 4a9ca67f93..1a6c01050b 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -43,9 +43,6 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * $URL$ - * $Id$ - * */ #include "wage/wage.h" -- cgit v1.2.3 From d1682018eb1c83462349ae9e62a88849fefcb121 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 20 Oct 2012 00:38:04 +0200 Subject: WAGE: Added debug output, fixed semantics Signed-off-by: Eugene Sandulenko --- engines/wage/util.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 1a6c01050b..0bed88e46f 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -51,19 +51,19 @@ namespace Wage { -Common::String readPascalString(Common::SeekableReadStream &in) { +Common::String readPascalString(Common::SeekableReadStream *in) { Common::String s; char *buf; int len; int i; - len = in.readSByte(); + len = in->readSByte(); if (len < 0) len += 256; buf = (char *)malloc(len + 1); for (i = 0; i < len; i++) { - buf[i] = in.readByte(); + buf[i] = in->readByte(); if (buf[i] == 0x0d) buf[i] = '\n'; } @@ -76,13 +76,13 @@ Common::String readPascalString(Common::SeekableReadStream &in) { return s; } -Common::Rect *readRect(Common::SeekableReadStream &in) { +Common::Rect *readRect(Common::SeekableReadStream *in) { int x1, y1, x2, y2; - y1 = in.readUint16BE(); - x1 = in.readUint16BE(); - y2 = in.readUint16BE() + 4; - x2 = in.readUint16BE() + 4; + y1 = in->readUint16BE(); + x1 = in->readUint16BE(); + y2 = in->readUint16BE() + 4; + x2 = in->readUint16BE() + 4; return new Common::Rect(x1, y1, x2, y2); } -- cgit v1.2.3 From d66c3a21f1b2305fe30640213ff8dba0a20595c5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 3 Jan 2016 20:23:39 +0100 Subject: WAGE: Implement getGroundItemsList() --- engines/wage/util.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 0bed88e46f..8dac0d2935 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -87,4 +87,16 @@ Common::Rect *readRect(Common::SeekableReadStream *in) { return new Common::Rect(x1, y1, x2, y2); } +const char *getIndefiniteArticle(String &word) { + switch (word[0]) { + case 'a': case 'A': + case 'e': case 'E': + case 'i': case 'I': + case 'o': case 'O': + case 'u': case 'U': + return "an "; + } + return "a "; +} + } // End of namespace Wage -- cgit v1.2.3 From 51af66371dc71e908dade3563b9792e26f0d9661 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 8 Jan 2016 00:55:16 +0100 Subject: WAGE: Implement WageEngine::encounter() --- engines/wage/util.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 8dac0d2935..1390c496ce 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -99,4 +99,28 @@ const char *getIndefiniteArticle(String &word) { return "a "; } +enum { + GENDER_HE = 0, + GENDER_SHE = 1, + GENDER_IT = 2 +}; + +const char *prependGenderSpecificPronoun(int gender) { + if (gender == GENDER_HE) + return "his "; + else if (gender == GENDER_SHE) + return "her "; + else + return "its "; +} + +const char *getGenderSpecificPronoun(int gender, bool capitalize) { + if (gender == GENDER_HE) + return capitalize ? "He" : "he"; + else if (gender == GENDER_SHE) + return capitalize ? "She" : "she"; + else + return capitalize ? "It" : "it"; +} + } // End of namespace Wage -- cgit v1.2.3 From 9b8e5020bfae37505cf178aa6604882ee84d12c2 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 9 Jan 2016 01:25:23 +0100 Subject: WAGE: Reduced header dependency --- engines/wage/util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 1390c496ce..1216a275b0 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -45,10 +45,10 @@ * */ -#include "wage/wage.h" - #include "common/stream.h" +#include "wage/wage.h" + namespace Wage { Common::String readPascalString(Common::SeekableReadStream *in) { -- cgit v1.2.3 From 34f9a1375dec7bf6b42104fd5ffed0c36c112130 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 27 Jan 2016 11:11:02 +0100 Subject: WAGE: Get rid of Common::String import --- engines/wage/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 1216a275b0..2586c2884e 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -87,7 +87,7 @@ Common::Rect *readRect(Common::SeekableReadStream *in) { return new Common::Rect(x1, y1, x2, y2); } -const char *getIndefiniteArticle(String &word) { +const char *getIndefiniteArticle(Common::String &word) { switch (word[0]) { case 'a': case 'A': case 'e': case 'E': -- cgit v1.2.3 From 5e21a82c1eb9b9e46a3be63c0ab2d6768b943159 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Feb 2016 13:27:47 +0100 Subject: WAGE: Simplify code --- engines/wage/util.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 2586c2884e..51fcd2d6ec 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -57,10 +57,7 @@ Common::String readPascalString(Common::SeekableReadStream *in) { int len; int i; - len = in->readSByte(); - if (len < 0) - len += 256; - + len = in->readByte(); buf = (char *)malloc(len + 1); for (i = 0; i < len; i++) { buf[i] = in->readByte(); -- cgit v1.2.3 From c0697f7f2b7bea2b6e4dafb6fa5ac03aa0681638 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Feb 2016 13:52:05 +0100 Subject: WAGE: const goodness --- engines/wage/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 51fcd2d6ec..2a72960868 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -84,7 +84,7 @@ Common::Rect *readRect(Common::SeekableReadStream *in) { return new Common::Rect(x1, y1, x2, y2); } -const char *getIndefiniteArticle(Common::String &word) { +const char *getIndefiniteArticle(const Common::String &word) { switch (word[0]) { case 'a': case 'A': case 'e': case 'E': -- cgit v1.2.3 From e56fa508895b1f9840f76e4a70545047db20e67a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Feb 2016 14:11:24 +0100 Subject: WAGE: Better names for constants --- engines/wage/util.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/wage/util.cpp') diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 2a72960868..1b3dfc9452 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -97,24 +97,24 @@ const char *getIndefiniteArticle(const Common::String &word) { } enum { - GENDER_HE = 0, - GENDER_SHE = 1, - GENDER_IT = 2 + GENDER_MALE = 0, + GENDER_FEMALE = 1, + GENDER_NEUTRAL = 2 }; const char *prependGenderSpecificPronoun(int gender) { - if (gender == GENDER_HE) + if (gender == GENDER_MALE) return "his "; - else if (gender == GENDER_SHE) + else if (gender == GENDER_FEMALE) return "her "; else return "its "; } const char *getGenderSpecificPronoun(int gender, bool capitalize) { - if (gender == GENDER_HE) + if (gender == GENDER_MALE) return capitalize ? "He" : "he"; - else if (gender == GENDER_SHE) + else if (gender == GENDER_FEMALE) return capitalize ? "She" : "she"; else return capitalize ? "It" : "it"; -- cgit v1.2.3