Fix bug causing an error when the sum of squares of stats exceeded 0x7FFFFFFF. And:

Restore file extension pq.
Bump version to 6.4 (6.3 wasn't officially released but has been used in ports.)
Turbo mode for testing.
Limit the number of fancy items won to keep the Invetory not too huge
This commit is contained in:
Eric Fredricksen
2022-01-04 20:48:35 -08:00
parent d611931e37
commit a0e0d53739
Executable → Regular
+28 -12
View File
@@ -1,8 +1,9 @@
unit Main; unit Main;
{ copyright (c)2002 Eric Fredricksen all rights reserved } { copyright (c)2022 Eric Fredricksen all rights reserved }
{$DEFINE CHEATS} {$DEFINE CHEATS}
{$UNDEF LOGGING} {$UNDEF LOGGING}
{$DEFINE TURBO}
interface interface
@@ -12,14 +13,16 @@ uses
const const
// revs: // revs:
// 5: pq 6.3 // 7: pq 6.4
// 6: pq-web
// 5: pq 6.3 (no official release)
// 4: pq 6.2 // 4: pq 6.2
// 3: pq 6.1 // 3: pq 6.1
// 2: pq 6.0 // 2: pq 6.0
// 1: pq 6.0, some early release I guess; don't remember // 1: pq 6.0, some early release I guess; don't remember
RevString = '&rev=5'; RevString = '&rev=7';
wmIconTray = WM_USER + Ord('t'); wmIconTray = WM_USER + Ord('t');
kFileExt = '.pq3'; kFileExt = '.pq';
type type
TMainForm = class(TForm) TMainForm = class(TForm)
@@ -719,11 +722,13 @@ begin
if SubItems.Count < 1 if SubItems.Count < 1
then SubItems.Add(value) then SubItems.Add(value)
else SubItems[0] := value; else SubItems[0] := value;
Selected := true;
MakeVisible(false);
end; end;
//list.MultiSelect := true; //list.MultiSelect := true;
//list.RowSelect := true; //list.RowSelect := true;
//list.HideSelection := false; //list.HideSelection := false;
list.Items[pos].Selected := true;
end; end;
function LevelUpTime(level: Integer): Integer; // seconds function LevelUpTime(level: Integer): Integer; // seconds
@@ -835,10 +840,13 @@ begin
t := 0; t := 0;
for i := 0 to 5 do Inc(t,Square(GetI(Stats,i))); for i := 0 to 5 do Inc(t,Square(GetI(Stats,i)));
t := Random(t); t := Random(t);
i := -1; if t < 0 then i := Random(Stats.Items.Count)
while t >= 0 do begin else begin
Inc(i); i := -1;
Dec(t,Square(GetI(Stats,i))); while t >= 0 do begin
Inc(i);
Dec(t,Square(GetI(Stats,i)));
end;
end; end;
end; end;
Add(Stats, Stats.Items[i].Caption, 1); Add(Stats, Stats.Items[i].Caption, 1);
@@ -863,7 +871,9 @@ end;
procedure TMainForm.WinItem; procedure TMainForm.WinItem;
begin begin
Add(Inventory, SpecialItem, 1); if max(250, Random(999)) < Inventory.Items.Count
then Add(Inventory, Inventory.Items[Random(Inventory.Items.Count)].Caption, 1)
else Add(Inventory, SpecialItem, 1);
end; end;
procedure TMainForm.CompleteQuest; procedure TMainForm.CompleteQuest;
@@ -1100,7 +1110,7 @@ begin
else WrLn( ' ' + Indefinite(Items[i].Caption, GetI(Inventory,i))); else WrLn( ' ' + Indefinite(Items[i].Caption, GetI(Inventory,i)));
WrLn; WrLn;
WrLn( '-- ' + DateTimeToStr(Now)); WrLn( '-- ' + DateTimeToStr(Now));
WrLn( '-- Progress Quest 6.2 - http://progressquest.com/'); WrLn( '-- Progress Quest 6.4 - http://progressquest.com/');
Result := f; Result := f;
end; end;
@@ -1226,6 +1236,9 @@ var
begin begin
gain := Pos('kill|',fTask.Caption) = 1; gain := Pos('kill|',fTask.Caption) = 1;
with TaskBar do begin with TaskBar do begin
{$IFDEF TURBO}
Position := Max;
{$ENDIF}
if Position >= Max then begin if Position >= Max then begin
ClearAllSelections; ClearAllSelections;
@@ -1337,7 +1350,7 @@ end;
const const
KUsage = KUsage =
'Usage: pq [flags] [game.pq3]'#10 + 'Usage: pq [flags] [game.pq]'#10 +
#10 + #10 +
'Flags:'#10 + 'Flags:'#10 +
' -no-backup Do not make a backup file when saving the game'#10 + ' -no-backup Do not make a backup file when saving the game'#10 +
@@ -1610,6 +1623,9 @@ var
const const
flat = 1; flat = 1;
begin begin
{$IFDEF TURBO}
Exit; // For testing multiplayer saves without hitting the server
{$ENDIF}
if FExportSheets then if FExportSheets then
ExportCharSheet; ExportCharSheet;
if GetPasskey = 0 then Exit; // not a online game! if GetPasskey = 0 then Exit; // not a online game!