- Added handling for hue changes (OnStaticHued)

This commit is contained in:
Andreas Schneider 2009-08-03 18:55:54 +02:00
parent a71c1bd570
commit 2ea8601402
1 changed files with 17 additions and 1 deletions

View File

@ -319,6 +319,7 @@ type
procedure OnNewBlock(ABlock: TBlock); procedure OnNewBlock(ABlock: TBlock);
procedure OnStaticDeleted(AStaticItem: TStaticItem); procedure OnStaticDeleted(AStaticItem: TStaticItem);
procedure OnStaticElevated(AStaticItem: TStaticItem); procedure OnStaticElevated(AStaticItem: TStaticItem);
procedure OnStaticHued(AStaticItem: TStaticItem);
procedure OnStaticInserted(AStaticItem: TStaticItem); procedure OnStaticInserted(AStaticItem: TStaticItem);
procedure OnTileRemoved(ATile: TMulBlock); procedure OnTileRemoved(ATile: TMulBlock);
public public
@ -726,6 +727,7 @@ begin
FLandscape.OnNewBlock := @OnNewBlock; FLandscape.OnNewBlock := @OnNewBlock;
FLandscape.OnStaticDeleted := @OnStaticDeleted; FLandscape.OnStaticDeleted := @OnStaticDeleted;
FLandscape.OnStaticElevated := @OnStaticElevated; FLandscape.OnStaticElevated := @OnStaticElevated;
FLandscape.OnStaticHued := @OnStaticHued;
FLandscape.OnStaticInserted := @OnStaticInserted; FLandscape.OnStaticInserted := @OnStaticInserted;
FTextureManager := TLandTextureManager.Create; FTextureManager := TLandTextureManager.Create;
@ -1650,7 +1652,6 @@ begin
glViewport(0, 0, oglGameWindow.Width, oglGameWindow.Height); glViewport(0, 0, oglGameWindow.Width, oglGameWindow.Height);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity; glLoadIdentity;
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
gluOrtho2D(0, oglGameWindow.Width, oglGameWindow.Height, 0); gluOrtho2D(0, oglGameWindow.Width, oglGameWindow.Height, 0);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity; glLoadIdentity;
@ -2044,6 +2045,21 @@ begin
FScreenBufferIndexed := False; FScreenBufferIndexed := False;
end; end;
procedure TfrmMain.OnStaticHued(AStaticItem: TStaticItem);
var
blockInfo: PBlockInfo;
begin
blockInfo := nil;
while FScreenBuffer.Iterate(blockInfo) do
begin
if blockInfo^.Item = AStaticItem then
begin
PrepareScreenBlock(blockInfo);
Break;
end;
end;
end;
procedure TfrmMain.OnStaticInserted(AStaticItem: TStaticItem); procedure TfrmMain.OnStaticInserted(AStaticItem: TStaticItem);
begin begin
if (AStaticItem.X >= FX + FLowOffsetX) and (AStaticItem.X <= FX + FHighOffsetX) and if (AStaticItem.X >= FX + FLowOffsetX) and (AStaticItem.X <= FX + FHighOffsetX) and