Fix Task 11 sprite recovery and declaration boundaries
Sync changed files to Google Drive / sync (push) Successful in 31s

This commit is contained in:
admin_d committed 2026-10-09 09:47:11 +05:00
1 parent 8ffff2f916
commit ae47dc8a3f
3 files changed
+53 -28

No files matched your search

@@ -173,7 +173,6 @@ var
{Gameplay display}
SHOW_UNITS_IN_HOUSE :Boolean = False; //Should we hide units when they are in house ?
IGNORE_MOUSE_SCROLLING :Boolean = False; //Ignore mouse scrolling
SKIP_RENDER :Boolean = False; //Skip all the rendering in favor of faster logic
SKIP_SOUND :Boolean = False; //Skip all the sounds in favor of faster logic
SKIP_LOADING_CURSOR :Boolean = False; //Skip loading and setting cursor
SKIP_SETTINGS_SAVE :Boolean = False; //Skip save main/game settings into the ini file
@@ -205,22 +205,6 @@ type
procedure UpdateStateIdle;
end;
TKMGameResourceWorker = class(TThread)
private
fOwner: TKMResSprites;
fSerial: QWord;
fRT: TRXType;
fAlphaShadows: Boolean;
fInput: TStream;
fInputIsRXA: Boolean;
function IsTerminated: Boolean;
procedure Complete(aOutcome: TKMGameResourceWorkerOutcome; const aClass, aMessage: string);
public
constructor Create(aOwner: TKMResSprites; aSerial: QWord; aRT: TRXType; aAlphaShadows, aInputIsRXA: Boolean; aInput: TStream);
destructor Destroy; override;
procedure Execute; override;
end;
TKMTexCoords = record
TexID: Cardinal;
u1,v1,u2,v2: Single; //Top-Left, Bottom-Right uv coords
@@ -249,6 +233,23 @@ uses
KM_CommonUtils, KM_Utils, KM_Points,
KM_GameSettings;
type
TKMGameResourceWorker = class(TThread)
private
fOwner: TKMResSprites;
fSerial: QWord;
fRT: TRXType;
fAlphaShadows: Boolean;
fInput: TStream;
fInputIsRXA: Boolean;
function IsTerminated: Boolean;
procedure Complete(aOutcome: TKMGameResourceWorkerOutcome; const aClass, aMessage: string);
public
constructor Create(aOwner: TKMResSprites; aSerial: QWord; aRT: TRXType; aAlphaShadows, aInputIsRXA: Boolean; aInput: TStream);
destructor Destroy; override;
procedure Execute; override;
end;
const
MAX_GAME_ATLAS_SIZE = 2048; //Max atlas size for KaM. No need for bigger atlases
OVERLOAD_SKIP_MASK = 'skip';
@@ -1918,7 +1919,6 @@ begin
ClearGameResourceCPUPreparation(RT);
raise Exception.Create('Invalid game sprite publication state');
end;
{$IFNDEF NO_OGL}
if not TKMRender.TextureBackendReady then Exit;
try
SetLength(gGFXData[RT], fSprites[RT].fRXData.Count + 1);
@@ -1928,9 +1928,6 @@ begin
raise;
end;
ClearGameResourceCPUPreparation(RT);
{$ELSE}
ClearGameResourceCPUPreparation(RT);
{$ENDIF}
if fGameRXIndex = fGamePublishedThroughIndex + 1 then
fGamePublishedThroughIndex := fGameRXIndex;
fGameRecoveryPending[RT] := False;
@@ -1966,6 +1963,24 @@ begin
end;
fGameRXIndex := 0; fGameRequestState := grsAcquire;
end;
if fGameRequestState = grsReady then
begin
for I := 0 to fGameRXTypes.Count - 1 do
begin
RT := TRXType(StrToInt(fGameRXTypes[I]));
if fGameRecoveryPending[RT] then
begin
fGameRXIndex := I;
fGameRequestState := grsAcquire;
Break;
end;
end;
if fGameRequestState = grsReady then
begin
fGameRXIndex := -1;
Exit;
end;
end;
if fGameRequestState = grsAcquire then
begin
try
@@ -2029,9 +2044,22 @@ begin
raise;
end;
end;
if fGameRXIndex < fGameRXTypes.Count - 1 then begin Inc(fGameRXIndex); fGameRequestState := grsAcquire; Exit end;
for I := 0 to fGamePublishedThroughIndex do
if fGameRecoveryPending[TRXType(StrToInt(fGameRXTypes[I]))] then begin fGameRXIndex := I; fGameRequestState := grsAcquire; Exit end;
if fGamePublishedThroughIndex < fGameRXTypes.Count - 1 then
begin
fGameRXIndex := fGamePublishedThroughIndex + 1;
fGameRequestState := grsAcquire;
Exit;
end;
for I := 0 to fGameRXTypes.Count - 1 do
begin
RT := TRXType(StrToInt(fGameRXTypes[I]));
if fGameRecoveryPending[RT] then
begin
fGameRXIndex := I;
fGameRequestState := grsAcquire;
Exit;
end;
end;
fGameRXIndex := -1; fGameRequestState := grsReady;
end;
end;
@@ -2046,11 +2074,7 @@ begin
for I := 0 to fGamePublishedThroughIndex do
fGameRecoveryPending[TRXType(StrToInt(fGameRXTypes[I]))] := True;
if (fGameRequestState = grsReady) and (fGamePublishedThroughIndex >= 0) then
begin
fGameRXIndex := 0;
fGameRequestState := grsAcquire;
AdvanceGameResourceRequest;
end;
end;
@@ -272,6 +272,8 @@ type
rxCustom, //Used for loading stuff like campaign maps (there is no main RXX file)
rxTiles //Tiles
);
const
//Colors to paint beneath player color areas (flags)
//The blacker/whiter - the more contrast player color will be
FLAG_COLOR_DARK = $FF101010; //Dark-grey (Black)