Fix Task 11 sprite recovery and declaration boundaries
Sync changed files to Google Drive / sync (push) Successful in 31s
Sync changed files to Google Drive / sync (push) Successful in 31s
This commit is contained in:
1 parent
8ffff2f916
commit
ae47dc8a3f
3 files changed
+53
-28
No files matched your search
@@ -173,7 +173,6 @@ var
|
|||||||
{Gameplay display}
|
{Gameplay display}
|
||||||
SHOW_UNITS_IN_HOUSE :Boolean = False; //Should we hide units when they are in house ?
|
SHOW_UNITS_IN_HOUSE :Boolean = False; //Should we hide units when they are in house ?
|
||||||
IGNORE_MOUSE_SCROLLING :Boolean = False; //Ignore mouse scrolling
|
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_SOUND :Boolean = False; //Skip all the sounds in favor of faster logic
|
||||||
SKIP_LOADING_CURSOR :Boolean = False; //Skip loading and setting cursor
|
SKIP_LOADING_CURSOR :Boolean = False; //Skip loading and setting cursor
|
||||||
SKIP_SETTINGS_SAVE :Boolean = False; //Skip save main/game settings into the ini file
|
SKIP_SETTINGS_SAVE :Boolean = False; //Skip save main/game settings into the ini file
|
||||||
|
|||||||
@@ -205,22 +205,6 @@ type
|
|||||||
procedure UpdateStateIdle;
|
procedure UpdateStateIdle;
|
||||||
end;
|
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
|
TKMTexCoords = record
|
||||||
TexID: Cardinal;
|
TexID: Cardinal;
|
||||||
u1,v1,u2,v2: Single; //Top-Left, Bottom-Right uv coords
|
u1,v1,u2,v2: Single; //Top-Left, Bottom-Right uv coords
|
||||||
@@ -249,6 +233,23 @@ uses
|
|||||||
KM_CommonUtils, KM_Utils, KM_Points,
|
KM_CommonUtils, KM_Utils, KM_Points,
|
||||||
KM_GameSettings;
|
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
|
const
|
||||||
MAX_GAME_ATLAS_SIZE = 2048; //Max atlas size for KaM. No need for bigger atlases
|
MAX_GAME_ATLAS_SIZE = 2048; //Max atlas size for KaM. No need for bigger atlases
|
||||||
OVERLOAD_SKIP_MASK = 'skip';
|
OVERLOAD_SKIP_MASK = 'skip';
|
||||||
@@ -1918,7 +1919,6 @@ begin
|
|||||||
ClearGameResourceCPUPreparation(RT);
|
ClearGameResourceCPUPreparation(RT);
|
||||||
raise Exception.Create('Invalid game sprite publication state');
|
raise Exception.Create('Invalid game sprite publication state');
|
||||||
end;
|
end;
|
||||||
{$IFNDEF NO_OGL}
|
|
||||||
if not TKMRender.TextureBackendReady then Exit;
|
if not TKMRender.TextureBackendReady then Exit;
|
||||||
try
|
try
|
||||||
SetLength(gGFXData[RT], fSprites[RT].fRXData.Count + 1);
|
SetLength(gGFXData[RT], fSprites[RT].fRXData.Count + 1);
|
||||||
@@ -1928,9 +1928,6 @@ begin
|
|||||||
raise;
|
raise;
|
||||||
end;
|
end;
|
||||||
ClearGameResourceCPUPreparation(RT);
|
ClearGameResourceCPUPreparation(RT);
|
||||||
{$ELSE}
|
|
||||||
ClearGameResourceCPUPreparation(RT);
|
|
||||||
{$ENDIF}
|
|
||||||
if fGameRXIndex = fGamePublishedThroughIndex + 1 then
|
if fGameRXIndex = fGamePublishedThroughIndex + 1 then
|
||||||
fGamePublishedThroughIndex := fGameRXIndex;
|
fGamePublishedThroughIndex := fGameRXIndex;
|
||||||
fGameRecoveryPending[RT] := False;
|
fGameRecoveryPending[RT] := False;
|
||||||
@@ -1966,6 +1963,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
fGameRXIndex := 0; fGameRequestState := grsAcquire;
|
fGameRXIndex := 0; fGameRequestState := grsAcquire;
|
||||||
end;
|
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
|
if fGameRequestState = grsAcquire then
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
@@ -2029,9 +2044,22 @@ begin
|
|||||||
raise;
|
raise;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if fGameRXIndex < fGameRXTypes.Count - 1 then begin Inc(fGameRXIndex); fGameRequestState := grsAcquire; Exit end;
|
if fGamePublishedThroughIndex < fGameRXTypes.Count - 1 then
|
||||||
for I := 0 to fGamePublishedThroughIndex do
|
begin
|
||||||
if fGameRecoveryPending[TRXType(StrToInt(fGameRXTypes[I]))] then begin fGameRXIndex := I; fGameRequestState := grsAcquire; Exit end;
|
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;
|
fGameRXIndex := -1; fGameRequestState := grsReady;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -2046,12 +2074,8 @@ begin
|
|||||||
for I := 0 to fGamePublishedThroughIndex do
|
for I := 0 to fGamePublishedThroughIndex do
|
||||||
fGameRecoveryPending[TRXType(StrToInt(fGameRXTypes[I]))] := True;
|
fGameRecoveryPending[TRXType(StrToInt(fGameRXTypes[I]))] := True;
|
||||||
if (fGameRequestState = grsReady) and (fGamePublishedThroughIndex >= 0) then
|
if (fGameRequestState = grsReady) and (fGamePublishedThroughIndex >= 0) then
|
||||||
begin
|
|
||||||
fGameRXIndex := 0;
|
|
||||||
fGameRequestState := grsAcquire;
|
|
||||||
AdvanceGameResourceRequest;
|
AdvanceGameResourceRequest;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
//Try to load RXX first, then RX, then use Folder
|
//Try to load RXX first, then RX, then use Folder
|
||||||
|
|||||||
@@ -272,6 +272,8 @@ type
|
|||||||
rxCustom, //Used for loading stuff like campaign maps (there is no main RXX file)
|
rxCustom, //Used for loading stuff like campaign maps (there is no main RXX file)
|
||||||
rxTiles //Tiles
|
rxTiles //Tiles
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const
|
||||||
//Colors to paint beneath player color areas (flags)
|
//Colors to paint beneath player color areas (flags)
|
||||||
//The blacker/whiter - the more contrast player color will be
|
//The blacker/whiter - the more contrast player color will be
|
||||||
FLAG_COLOR_DARK = $FF101010; //Dark-grey (Black)
|
FLAG_COLOR_DARK = $FF101010; //Dark-grey (Black)
|
||||||
|
|||||||
Reference in new issue
Block a user