Revision 157:0b95089e72d4 Client/UfrmMain.pas
| b/Client/UfrmMain.pas | ||
|---|---|---|
| 69 | 69 |
acFlat: TAction; |
| 70 | 70 |
acNoDraw: TAction; |
| 71 | 71 |
acLightlevel: TAction; |
| 72 |
acWalkable: TAction; |
|
| 72 | 73 |
acUndo: TAction; |
| 73 | 74 |
acVirtualLayer: TAction; |
| 74 | 75 |
ActionList1: TActionList; |
| ... | ... | |
| 149 | 150 |
tbNoDraw: TToolButton; |
| 150 | 151 |
tbSeparator2: TToolButton; |
| 151 | 152 |
tbUndo: TToolButton; |
| 152 |
ToolButton1: TToolButton; |
|
| 153 |
tbLightlevel: TToolButton; |
|
| 154 |
tbWalkable: TToolButton; |
|
| 153 | 155 |
tsLocations: TTabSheet; |
| 154 | 156 |
tbSetHue: TToolButton; |
| 155 | 157 |
tmGrabTileInfo: TTimer; |
| ... | ... | |
| 190 | 192 |
procedure acSelectExecute(Sender: TObject); |
| 191 | 193 |
procedure acUndoExecute(Sender: TObject); |
| 192 | 194 |
procedure acVirtualLayerExecute(Sender: TObject); |
| 195 |
procedure acWalkableExecute(Sender: TObject); |
|
| 193 | 196 |
procedure ApplicationProperties1Idle(Sender: TObject; var Done: Boolean); |
| 194 | 197 |
procedure ApplicationProperties1ShowHint(var HintStr: string; |
| 195 | 198 |
var CanShow: Boolean; var HintInfo: THintInfo); |
| ... | ... | |
| 525 | 528 |
procedure TfrmMain.oglGameWindowKeyDown(Sender: TObject; var Key: Word; |
| 526 | 529 |
Shift: TShiftState); |
| 527 | 530 |
begin |
| 531 |
if Shift <> [] then |
|
| 532 |
Exit; |
|
| 533 |
|
|
| 528 | 534 |
case Key of |
| 529 | 535 |
VK_W, VK_NUMPAD8, VK_UP: |
| 530 | 536 |
MoveBy(-8, -8); |
| ... | ... | |
| 1125 | 1131 |
frmVirtualLayer.Show; |
| 1126 | 1132 |
end; |
| 1127 | 1133 |
|
| 1134 |
procedure TfrmMain.acWalkableExecute(Sender: TObject); |
|
| 1135 |
begin |
|
| 1136 |
InvalidateFilter; |
|
| 1137 |
FRepaintNeeded := True; |
|
| 1138 |
end; |
|
| 1139 |
|
|
| 1128 | 1140 |
procedure TfrmMain.acDrawExecute(Sender: TObject); |
| 1129 | 1141 |
begin |
| 1130 | 1142 |
acDraw.Checked := True; |
| ... | ... | |
| 2311 | 2323 |
procedure TfrmMain.Render; |
| 2312 | 2324 |
var |
| 2313 | 2325 |
highlight: Boolean; |
| 2314 |
intensity: GLfloat; |
|
| 2326 |
intensity, red, green, blue: GLfloat;
|
|
| 2315 | 2327 |
blockInfo: PBlockInfo; |
| 2316 | 2328 |
item: TWorldItem; |
| 2317 | 2329 |
begin |
| ... | ... | |
| 2345 | 2357 |
SetDarkLights; |
| 2346 | 2358 |
end; |
| 2347 | 2359 |
|
| 2360 |
case blockInfo^.WalkRestriction of |
|
| 2361 |
wrNone: |
|
| 2362 |
begin |
|
| 2363 |
red := 1; |
|
| 2364 |
green := 1; |
|
| 2365 |
blue := 1; |
|
| 2366 |
end; |
|
| 2367 |
wrCanWalk: |
|
| 2368 |
begin |
|
| 2369 |
red := 0.5; |
|
| 2370 |
green := 1; |
|
| 2371 |
blue := 0.5; |
|
| 2372 |
end; |
|
| 2373 |
wrCannotWalk: |
|
| 2374 |
begin |
|
| 2375 |
red := 1; |
|
| 2376 |
green := 0.5; |
|
| 2377 |
blue := 0.5; |
|
| 2378 |
end; |
|
| 2379 |
end; |
|
| 2380 |
|
|
| 2348 | 2381 |
if blockInfo^.Translucent then |
| 2349 |
glColor4f(intensity, intensity, intensity, 0.8)
|
|
| 2382 |
glColor4f(intensity * red, intensity * green, intensity * blue, 0.8)
|
|
| 2350 | 2383 |
else |
| 2351 |
glColor4f(intensity, intensity, intensity, 1.0);
|
|
| 2384 |
glColor4f(intensity * red, intensity * green, intensity * blue, 1.0);
|
|
| 2352 | 2385 |
|
| 2353 | 2386 |
highlight := blockInfo^.Highlighted and item.CanBeEdited; |
| 2354 | 2387 |
|
| ... | ... | |
| 2362 | 2395 |
begin |
| 2363 | 2396 |
glBindTexture(GL_TEXTURE_2D, blockInfo^.HighRes.Texture); |
| 2364 | 2397 |
|
| 2365 |
if not highlight then |
|
| 2398 |
if not highlight and (blockInfo^.WalkRestriction = wrNone) then
|
|
| 2366 | 2399 |
glEnable(GL_LIGHTING); |
| 2367 | 2400 |
|
| 2368 | 2401 |
glBegin(GL_QUADS); |
| ... | ... | |
| 2376 | 2409 |
glTexCoord2i(1, 0); glVertex2iv(@blockInfo^.DrawQuad[1]); |
| 2377 | 2410 |
glEnd; |
| 2378 | 2411 |
|
| 2379 |
if not highlight then |
|
| 2412 |
if not highlight and (blockInfo^.WalkRestriction = wrNone) then
|
|
| 2380 | 2413 |
glDisable(GL_LIGHTING); |
| 2381 | 2414 |
end else |
| 2382 | 2415 |
begin |
| ... | ... | |
| 2722 | 2755 |
procedure TfrmMain.UpdateFilter; |
| 2723 | 2756 |
var |
| 2724 | 2757 |
blockInfo: PBlockInfo; |
| 2758 |
tileData: TTiledata; |
|
| 2759 |
staticTileData: TStaticTileData; |
|
| 2760 |
lastSurface: PBlockInfo; |
|
| 2761 |
surfaceTop: Integer; |
|
| 2725 | 2762 |
begin |
| 2726 | 2763 |
blockInfo := nil; |
| 2764 |
lastSurface := nil; |
|
| 2727 | 2765 |
while FScreenBuffer.Iterate(blockInfo) do |
| 2728 | 2766 |
begin |
| 2729 | 2767 |
if blockInfo^.State in [ssNormal, ssFiltered] then |
| ... | ... | |
| 2739 | 2777 |
begin |
| 2740 | 2778 |
blockInfo^.State := ssFiltered; |
| 2741 | 2779 |
end; |
| 2780 |
|
|
| 2781 |
blockInfo^.WalkRestriction := wrNone; |
|
| 2782 |
if acWalkable.Checked then |
|
| 2783 |
begin |
|
| 2784 |
if blockInfo^.Item is TMapCell then |
|
| 2785 |
begin |
|
| 2786 |
tileData := ResMan.Tiledata.LandTiles[blockInfo^.Item.TileID]; |
|
| 2787 |
if tdfImpassable in tileData.Flags then |
|
| 2788 |
begin |
|
| 2789 |
blockInfo^.WalkRestriction := wrCannotWalk; |
|
| 2790 |
lastSurface := nil; |
|
| 2791 |
end else |
|
| 2792 |
begin |
|
| 2793 |
blockInfo^.WalkRestriction := wrCanWalk; |
|
| 2794 |
lastSurface := blockInfo; |
|
| 2795 |
surfaceTop := blockInfo^.Item.Z; |
|
| 2796 |
end; |
|
| 2797 |
end else |
|
| 2798 |
begin |
|
| 2799 |
staticTileData := ResMan.Tiledata.StaticTiles[blockInfo^.Item.TileID]; |
|
| 2800 |
if (lastSurface <> nil) and (lastSurface^.WalkRestriction = wrCanWalk) and |
|
| 2801 |
(lastSurface^.Item.X = blockInfo^.Item.X) and |
|
| 2802 |
(lastSurface^.Item.Y = blockInfo^.Item.Y) and ([tdfSurface, |
|
| 2803 |
tdfImpassable] * staticTileData.Flags <> []) then |
|
| 2804 |
begin |
|
| 2805 |
if (blockInfo^.Item.Z < surfaceTop + 16) and |
|
| 2806 |
((blockInfo^.Item.Z > lastSurface^.Item.Z + 2) or |
|
| 2807 |
not (tdfSurface in staticTileData.Flags)) then |
|
| 2808 |
lastSurface^.WalkRestriction := wrCannotWalk; |
|
| 2809 |
end; |
|
| 2810 |
|
|
| 2811 |
if tdfSurface in staticTileData.Flags then |
|
| 2812 |
begin |
|
| 2813 |
if tdfImpassable in staticTileData.Flags then |
|
| 2814 |
begin |
|
| 2815 |
blockInfo^.WalkRestriction := wrCannotWalk; |
|
| 2816 |
lastSurface := nil; |
|
| 2817 |
end else |
|
| 2818 |
begin |
|
| 2819 |
blockInfo^.WalkRestriction := wrCanWalk; |
|
| 2820 |
lastSurface := blockInfo; |
|
| 2821 |
surfaceTop := blockInfo^.Item.Z + staticTileData.Height; |
|
| 2822 |
end; |
|
| 2823 |
end; |
|
| 2824 |
end; |
|
| 2825 |
end; //acWalkable.Checked |
|
| 2826 |
|
|
| 2742 | 2827 |
end; |
| 2743 | 2828 |
end; |
| 2829 |
|
|
| 2744 | 2830 |
Include(FScreenBufferState, sbsFiltered); |
| 2745 | 2831 |
|
| 2746 | 2832 |
if (FLightManager.LightLevel > 0) and not acFlat.Checked then |
Also available in: Unified diff