From 66ef127280debf3586ee1074b50fa193eb03d81e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 Nov 2012 00:28:01 +0100 Subject: HOPKINS: Implement Charge_Credits() --- engines/hopkins/globals.cpp | 2 ++ engines/hopkins/globals.h | 2 ++ engines/hopkins/hopkins.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 8cfa830c4d..ef400b7865 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -192,6 +192,8 @@ Globals::Globals() { Credit_lignes = 0; memset(Credit, 0, 12000); Credit_step = 0; + Credit_l = 0; + Credit_h = 0; OCEAN_SENS = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index c9cda8fbcb..6a8deecffb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -460,6 +460,8 @@ public: int Credit_lignes; byte Credit[12000]; int Credit_step; + int Credit_l; + int Credit_h; int OCEAN_SENS; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index c6ee0ac530..19c59fd24e 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2365,7 +2365,71 @@ int HopkinsEngine::PWBASE() { } void HopkinsEngine::Charge_Credits() { - warning("STUB - Charge_Credits()"); + warning("Charge_Credits()"); + + char v0; // al@3 + int v1; // edx@5 + __int16 v2; // cx@5 + byte *v3; // ebx@5 + char v4; // al@6 + __int16 v5; // cx@14 + __int16 v7; // [sp+10h] [bp-10h]@1 + char v8; // [sp+14h] [bp-Ch]@1 + byte *v9; // [sp+18h] [bp-8h]@1 + byte *ptr; // [sp+1Ch] [bp-4h]@1 + + _globals.Credit_y = 440; + _globals.Credit_l = 10; + _globals.Credit_h = 40; + _globals.Credit_step = 45; + _fileManager.CONSTRUIT_FICHIER(_globals.HOPLINK, "CREAN.TXT"); + ptr = _fileManager.CHARGE_FICHIER(_globals.NFICHIER); + v9 = ptr; + v7 = 0; + v8 = 0; + do { + if (*v9 == 37) { + v0 = *(v9 + 1); + if (v0 == 37) { + v8 = 1; + goto LABEL_13; + } + v1 = 60 * v7; + _globals.Credit[v1 + 1] = v0; + _globals.Credit[v1] = 1; +// *(_DWORD *)(v1 + _globals.Credit[4]) = _globals.Credit_y + v7 * _globals.Credit_step; + _globals.Credit[4 + v1] = _globals.Credit_y + v7 * _globals.Credit_step & 0xFF; + _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 8 & 0xFF; + _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 16 & 0xFF; + _globals.Credit[4 + v1 + 1] = (_globals.Credit_y + v7 * _globals.Credit_step) >> 24 & 0xFF; + v2 = 0; + v3 = &_globals.Credit[v1]; + while (1) { + v4 = *(v9 + v2 + 3); + if (v4 == 37 || v4 == 10) + break; + v3[v2++ + 10] = v4; + if (v2 > 49) + goto LABEL_11; + } + v3[v2 + 10] = 0; +// *(_WORD *)&_globals.Credit[60 * v7 + 8] = v2 - 1; + _globals.Credit[60 * v7 + 8] = (v2 - 1) & 0xFF; + _globals.Credit[60 * v7 + 9] = ((v2 - 1) >> 8) & 0xFF; +LABEL_11: + ++v7; + } + _globals.Credit_lignes = v7; +LABEL_13: + v9 = v9 + 1; + } while (v8 != 1); + v5 = 0; + if (_globals.Credit_lignes > 0) { + do + ++v5; + while (v5 < _globals.Credit_lignes); + } + _globals.dos_free2(ptr); } void HopkinsEngine::CREDIT_AFFICHE(int startPosY, byte *buffer, char colour) { -- cgit v1.2.3