diff options
author | Alyssa Milburn | 2011-08-17 09:28:51 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-08-17 09:28:51 +0200 |
commit | ae287ccee58ebf68ab6125e5bbb4d8a44874330e (patch) | |
tree | 2f4cee4b2940466b8a578962e0174c6f89077a40 /engines/scumm/he/logic | |
parent | f5255288eabc0527c4c6b727a9db6b8d09a31206 (diff) | |
parent | e36832bbf84cba88fe6b17e1634fab0d550f13df (diff) | |
download | scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.tar.gz scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.tar.bz2 scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.zip |
Merge remote-tracking branch 'origin/master' into soccer
Conflicts:
engines/scumm/he/logic_he.cpp
engines/scumm/he/logic_he.h
Diffstat (limited to 'engines/scumm/he/logic')
-rw-r--r-- | engines/scumm/he/logic/basketball.cpp | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/engines/scumm/he/logic/basketball.cpp b/engines/scumm/he/logic/basketball.cpp index 0a2f99aa90..8352aa4357 100644 --- a/engines/scumm/he/logic/basketball.cpp +++ b/engines/scumm/he/logic/basketball.cpp @@ -35,6 +35,28 @@ public: int versionID(); int32 dispatch(int op, int numArgs, int32 *args); + +private: + int op_1012(); + int op_1050(int32 *args); + int op_1053(); + + // op_1050 loads court object data + enum CourtObjectType { + kObjectTypeBackboard = 1, + kObjectTypeRim = 2, + kObjectTypeOther = 3, + kObjectTypeFloor = 4 + }; + + struct CourtObject { + Common::String name; + CourtObjectType type; + uint32 data[10]; + }; + + Common::Array<CourtObject> _courtObjects; + uint32 _backboardObjectLeft, _backboardObjectRight; }; int LogicHEbasketball::versionID() { @@ -55,12 +77,14 @@ int32 LogicHEbasketball::dispatch(int op, int numArgs, int32 *args) { break; case 1012: + res = op_1012(); break; case 1035: break; case 1050: + res = op_1050(args); break; case 1051: @@ -69,6 +93,10 @@ int32 LogicHEbasketball::dispatch(int op, int numArgs, int32 *args) { case 1052: break; + case 1053: + res = op_1053(); + break; + case 1056: break; @@ -118,6 +146,83 @@ int32 LogicHEbasketball::dispatch(int op, int numArgs, int32 *args) { return res; } +int LogicHEbasketball::op_1012() { + writeScummVar(108, 12000); + writeScummVar(109, 8000); + writeScummVar(110, 760); + writeScummVar(111, 4000); + writeScummVar(112, 1600); + return 1; +} + +int LogicHEbasketball::op_1050(int32 *args) { + // This function loads the court data + static const char *courtNames[] = { + "Dobbaguchi", "Jocindas", "SandyFlats", "Queens", + "Park", "Scheffler", "Polk", "McMillan", + "CrownHill", "Memorial", "TechState", "Garden", + "Moon", "Barn" + }; + + Common::String courtFileName = Common::String::format("data/courts/%s.cof", courtNames[args[0] - 1]); + + Common::File file; + if (!file.open(courtFileName)) + error("Could not open file '%s'", courtFileName.c_str()); + + debug(0, "Loading court data from '%s'", courtFileName.c_str()); + + // First, read in the header + file.readUint32LE(); // Header size (?) + + char version[6]; + file.read(version, 5); + version[5] = 0; + + if (strcmp(version, "01.05")) + error("Invalid court version field: %s", version); + + uint32 objectCount = file.readUint32LE(); + + for (uint32 i = 0; i < objectCount; i++) { + char nameBuf[100]; + memset(nameBuf, 0, sizeof(nameBuf)); + + uint32 nameLength = file.readUint32LE(); + assert(nameLength < sizeof(nameBuf) - 1); + file.read(nameBuf, nameLength); + + CourtObject object; + object.name = nameBuf; + object.type = (CourtObjectType)file.readUint32LE(); + for (uint32 j = 0; j < 10; j++) + object.data[j] = file.readUint32LE(); + + debug(1, "Found court object '%s' - Type %d", nameBuf, object.type); + + // Store backboard object indices for later + if (object.type == kObjectTypeBackboard) { + if (object.data[7] + object.data[4] / 2 >= 6000) + _backboardObjectRight = i; + else + _backboardObjectLeft = i; + } + + _courtObjects.push_back(object); + } + + // TODO: Some other variables are initialized with constants here + + return 1; +} + +int LogicHEbasketball::op_1053() { + _courtObjects.clear(); + // TODO: This also calls op_1065 with one argument (5) + + return 1; +} + LogicHE *makeLogicHEbasketball(ScummEngine_v90he *vm) { return new LogicHEbasketball(vm); } |