Autor Beitrag
kompas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Do 01.07.10 12:27 
hallo!

mein projekt ist sehr groß, denn es betrift mehere dateien typ.

Also, ich habe der quelle code von einem fertiges programm (es funktioiert, aber nicht ganz für dies wie man es benötigt).

Also hier, liste ich mal, was alles des programm soll bearbeiten.

1) das programm soll 3DS file öffnen, und in ein bestimmtes gespeicherten spiel datei format speichern. So das am ende, mein 3D objekt in dem spiel kann benutzt werden.
Ebenso, soll das Program auch die Gespeicherten Dateien Files öffnen können, für sie anschauen zu können, für alle benötigung zu kennen, wie das spiel erfordert.

Also muss nicht nur das programm die Dateien öffnen können, aber auch sie Anzeigen können so das man eine Ansicht hat auf das Erzeugte 3D Model.

Für den moment, weis ich das dass spiel, Polytriangle mesh benötigt. Aber hier, bei der Beta version von dem programm, werden in dem 3D Viewer nur normale Polygon angezeigt. (keine Anzahlen von den Benutzen Poly, und noch weniger von den Vertices anzahlen, wie das objekt benutzt).
also für dies muss auch dann das programm noch umgeändert werden.

Ebenso, soll das program, die Richtigen Zugeteilte Texturen von dem 3D Model Anzeigen.

Also dies war mal als Vor Speise.
und so, mit was fange ich ann, euch anzuzeigen, als .pas File, denn sowie gesagt, es wurde ein beta version von dem programm bearbeitet, aber der programmer hört auf, denn er hat keine Erkenntnisse über die Grafik in den spiele.
Und so gab der programmer seine Geschriebenen Beta Quelle code frei, so dass man sie neu Umändern kann.

hier der anfang von dem Mainfm.pas file

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
unit MainFm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, AsphyreDef, AsphyreTimers, AsphyreFonts,
  AsphyreDevices, AsphyreImages, AsphyreCanvas, AsphyreDb, Asphyre2D,
  AsphyreSubsc;

const
 MaxSize     = 256;

type
 MapRec = record
  Heights: array[0..3of SmallInt;
  Light  : array[0..3of SmallInt;
 end;

 TLand = class
 private
  GridRColor,    // River
  GridGColor,    // Grid
  GridFColor,    // Farm
  GridLColor,    // LakeRect
  Grid0Color,
  Grid1Color,
  Grid2Color,
  Grid3Color,
  Grid4Color,
  Grid5Color,
  Grid6Color,
  Grid7Color,
  GridRasterColor,
  GridFFColor,
  GridUnsColor,                // color of grid unselected
  GridSelColor,                // cursor on grid
  GridMarkedColor   : TColor4; // grid marked
  Blendfkt          : cardinal;
public
  deltax,deltay     : integer;
  MapSize           : integer;
  BotX,BotY         : integer;
  RasterTags        : integer;
  SelGridX,SelGridY : integer; // selected grid coord
  river,farm,grid,lake,        // 4 fields
  g0,g1,g2,g3,
  g4,g5,g6,g7       : boolean; // 6 blockings
  SaveMap,                     // undo map
  Map         : array[0..MaxSize-10..MaxSize-1of MapRec;
  constructor Create();
  procedure ClearMap;
  function  SquareHeight(Xp, Yp, Corner: Integer): Integer;
  function  SquareLight(Xp, Yp, Corner: Integer): Integer;
  function  AverageHeight(Xp, Yp : Integer): Integer;
  procedure Render();
  procedure SetTileZoom(z : integer);  // get zoom factor for display
end;


also frage 1; benötigt hier, etwas umgeändert werden, so dass die 3DS files geladen können werden?
und ich habe noch vergessen, zu anzusagen, der viewer muss auch, in alle 3axis x,y und Z, sich umdrehen können, denn für den moment, kann man nur mist tastatur 90° winkel das 3D Model umdrehen. (nur eine Axis umdrehung)

denn hier, für 3ds file öffnen zu können, habe ich diesen quelle code gefunden.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
{
   Read 3DS File and view object...
  }

  unit Unit1;
  
   interface
  
   uses
     Windows, SysUtils, Classes, Controls, Forms,
     GLMisc, GLScene, GLVectorFileObjects, GLObjects, GLWin32Viewer;
  
   type
     TForm1 = class(TForm)
       GLSceneViewer1: TGLSceneViewer;
       GLScene1: TGLScene;
       GLCamera1: TGLCamera;
       GLLightSource1: TGLLightSource;
       DummyCube1: TDummyCube;
       FreeForm1: TFreeForm;
      GLCamera2: TGLCamera;
      procedure FormCreate(Sender: TObject);
  
     private
       { Private declarations }
     public
       { Public declarations }
     end;
  
   var
     Form1: TForm1;
  
   implementation
  
   {$R *.dfm}
  
   uses Geometry;
  
   procedure TForm1.FormCreate(Sender: TObject);
   begin
      // Read 3DS File...
      FreeForm1.LoadFromFile('.\media\tree10.3ds');
   end;
  
   end.


Also frage, muss diesen auch zu den Asphyre gelisteten zu geschreiben werden, oder muss von asphyre einigen weg getragen werden, so dass es kein karambolage geben zwischen mit diesen???

 GLMisc, GLScene, GLVectorFileObjects, GLObjects, GLWin32Viewer;

Moderiert von user profile iconKlabautermann: Code- durch Delphi-Tags ersetzt.

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

Also, hier, stelle ich mir jetzt richtig die Frage, ob der Problem von der Nicht Antworten, ob es von meinem projekt zussamen hängt, oder, ob es mein Schreibweisse ist.

Also neue frage.

ausblenden Quelltext
1:
2:
3:
4:
5:
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, AsphyreDef, AsphyreTimers, AsphyreFonts,
  AsphyreDevices, AsphyreImages, AsphyreCanvas, AsphyreDb, Asphyre2D,
  AsphyreSubsc;


muss zu diese Liste, diese neue liste zugesogen werden, in dem fall dass man 3DS files öffnen will?

GLMisc, GLScene, GLVectorFileObjects, GLObjects, GLWin32Viewer;
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Do 01.07.10 17:15 
Ich nehme an Deine schreibweise wird jeder mit Deiner vermuteten Herkunft entschuldigen.
Ich vermute eher daß es ein zu spezelles Thema ist.
kompas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Do 01.07.10 17:35 
hallo, bummi!

eher war mein erstes problem, das nicht richtige wort für meine frage, nicht gekennt!

Also meine Erste Frage, handelt sich um Funktionen, wie in einem Delphi programmation einbegriffen sind, ok? (jetzt glaube ich das ihr es besser versteht).


und so, habe ich, zwei untershiedlichen Funktionen.
Funkion 1 wie in dem Asphyre programm einbegriffen waren, und Funktion 2, die neue liste wie von dem quelle code kommt, für den 3DS files in das programm einzuziehen.

Also, kann ich diese neue Funktion Liste, zu den Alten von Asphyre funktionnen, zuziehen, oder werden, einigen funktion Bug mit eine Andere funktion bearbeiten?
Magic J
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66

WinXP Prof., Vista
Delphi6, Delphi 2009, Java(Eclipse), C++, Basic
BeitragVerfasst: Do 01.07.10 17:51 
hi und :welcome:

ich muss zugeben, deine Schreibweise macht es nicht wirklich leichter, aber ich denk ich habe inetwa deine Fragen verstanden:

Also, du möchtst eine Vertex-Datei(3ds) öffnen, visualisieren uns in ein anderes Datei-Format konvertieren können!

1. Das Öffnen ist das kleinste Problem!
Es gibt viele Komponenten die dafür fertige Funktionen bereitstellen.
Wenn ich das richtig erkenne, ist diese Funktion auch schon fertig ?!
ausblenden Delphi-Quelltext
1:
FreeForm1.LoadFromFile('.\media\tree10.3ds');					


2. Das Visualisieren wird für dich wahrscheinlich am schwersten sein.
Dein Vorgänger hat sich für die 3D-Engine "Asphyre" entschieden.
Die kenn ich persönlich nicht!

3. Für die Konvertierung in ein anderes 3D-Objekt-Format solltest du ersteimal wissen, wie diese Format genau aufgebaut ist!

Könntest du vielleicht mehr von dem Quellcode zeigen?
damit man sich ein genaueres Bild davon machen kann, wie weit dein Vorgänger mit dem programmieren vorrankam.

Gruß, Jonas
kompas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Do 01.07.10 18:50 
Ja, hallo und danke Magic.

Also ich kann alles Anzeigen wie er benötigt für mir eine Antwort zu geben.

Zitat:
Also, du möchtst eine Vertex-Datei(3ds) öffnen, visualisieren uns in ein anderes Datei-Format konvertieren können!

Ja, und noch ein weiteres mal Ja.

Es werdet ein 3D Editor für mein spiel sein.

Zitat:
2. Das Visualisieren wird für dich wahrscheinlich am schwersten sein.
Dein Vorgänger hat sich für die 3D-Engine "Asphyre" entschieden.
Die kenn ich persönlich nicht!


Also hier, bei 3DS Code, wurden diese weitere Gelistet.
GLMisc, GLScene, GLVectorFileObjects, GLObjects, GLWin32Viewer;

und hier, also ist der GLWin32Viewer gelistet, hier, also entweder der GL32 Viewer benutzen, oder dann der Asphyre engine, ist dies korrekt?

und hier also, ist der Volständige Quelle code von dem Mainfm.pas File.

Für den moment, macht der Program noch kleine Bug. Ist blos mal eine Beta Version.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
unit MainFm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, AsphyreDef, AsphyreTimers, AsphyreFonts,
  AsphyreDevices, AsphyreImages, AsphyreCanvas, AsphyreDb, Asphyre2D,
  AsphyreSubsc;

const
 MaxSize     = 256;

type
 MapRec = record
  Heights: array[0..3of SmallInt;
  Light  : array[0..3of SmallInt;
 end;

 TLand = class
 private
  GridRColor,    // River
  GridGColor,    // Grid
  GridFColor,    // Farm
  GridLColor,    // LakeRect
  Grid0Color,
  Grid1Color,
  Grid2Color,
  Grid3Color,
  Grid4Color,
  Grid5Color,
  Grid6Color,
  Grid7Color,
  GridRasterColor,
  GridFFColor,
  GridUnsColor,                // color of grid unselected
  GridSelColor,                // cursor on grid
  GridMarkedColor   : TColor4; // grid marked
  Blendfkt          : cardinal;
public
  deltax,deltay     : integer;
  MapSize           : integer;
  BotX,BotY         : integer;
  RasterTags        : integer;
  SelGridX,SelGridY : integer; // selected grid coord
  river,farm,grid,lake,        // 4 fields
  g0,g1,g2,g3,
  g4,g5,g6,g7       : boolean; // 6 blockings
  SaveMap,                     // undo map
  Map         : array[0..MaxSize-10..MaxSize-1of MapRec;
  constructor Create();
  procedure ClearMap;
  function  SquareHeight(Xp, Yp, Corner: Integer): Integer;
  function  SquareLight(Xp, Yp, Corner: Integer): Integer;
  function  AverageHeight(Xp, Yp : Integer): Integer;
  procedure Render();
  procedure SetTileZoom(z : integer);  // get zoom factor for display
end;

type
  TMapForm = class(TForm)
    Archive  : TASDb;
    Images   : TAsphyreImages;
    Fonts    : TAsphyreFonts;
    Timer    : TAsphyreTimer;
    Device   : TAsphyreDevice;
    MyCanvas : TAsphyreCanvas;
    procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
    procedure FormShow(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDestroy(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure TimerProcess(Sender: TObject);
    procedure TimerTimer(Sender: TObject);
    procedure DeviceRender(Sender: TObject);
    procedure DeviceInitialize(Sender: TObject; var success : boolean);
  private   { Private declarations }
  public    { Public declarations }
    Grid,DoBlend,DoHeight,DoNumbers : Boolean;
    Land                            : TLand;
    procedure SetMapSize(const i : integer);
    procedure SetTileCorners;
  end;

var MapForm: TMapForm;
    TileWidth,
    TileHeight,
    TileHWidth,
    TileHHeight : integer;

implementation
{$R *.dfm}
uses InfoUnit,InselGlobals;

var aTexCoord : TTexCoord;


procedure TMapForm.SetMapSize(const i : integer);
begin   // call after loading new island
  FillChar(Land.Map, SizeOf(Land.Map), 0);
  Land.MapSize    := i;   // 0..63
  Land.deltaX     := 0;
  Land.deltay     := 0;
end;

procedure TLand.ClearMap;
var i,j : integer;
begin
  FillChar(Map, SizeOf(Map), 0);
end;

procedure TLand.SetTileZoom(z : integer);
var i : integer;   // set tile size
begin
  deltaX := deltaX div TileHWidth;
  deltaY := deltaY div TileHheight;
  case z of
    0 : i := 120;
    1 : i := 84;
    2 : i := 60;
    3 : i := 40;
    4 : i := 32;
    5 : i := 24;
  end;
  TileWidth   :=  i;
  TileHeight  :=  i div 2;
  TileHWidth  :=  i div 2;
  TileHHeight :=  i div 4;
  BotX        := MapForm.ClientWidth;
  BotY        := MapForm.ClientHeight + 2*InfoForm.ZoomSpin.Value*TileHeight;
  deltaX      := deltaX * TileHWidth;
  deltaY      := deltaY * TileHHeight;
end;
{
 clWhite4  : TColor4 = ($FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF);
 clBlack4  : TColor4 = ($FF000000, $FF000000, $FF000000, $FF000000);
 clMaroon4 : TColor4 = ($FF000080, $FF000080, $FF000080, $FF000080);
 clGreen4  : TColor4 = ($FF008000, $FF008000, $FF008000, $FF008000);
 clOlive4  : TColor4 = ($FF008080, $FF008080, $FF008080, $FF008080);
 clNavy4   : TColor4 = ($FF800000, $FF800000, $FF800000, $FF800000);
 clPurple4 : TColor4 = ($FF800080, $FF800080, $FF800080, $FF800080);
 clTeal4   : TColor4 = ($FF808000, $FF808000, $FF808000, $FF808000);
 clGray4   : TColor4 = ($FF808080, $FF808080, $FF808080, $FF808080);
 clSilver4 : TColor4 = ($FFC0C0C0, $FFC0C0C0, $FFC0C0C0, $FFC0C0C0);
 clRed4    : TColor4 = ($FF0000FF, $FF0000FF, $FF0000FF, $FF0000FF);
 clLime4   : TColor4 = ($FF00FF00, $FF00FF00, $FF00FF00, $FF00FF00);
 clYellow4 : TColor4 = ($FF00FFFF, $FF00FFFF, $FF00FFFF, $FF00FFFF);
 clBlue4   : TColor4 = ($FFFF0000, $FFFF0000, $FFFF0000, $FFFF0000);
 clFuchsia4: TColor4 = ($FFFF00FF, $FFFF00FF, $FFFF00FF, $FFFF00FF);

 clAqua4   : TColor4 = ($FFFFFF00, $FFFFFF00, $FFFFFF00, $FFFFFF00);
 clLtGray4 : TColor4 = ($FFC0C0C0, $FFC0C0C0, $FFC0C0C0, $FFC0C0C0);
 clDkGray4 : TColor4 = ($FF808080, $FF808080, $FF808080, $FF808080);
 clOpaque4 : TColor4 = ($00FFFFFF, $00FFFFFF, $00FFFFFF, $00FFFFFF);
}

constructor TLand.Create();
begin
 inherited;
 FillChar(Map, SizeOf(Map), 0);
 TileWidth           :=  84;   // zoom = 1
 TileHeight          :=  42;
 TileHWidth          :=  42;
 TileHHeight         :=  21;
 SelGridX            := 0;
 SelGridY            := 0// selected grid coord
 GridRColor          := clAqua4;    // River
 GridGColor          := clGreen4;   // Grid
 GridFColor          := clLime4;    // Farm
 GridLColor          := clNavy4;    // LakeRect
 Grid0Color          := clAqua4;    // RiverBlockings
 Grid1Color          := clBlue4;    // RiverPathBlockings
 Grid2Color          := clYellow4;  // Coastlines
 Grid3Color          := clGray4;    // pathblocking
 Grid4Color          := clOlive4;   // buildblocking
 Grid5Color          := clYellow4;  // Coastblocking
 Grid6Color          := clFuchsia4; // PID
 Grid7Color          := clFuchsia4; // HID
 GridRasterColor     := clLime4;    // Raster points
 GridFFColor         := clAqua4;
 GridUnsColor        := clLtGray4;
 GridSelColor        := clRed4;
 GridMarkedColor     := clYellow4;
 MapSize             := MaxSize-1;
 BotX                := MapForm.ClientWidth;
 BotY                := MapForm.ClientHeight +
                        2*InfoForm.ZoomSpin.Value*TileHeight;
 Blendfkt            := fxBlend;
 deltaX              := 0;
 deltay              := 0;
 RasterTags          := 511;  // alle bits 0..8 an
end;

procedure TMapForm.SetTileCorners;
var i, j : integer;
begin
  for j := 0 to Land.MapSize-1 do     // Tileheightorigin = Punkt 0,0
     for i := 0 to Land.MapSize-1 do begin
       with Land do begin
         Map[i, j].Heights[1]     := Map[i+1, j].Heights[0];
         Map[i, j].Light[1]       := Map[i+1, j].Light[0];
         SaveMap[i, j].Heights[1] := Map[i+1, j].Heights[0];
         SaveMap[i, j].Light[1]   := Map[i+1, j].Light[0];
         Map[i, j].Heights[2]     := Map[i, j+1].Heights[0];
         Map[i, j].Light[2]       := Map[i, j+1].Light[0];
         SaveMap[i, j].Heights[2] := Map[i, j+1].Heights[0];
         saveMap[i, j].Light[2]   := Map[i, j+1].Light[0];
         Map[i, j].Heights[3]     := Map[i+1, j+1].Heights[0];
         Map[i, j].Light[3]       := Map[i+1, j+1].Light[0];
         SaveMap[i, j].Heights[3] := Map[i+1, j+1].Heights[0];
         SaveMap[i, j].Light[3]   := Map[i+1, j+1].Light[0];
       end;
     end;
end;

function  TLand.AverageHeight(Xp, Yp : Integer): Integer;
begin
  Result := (Map[Xp,Yp].Heights[0] + Map[Xp,Yp].Heights[1] +
       Map[Xp,Yp].Heights[2] + Map[Xp,Yp].Heights[3]) div 4;
end;

function TLand.SquareHeight(Xp, Yp, Corner : Integer): Integer;
begin
 if (Xp < 0then Xp := 0;
 if (Yp < 0then Yp := 0;
 if (Xp > MapSize - 1then Xp := MapSize - 1;
 if (Yp > MapSize - 1then Yp := MapSize - 1;
 Result := Map[Xp,Yp].Heights[Corner];
end;

function TLand.SquareLight(Xp, Yp, Corner : Integer): Integer;
begin
 if (Xp < 0then Xp :=0;
 if (Yp < 0then Yp :=0;
 if (Xp > MapSize - 1then Xp := MapSize - 1;
 if (Yp > MapSize - 1then Yp := MapSize - 1;
 Result := Map[Xp, Yp].Light[Corner];     // war [Yp,Xp]
end;

procedure TLand.Render();
var w, h, i, t, X, Y, Z, Xpos,Ypos, ori, dx,dy : integer;
begin
  {for Y := 0 to MapSize do   // render ground as lowest plane
    for X := 0 to MapSize do begin
       XPos := (X+Y) * TileHWidth + deltaX;
       if (Xpos >= -TileWidth) and (Xpos < BotX) then begin
         YPos := (Y-X) * TileHHeight + deltaY;
         if (YPos >= -TileHeight) and (Ypos < BotY) then begin
           if odd(IsoMap[X,Y].TileOri) then begin
            if IsoMap[X,Y].TileOri = 1 then
              MapForm.MyCanvas.TexMap(
              MapForm.Images[InfoForm.GetTexturNr(X,Y,Z)],
       Point4(Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight,
              Xpos + TileWidth , Ypos - SquareHeight(X,Y,3),
              Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight,
              Xpos             , Ypos - SquareHeight(X,Y,0)),
              cGray4(SquareLight(X,Y,0), SquareLight(X,Y,1),
                    SquareLight(X,Y,3),  SquareLight(X,Y,2)),
              InfoForm.GetPattern(X,Y,IsoMap[X,Y].TileOri),fxBlend)
            else  // tile ori 3
              MapForm.MyCanvas.TexMap(
              MapForm.Images[InfoForm.GetTexturNr(X,Y,Z)],
       Point4(Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight,
              Xpos             , Ypos - SquareHeight(X,Y,0),
              Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight,
              Xpos + TileWidth , Ypos - SquareHeight(X,Y,3)),
              cGray4(SquareLight(X,Y,0), SquareLight(X,Y,1),
                    SquareLight(X,Y,3),  SquareLight(X,Y,2)),
              InfoForm.GetPattern(X,Y,IsoMap[X,Y].TileOri),fxBlend);
           end else begin // tile or 0 or 2
              MapForm.MyCanvas.TexMap(
              MapForm.Images[InfoForm.GetTexturNr(X,Y,Z)],
       Point4(Xpos             , Ypos - SquareHeight(X,Y,0),
              Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight,
              Xpos + TileWidth , Ypos - SquareHeight(X,Y,3),
              Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight),
              cGray4(SquareLight(X,Y,0), SquareLight(X,Y,1),
                    SquareLight(X,Y,3),  SquareLight(X,Y,2)),
              InfoForm.GetPattern(X,Y,IsoMap[X,Y].TileOri),fxBlend);
           end;  // end GroundGFX
        end; // if in y-range
     end;
 end;     }

 // render grid as _last_ action only
 if MapForm.Grid then begin // render grid
  for Y := 0 to MapSize do
   for X := 0 to MapSize do begin
     XPos := (X+Y) * TileHWidth + deltaX;
     if (Xpos >= -TileWidth) and (Xpos < BotX) then begin
       YPos := (Y-X) * TileHHeight + deltaY;
       if (YPos >= -TileHHeight) and (Ypos < BotY) then begin
         if (X = SelGridX) and (Y = SelGridY) then
           MapForm.MyCanvas.Quad(
           Point4(Xpos+1      , Ypos - SquareHeight(X,Y,0),
           Xpos + TileHWidth  , Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
           Xpos + TileWidth-1 , Ypos - SquareHeight(X,Y,3),
           Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
           GridSelColor, fxNone) // show red cursor square
         else begin
           if IsoMap[X,Y].TileInRegion then
            MapForm.MyCanvas.Quad(
            Point4(Xpos +1    , Ypos - SquareHeight(X,Y,0),
            Xpos + TileHWidth , Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
            Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
            Xpos + TileHWidth , Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
            GridMarkedColor, fxNone)
           else begin
             if IsoMap[X,Y].RastID >= 0 then begin
               if IsoMap[X,Y].RastID and RasterTags > 0 then
               MapForm.MyCanvas.Quad(
               Point4(Xpos +1    , Ypos - SquareHeight(X,Y,0),
               Xpos + TileHWidth , Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
               Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
               Xpos + TileHWidth , Ypos - SquareHeight(X,Y,2) + TileHHeight-1),

               GridRasterColor, fxNone)
             end else begin

               if g0 and IsoMap[X,Y].Color[1then begin // RiverBlockings
                MapForm.MyCanvas.Quad(
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
                  Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
                  Grid0Color, fxNone)
               end else begin
                if g4 and IsoMap[X,Y].Color[5then begin // BuildBlockings
                MapForm.MyCanvas.Quad(
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
                  Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
                  Grid4Color, fxNone)
                end else begin
                 if g5 and IsoMap[X,Y].Color[6then begin // CoastBlockings
                 MapForm.MyCanvas.Quad(
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
                  Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
                  Grid5Color, fxNone)
                 end else begin
                 if g3 and IsoMap[X,Y].Color[4then begin // PathBlockings
                 MapForm.MyCanvas.Quad(
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
                  Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
                  Grid3Color, fxNone)
                 end else begin
                 if lake and IsoMap[X,Y].Color[8then begin // PathBlockings
                 MapForm.MyCanvas.Quad(
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
                  Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
                  GridLColor, fxNone)
                 end else begin
                 if g6 and IsoMap[X,Y].Color[9then begin // PID
                  MapForm.MyCanvas.Quad(
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
                  Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
                  Grid6Color, fxNone)
                 end else begin
                 if g7 and IsoMap[X,Y].Color[10then begin // HID

                  MapForm.MyCanvas.Quad(
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,1) - TileHHeight+1,
                  Xpos + TileWidth-1, Ypos - SquareHeight(X,Y,3),
                  Xpos + TileHWidth, Ypos - SquareHeight(X,Y,2) + TileHHeight-1),
                  Grid7Color, fxNone);
                  if IsoMap[X,Y].gsize > 1 then begin

                  MapForm.MyCanvas.Quad(                         // links
                  Point4(Xpos+1    , Ypos - SquareHeight(X,Y,0),
                  Xpos + IsoMap[X,Y].gsize*TileHWidth,           // oben
                  Ypos - SquareHeight(X,Y,1) - IsoMap[X,Y].gsize*TileHHeight+1,
                  Xpos + IsoMap[X,Y].gsize*TileWidth-1,          // rechts
                  Ypos - SquareHeight(X,Y,3),
                  Xpos + IsoMap[X,Y].gsize*TileHWidth,           // unten
                  Ypos - SquareHeight(X,Y,2) + IsoMap[X,Y].gsize*TileHHeight-1),
                  Grid7Color, fxNone);
                  end;
                 end else begin

                  if IsoMap[X,Y].TileIsFF then
                   MapForm.MyCanvas.Quad(
                   Point4(Xpos +1    , Ypos - SquareHeight(X,Y,0),
                   Xpos+TileHWidth , Ypos-SquareHeight(X,Y,1) - TileHHeight+1,
                   Xpos+TileWidth-1, Ypos-SquareHeight(X,Y,3),
                   Xpos+TileHWidth , Ypos-SquareHeight(X,Y,2) + TileHHeight-1),
                   GridFFColor, fxNone)
                  else begin
                   MapForm.MyCanvas.Quad(
                    Point4(Xpos     , Ypos - SquareHeight(X,Y,0),
                    Xpos +TileHWidth, Ypos - SquareHeight(X,Y,1)-TileHHeight,
                    Xpos +TileWidth , Ypos - SquareHeight(X,Y,3),
                    Xpos +TileHWidth, Ypos - SquareHeight(X,Y,2)+TileHHeight),
                    GridUnsColor, fxNone)
                    end;
                    end;
                   end;   // if lake
                  end;   // if g3
                 end;  // if g5
                end// if g4
               end// if g1
             end// RastID
            end// TileIsFF
           end// if TileInRegion
         end// if XY in SelGrid
       end// if YPos ok
     end// if XPos ok
   end// for XY
 end// if Grid
 if MapForm.DoNumbers then begin
   for Y := 0 to MapSize do
    for X := 0 to MapSize do begin
      XPos := (X+Y) * TileHWidth + deltaX;
      if (Xpos >= -TileWidth) and (Xpos < BotX) then begin
        YPos := (Y-X) * TileHHeight + deltaY;
        if (YPos >= -TileHHeight) and (Ypos < BotY) then
            MapForm.Fonts[0].TextOut(
            inttostr(IsoMap[X,Y].TileHeight),xPos+20,yPos-SquareHeight(X,Y,0)-5,
            clLime + $FF000000);
      end;
    end;
 end;
end;

procedure TMapForm.TimerProcess(Sender: TObject);
begin
  InfoForm.Inccycle;
end;

procedure TMapForm.FormCreate(Sender: TObject);
begin
 if not Device.Initialize() then begin
   MessageDlg('Device.InitDevice() failed: ',mtError,[mbOk],0);
   Close();
   Exit;
 end;
 Land        := TLand.Create();  // create landscape class
 DoBlend     := true;
 DoHeight    := true;
 DoNumbers   := false;
 Grid        := true;
 with aTexCoord do begin
    Origin.X  := 0// Origin in Bezug auf Pattern !
    Origin.Y  := 0// nicht in Bezug auf Texture
    Size.X    := 64;
    Size.Y    := 64;
    Flip      := false;
    Mirror    := false;
    Pattern   := 0;
 end;
end;

procedure TMapForm.FormDestroy(Sender: TObject);
begin
 Device.Finalize();  // finalize Asphyre device
 Land.Free();        // release landscape class
end;

procedure TMapForm.DeviceRender(Sender: TObject);
begin
 if not InfoForm.InselLoaded then exit;
 Land.Render();          // render the landscape
 with Fonts[0do begin  // show information
   TextOut('Frames: ' + IntToStr(Timer.FrameRate)+'  '+
            inttostr(Land.SelGridY)+', '+inttostr(Land.SelGridX) +  ',  '+
            inttostr(IsoMap[Land.SelGridX,Land.SelGridY].TileHeight)+
            '  ' + InfoForm.FilePanel.Caption, 44,
            $FF00D0FF$FFD0FFFF, fxBlend);
 end;
end;

procedure TMapForm.DeviceInitialize(Sender: TObject; var success : boolean);
begin
  Success := Images.LoadFromASDb(Archive);
  if Success then Success := Fonts.LoadFromASDb(Archive);
  Timer.Enabled := Success;
end;

procedure TMapForm.TimerTimer(Sender: TObject);
begin
  Device.Render(0, true); // render the scene
  Timer.Process(1.0);     // do calculations while Direct3D is still rendering
  Device.Flip();
end;

procedure TMapForm.FormKeyPress(Sender: TObject; var Key: Char);
var i,j : integer;

  function HasGap(const x,y : integer) : boolean;
  var k : integer;
  begin
     k := Land.MapSize;
     while (k > 0and not IsoMap[x,k].TileInRegion do dec(k);
     Result := (k > y); // false = no other selected tile below
  end;

  procedure FillArea;
  var x,y : integer;
  begin
    for x := 1 to Land.MapSize do begin
      y := 1;
      repeat
         while (y < Land.MapSize) and not IsoMap[x,y].TileInRegion do inc(y);
         // now y points to next step from unsel to sel tile
         //ShowMessage('x '+inttostr(x)+'  next ysel '+inttostr(y));
         inc(y);
         if y < Land.MapSize then begin
            while (y < Land.MapSize) and IsoMap[x,y].TileInRegion do inc(y);
            //ShowMessage('x '+inttostr(x)+'  next unysel '+inttostr(y));
            if HasGap(x,y) then begin
              //ShowMessage('x '+inttostr(x)+', '+inttostr(y)+'  has Gap');
              while (y < Land.MapSize) and not IsoMap[x,y].TileInRegion do begin
                IsoMap[x,y].TileInRegion  := true;
                inc(y);
              end;
            end;
         end;
      until y >= Land.MapSize;
    end;
  end;

begin
 if (UpCase(Key) = 'F'then FillArea;
 if (UpCase(Key) = 'G'then Grid       := not Grid;
 if (UpCase(Key) = 'N'then DoNumbers  := not DoNumbers;
 if (UpCase(Key) = 'B'then begin
   DoBlend := not doBlend;
   if DoBlend then Land.Blendfkt := fxBlend else Land.Blendfkt := fxNone;
 end;
 if Key = '8' then begin
   inc(Land.deltaY,TileHeight);
   inc(Land.deltaX,TileWidth);
 end;
 if Key = '6' then begin
   dec(Land.deltaX,TileWidth);
   inc(Land.deltaY,TileHeight);
 end;
 if Key = '4' then begin
   inc(Land.deltaX,TileWidth);

   dec(Land.deltaY,TileHeight);
 end;
 if Key = '2' then begin
   dec(Land.deltaY,TileHeight);
   dec(Land.deltaX,TileWidth);
 end;
 if (UpCase(Key) = 'C'then begin    // cursor zentrieren
   i := ClientWidth div 2 - ClientHeight + 2*Land.deltay - Land.deltax;
   Land.SelGridX := i div (2*TileHeight);
   if Land.SelGridX < 0 then Land.SelGridX := 0;
   if Land.SelGridX > Land.MapSize then Land.SelGridX := Land.MapSize;
   i := ClientWidth div 2 + ClientHeight - 2*Land.deltay - Land.deltax;
   Land.SelGridY := i div (2*TileHeight);
   if Land.SelGridY < 0 then Land.SelGridY := 0;
   if Land.SelGridY > Land.MapSize then Land.SelGridY := Land.MapSize;
 end;
end;

procedure TMapForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
   if ssAlt in Shift then begin
      if WheelDelta < 0 then begin
        dec(Land.deltaY,TileHeight)
      end else begin
        inc(Land.deltaY,TileHeight)
      end;
   end else begin
      if WheelDelta < 0 then begin
        dec(Land.deltaX,TileWidth)
      end else begin
        inc(Land.deltaX,TileWidth)
      end;
   end;
   Handled := true;
end;

procedure TMapForm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var i,j,k : integer;

  function HasGap(const x,y : integer) : boolean;
  var k : integer;
  begin
     k := Land.MapSize;
     while (k > 0and not IsoMap[x,k].TileInRegion do dec(k);
     Result := (k > y); // false = no other selected tile below
  end;

  procedure FillSelTiles;
  var x,y,k : integer;
  begin
    for x := 1 to Land.MapSize do begin
      y := 1;
      repeat
         while (y < Land.MapSize) and not IsoMap[x,y].TileInRegion do inc(y);
         // now y points to next step from unsel to sel tile
         k := IsoMap[x,y].TileHeight;
         //ShowMessage('x '+inttostr(x)+'  next ysel '+inttostr(y));
         inc(y);
         if y < Land.MapSize then begin
            while (y < Land.MapSize) and IsoMap[x,y].TileInRegion do inc(y);
            //ShowMessage('x '+inttostr(x)+'  next unysel '+inttostr(y));
            if HasGap(x,y) then begin
              //ShowMessage('x '+inttostr(x)+', '+inttostr(y)+'  has Gap');
              while (y < Land.MapSize) and not IsoMap[x,y].TileInRegion do begin
                IsoMap[x,y].TileHeight    := k;
                Land.Map[x,y].Heights[0]  := k;
                IsoMap[x,y].TileInRegion  := true;
                if k < 128 then Land.Map[x, y].Light[0] := k + 128
                           else Land.Map[x, y].Light[0] := 240;
                Land.SaveMap[x, y].Heights[0] := k;
                Land.SaveMap[x, y].Light[0]   := Land.Map[x, y].Light[0];
                SetTileCorners;
                inc(y);
              end;
            end;
         end;
      until y >= Land.MapSize;
    end;
  end;

begin
//TShiftState= set of (ssShift,ssAlt,ssCtrl,ssLeft,ssRight,ssMiddle,ssDouble);
 if (Key = VK_PRIOR) or (Key = VK_TAB) then begin
   InfoForm.GetNextTab;
   SetFocus;
 end;
 if Key = ord('0'then InfoForm.ZoomSpin.Value := 0;
 if Key = ord('1'then InfoForm.ZoomSpin.Value := 1;
 if Key = ord('2'then InfoForm.ZoomSpin.Value := 2;
 if Key = ord('3'then InfoForm.ZoomSpin.Value := 3;
 if Key = ord('4'then InfoForm.ZoomSpin.Value := 4;
 if Key = ord('5'then InfoForm.ZoomSpin.Value := 5;
 if (Key = VK_ZOOM) then begin
   InfoForm.ZoomSpin.Value := (InfoForm.ZoomSpin.Value + 1mod 6;
 end;
 if (Key = VK_CAPITAL) then begin
   DoHeight := not DoHeight;
   if DoHeight then begin
    for i := 0 to Land.MapSize do
     for j := 0 to Land.MapSize do begin
       for k := 0 to 3 do begin
         Land.Map[j, i].Heights[k] := Land.SaveMap[j, i].Heights[k];
         Land.Map[j, i].Light[k]   := Land.SaveMap[j, i].Light[k];
       end;
     end;
    end else begin
     for i := 0 to Land.MapSize do
      for j := 0 to Land.MapSize do begin
        for k := 0 to 3 do begin
          Land.Map[j, i].Heights[k] := 64;
          Land.Map[j, i].Light[k]   := 192;
        end;
      end;
    end;
 end;
 if (Key = VK_LEFT) then begin
   dec(Land.SelGridX);
   if Land.SelGridX < 0 then Land.SelGridX := 0
   else InfoForm.SetCPanels(Land.SelGridX,Land.SelGridY);
 end;
 if (Key = VK_RIGHT) then begin
   inc(Land.SelGridX);
   if Land.SelGridX > Land.MapSize then Land.SelGridX := Land.MapSize
   else InfoForm.SetCPanels(Land.SelGridX,Land.SelGridY);
 end;
 if (Key = VK_UP) then begin
   dec(Land.SelGridY);
   if Land.SelGridY < 0 then Land.SelGridY := 0
   else InfoForm.SetCPanels(Land.SelGridX,Land.SelGridY);
 end;
 if (Key = VK_DOWN) then begin
   inc(Land.SelGridY);
   if Land.SelGridY > Land.MapSize then Land.SelGridY := Land.MapSize
   else InfoForm.SetCPanels(Land.SelGridX,Land.SelGridY);
 end;
 // Selected tiles routines
 if (Key = VK_MULTIPLY) then FillSelTiles; // rahmen ausfüllen
 if (Key = VK_DIVIDE) then begin
   for i := 0 to Land.MapSize do
    for j := 0 to Land.MapSize do
      IsoMap[i,j].TileInRegion := false;
 end;
 if (Key = VK_RETURN) then InfoForm.RotateInsel;
 if (Key = VK_ADD) or (Key = VK_SUBTRACT) then begin
    if ssAlt in Shift then begin
     for i := 0 to Land.MapSize do
       for j := 0 to Land.MapSize do begin
         if IsoMap[i,j].TileInRegion then begin
          k := IsoMap[i,j].TileHeight;
          if (Key = VK_ADD) then
            IsoMap[i,j].TileHeight := IsoMap[i,j].TileHeight + 1
          else
            IsoMap[i,j].TileHeight := IsoMap[i,j].TileHeight - 1;
          Land.Map[i, j].Heights[0]     := IsoMap[i,j].TileHeight;
          if IsoMap[i,j].TileHeight < 128 then
            Land.Map[i, j].Light[0]     := IsoMap[i,j].TileHeight + 128
          else Land.Map[i, j].Light[0]  := 240;
          Land.SaveMap[i, j].Heights[0] := IsoMap[i,j].TileHeight;
          Land.SaveMap[i, j].Light[0]   := Land.Map[i, j].Light[0];
          SetTileCorners;
         end;
       end;
    end else begin
     i := Land.SelGridX;
     j := Land.SelGridY;
     k := IsoMap[i,j].TileHeight;
     if (Key = VK_ADD)      then
        IsoMap[i,j].TileHeight := IsoMap[i,j].TileHeight + 1;
     if (Key = VK_SUBTRACT) then
        IsoMap[i,j].TileHeight := IsoMap[i,j].TileHeight - 1;
     Land.Map[i, j].Heights[0]     := IsoMap[i,j].TileHeight;
     if IsoMap[i,j].TileHeight < 128 then
          Land.Map[i, j].Light[0]  := IsoMap[i,j].TileHeight + 128
     else Land.Map[i, j].Light[0]  := 240;
     Land.SaveMap[i, j].Heights[0] := IsoMap[i,j].TileHeight;
     Land.SaveMap[i, j].Light[0]   := Land.Map[i, j].Light[0];
     SetTileCorners;
    end;
 end;
 if ssShift in Shift then begin
   IsoMap[Land.SelGridX,Land.SelGridY].TileInRegion := true;
 end;
 if ssCtrl in Shift then begin
   IsoMap[Land.SelGridX,Land.SelGridY].TileInRegion := false;
 end;
end;

procedure TMapForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  InfoForm.Close;
end;

procedure TMapForm.FormResize(Sender: TObject);
begin
 Device.Width  := ClientWidth;
 Device.Height := ClientHeight;
 Land.BotX     := ClientWidth;
 Land.BotY     := ClientHeight + 2*TileHeight;
end;

procedure TMapForm.FormShow(Sender: TObject);
begin
  Top  := 10;
  Left := 325;
end;

procedure TMapForm.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var i,j,k : single;
    m,n,o,p : integer;
begin  // cursor zentrieren
   o := 0;
   for p := 1 to 4 do begin  // iterieren..
     i := (X - Land.deltax) / TileWidth;
     j := (Y - Land.deltay) / TileHeight;
     dec(Y,o);
     m := round(i-j);
     n := round(i+j);
     o := Land.AverageHeight(m,n);  // 1. iteration
     inc(Y,o); // restore
   end;
   Land.SelGridX := trunc(i-j);
   Land.SelGridY := trunc(i+j);
   //ShowMessage(inttostr(X)+', '+inttostr(Y));
   if Land.SelGridX < 0 then Land.SelGridX := 0;
   if Land.SelGridX > Land.MapSize then Land.SelGridX := Land.MapSize;
   if Land.SelGridY < 0 then Land.SelGridY := 0;
   if Land.SelGridY > Land.MapSize then Land.SelGridY := Land.MapSize;
   InfoForm.SetCPanels(Land.SelGridX,Land.SelGridY);
end;

end.


Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt
Magic J
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66

WinXP Prof., Vista
Delphi6, Delphi 2009, Java(Eclipse), C++, Basic
BeitragVerfasst: Do 01.07.10 21:19 
EINE 3D-Engine recht aus!

also glaub ich nicht, dass du diese weiteren Units einbinden brauchst...

Es sieht so aus, als wäre sogar die grafische Umsetzung schon fertig.

Wobei genau kommst du den nicht weiter?
Bzw: Was funktioniert und was funktioniert noch nicht?
kompas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Do 01.07.10 21:59 
Also Magic J.

ja, also hier handelt es sich um eine Beta version ok.

also hier, gebe ich dir mal screenshoot, so das du recht Verstehsts, was ich will umändern will, so dass es richtig mit den Spiel Daten, kein probleme gebe.

warte, ich bereite nur kurz mal die Screenshoot vor.

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

so, hier also mein Ersten screenshoot.

Moderiert von user profile iconNarses: Bild als Anhang hochgeladen.

Also, hier, der Erste Screenshoot.
Auf dem Obersten Bild, habe ich drei punkte drauf bearbeitet.
Die Zoomstuffe diese für den moment funktioniert von 1 bis zu 5, also 5 zoom faktoren. (5 ist bist jetzt die weite Entfernung, und 1, die Nahestehende Ansicht)

hier, für den moment, mit diese Beta Programmierung, war es Gelungen, die .ISD Files (Spiel Datei von der 3D Karten Objekte) sie zu öffnen, und sie Anzusehen.
und mir kann auch mit der Tastatur sie ein bisschen Editieren.

Aber der Minus, ist das es kein Speicher Möglichkeit gebe. (Nur Text Txt format).

Also Gebe es als Erste Lösung, entweder, sowie es die möglichkeit gegeben hat, mit diese Programmierung, die ISD Files zu laden, dann ein Reversing methode bearbeiten, so dass am platzt die File Geladen werden, dass sie mit der Reversing methode Gespeichert werden unter diesem ISD Datei Format.

Aber hier, bei diese Lade Programmierung, gab es ein fehler, denn, es Gebe 2 Untershiedlischen Karten, die Nord und die Süd Karten.
die Karten von der Nord Seite, die sind fehler frei, aber wenn die Süd Karten Geladen sind, dann bei den Daten Anzeigen sowie die Koordinaten von der Karte, hier, trat ein Fehler auf, sie werden nicht angezeigt. (hier kann es sein, dass bei der Nord Karten, und Süd Karten, das die Koordinaten nicht weiter als Mirror eingetragen wurde. Und so, diese Mirror funktion ist nicht in dem Programm. also gebe es fehler.

denn es gebe nur diese Angaben.

Zitat:
3 * 4 bytes coordinates , x, h, y, width , distance


denn wenn ich eine Nord Karte anschauen wird die Miterteilt.

Zitat:
<Rivers>
3 * 4 bytes coordinates , x, h, y, width , distance
AE F1 3A 44 40 48 93 42 7D C5 BD 44, 747, 73, 1270, 16.000000, 0.000000


und jetzt, abwarte ich mal euhere antworten....
Einloggen, um Attachments anzusehen!
Magic J
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66

WinXP Prof., Vista
Delphi6, Delphi 2009, Java(Eclipse), C++, Basic
BeitragVerfasst: Fr 02.07.10 02:30 
user profile iconkompas hat folgendes geschrieben Zum zitierten Posting springen:
Also, hier, der Erste Screenshoot.
Auf dem Obersten Bild, habe ich drei punkte drauf bearbeitet.
Die Zoomstuffe diese für den moment funktioniert von 1 bis zu 5, also 5 zoom faktoren. (5 ist bist jetzt die weite Entfernung, und 1, die Nahestehende Ansicht)

Ja, sieht ja schonmal gut aus.
Die Komponenten bei den grünen Punkte sind also von dir hinzugefügt.
Soweit alles klar...

user profile iconkompas hat folgendes geschrieben Zum zitierten Posting springen:
hier, für den moment, mit diese Beta Programmierung, war es Gelungen, die .ISD Files (Spiel Datei von der 3D Karten Objekte) sie zu öffnen, und sie Anzusehen.
und mir kann auch mit der Tastatur sie ein bisschen Editieren.

Du kannst es also bereits als ISD abspeichern und die Map dann in einem 3D-Editor betrachten?

user profile iconkompas hat folgendes geschrieben Zum zitierten Posting springen:
Aber der Minus, ist das es kein Speicher Möglichkeit gebe. (Nur Text Txt format).

Was meinst du damit?
ISD ist doch keine TXT?

user profile iconkompas hat folgendes geschrieben Zum zitierten Posting springen:
Also Gebe es als Erste Lösung, entweder, sowie es die möglichkeit gegeben hat, mit diese Programmierung, die ISD Files zu laden, dann ein Reversing methode bearbeiten, so dass am platzt die File Geladen werden, dass sie mit der Reversing methode Gespeichert werden unter diesem ISD Datei Format.

????????
sorry, aber ich kann in diesem Satz keinen nachvollziehbaren Zusammenhang erkennen...
Versuch doch bitte mal kurz Sätze zu schreiben, denn mit Grammatik und Satzbau klappts ja leider nicht bei dir!

user profile iconkompas hat folgendes geschrieben Zum zitierten Posting springen:
Aber hier, bei diese Lade Programmierung, gab es ein fehler, denn, es Gebe 2 Untershiedlischen Karten, die Nord und die Süd Karten.
die Karten von der Nord Seite, die sind fehler frei, aber wenn die Süd Karten Geladen sind, dann bei den Daten Anzeigen sowie die Koordinaten von der Karte, hier, trat ein Fehler auf, sie werden nicht angezeigt. (hier kann es sein, dass bei der Nord Karten, und Süd Karten, das die Koordinaten nicht weiter als Mirror eingetragen wurde. Und so, diese Mirror funktion ist nicht in dem Programm. also gebe es fehler.

Was sind "Nord Karten" und "Süd Karten", bzw. wo liegt der Unterschied?
Mit Fehler meinst du das rote Kästchen auf dem Screenshot? oder was genau ist da falsch?
Welche "Mirror-Funktion" ?

user profile iconkompas hat folgendes geschrieben Zum zitierten Posting springen:
denn es gebe nur diese Angaben.
3 * 4 bytes coordinates , x, h, y, width , distance

Das ist dann wahrscheinlich der Blickwinkel(die Kamerasicht)...und was hast du damit genau vor?

Habe also noch nicht verstanden, wie man dir helfen kann...
kompas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Fr 02.07.10 07:51 
Du kannst es also bereits als ISD abspeichern und die Map dann in einem 3D-Editor betrachten?

Nein, für den moment, gebe es kein Abspeicherung möglichkeit, eher mir wollte TXT datei abspeichern.
dies ja, dies funktioniert, aber kein ISD Datei abspeicherung.

[color =Green]Was meinst du damit?
ISD ist doch keine TXT?[/color]

Ja ISD ist kein TXT datei, ist eher sofiehl wie rausgefunden habe, ist es eine Binärische Datei, wie von den Spiel Programmer Erzeugt worden ist. und ich denke auch noch weiter, dass diese Datei, Geschützt worden ist, mit ziffern magie, so dass keiner die dateien Lesen kann, oder benutzen kann für andere Objekte selber zu Erzeugen.

(Dies spiel ja keine rolle) denn wir haben ja eine Eintritt).


????????
sorry, aber ich kann in diesem Satz keinen nachvollziehbaren Zusammenhang erkennen...
Versuch doch bitte mal kurz Sätze zu schreiben, denn mit Grammatik und Satzbau klappts ja leider nicht bei dir![/color
(auf Englisch)
To moment, we can Load or open Isd Files, so this is Entry door to isd file saving.
To have succes on save isd file, i think, we should only to use reversing methode of Load ISD file part. So as Replacement of Load Function, we use Save function on Program.

[color=green]Was sind "Nord Karten" und "Süd Karten", bzw. wo liegt der Unterschied?
Mit Fehler meinst du das rote Kästchen auf dem Screenshot? oder was genau ist da falsch?
Welche "Mirror-Funktion" ?


Nord Map, is Isle we into Game are on (Nordhalbkugel)set, and Southern Map, contain (Südhalkugel)Isle, So the difference coming from isle location.
Please see explain on picture.
into Green Color are North Game World, and Brown Color are Southern Game World.

Zitat:
<Rivers>
3 * 4 bytes coordinates , x, h, y, width , distance
AE F1 3A 44 40 48 93 42 7D C5 BD 44, 747, 73, 1270, 16.000000, 0.000000
78 D8 37 44 38 E4 61 42 1E 8C C1 44, 734, 55, 1285, 16.000000, 36.889427
6D 34 34 44 30 E3 59 42 05 EA C4 44, 720, 53, 1299, 16.000000, 67.574188
37 F4 30 44 B8 49 4B 42 85 27 C6 44, 707, 50, 1304, 16.000000, 84.332794
89 0A 31 44 E8 7F 3B 42 37 43 C8 44, 707, 46, 1312, 18.660553, 101.657501
C4 0C 32 44 D4 EB 33 42 91 49 CB 44, 711, 44, 1324, 16.000000, 126.263115
16 9A 31 44 C8 03 1A 42 57 A8 CC 44, 709, 38, 1330, 16.000000, 139.120621
34 5A 38 44 E0 74 3F 42 F6 22 D3 44, 736, 47, 1356, 16.000000, 198.308990
4E 27 31 44 90 6F 32 42 E2 4C CC 44, 708, 44, 1328, 16.000000, 0.000000
AC 14 30 44 78 FE 22 42 A1 44 D0 44, 703, 40, 1344, 16.000000, 32.262604
CF 5F 2D 44 00 06 34 42 46 76 D2 44, 692, 44, 1353, 16.000000, 53.319157
D5 41 29 44 F0 8F 4C 42 19 AC D4 44, 676, 50, 1362, 16.000000, 78.248970
2F CE 23 44 20 6D 51 42 34 6D D5 44, 654, 51, 1365, 16.000000, 100.908188
C2 EE 1D 44 C0 17 4A 42 82 5F D6 44, 631, 50, 1368, 18.981546, 125.657433
42 38 19 44 70 CB 50 42 30 CE D5 44, 612, 51, 1366, 22.729548, 145.120514
04 D3 30 44 00 87 10 42 AD BD CC 44, 706, 35, 1330, 16.000000, 0.000000
1F 16 35 44 28 CE 2C 42 BC 36 D1 44, 723, 42, 1348, 16.000000, 40.262371
A8 9A 39 44 48 93 37 42 4B EC D3 44, 741, 45, 1359, 16.000000, 68.609421
F5 DF 3E 44 E0 3B 40 42 20 77 D5 44, 762, 47, 1365, 16.000000, 93.133080
41 66 41 44 30 CD 3E 42 C4 53 D7 44, 773, 47, 1372, 16.000000, 111.132172
5F 96 43 44 B8 7A 3D 42 7C 1E D9 44, 781, 46, 1379, 16.000000, 127.930832
F9 DD 47 44 20 29 43 42 6B 99 DA 44, 798, 48, 1385, 16.000000, 148.794556
4A CE 4C 44 10 ED 3E 42 D3 00 DB 44, 818, 47, 1387, 16.000000, 168.840027
26 0B 51 44 20 70 35 42 D1 2D DB 44, 835, 44, 1388, 16.000000, 186.013763
75 29 57 44 F8 FF 3B 42 C5 1E DC 44, 860, 46, 1391, 16.000000, 211.671982
B9 9F 5F 44 0C 00 48 42 44 66 DD 44, 893, 49, 1397, 16.000000, 247.160309


This information, is done, if we make Coordinate list form Isle.
So this sample coming from North Isle. (this data are write into Isd File as Coordinate of Isle). But only into Hex value.
And so, if we load a Southern Isles, and if we make list coordinate, so the program give not more as
3 * 4 bytes coordinates , x, h, y, width , distance
containing nothing Data.

So to solve this bug, i have think, it give difference between Northern and Southern Isles Coordinate. so Wy not try to make a mirror function on Calculation programming we perform to find data from Isle we are containt into ISD File format.

have you so better understand?

And so, you self you have think, that this data, coming more from Camera Angular View?
Einloggen, um Attachments anzusehen!
Magic J
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66

WinXP Prof., Vista
Delphi6, Delphi 2009, Java(Eclipse), C++, Basic
BeitragVerfasst: Fr 02.07.10 16:52 
user profile iconkompas hat folgendes geschrieben Zum zitierten Posting springen:
Ja ISD ist kein TXT datei, ist eher sofiehl wie rausgefunden habe, ist es eine Binärische Datei, wie von den Spiel Programmer Erzeugt worden ist. und ich denke auch noch weiter, dass diese Datei, Geschützt worden ist, mit ziffern magie, so dass keiner die dateien Lesen kann, oder benutzen kann für andere Objekte selber zu Erzeugen.

Also wenn das unten gezeigte eine ISD sein sollte ist das keine große Kunst das zu entziffern:

Beispiel:
ausblenden Quelltext
1:
AE F1 3A 44 40 48 93 42 7D C5 BD 44					


-> Binär:
ausblenden Quelltext
1:
2:
3:
10101110111100010011101001000100
01000000010010001001001101000010
01111101110001011011110101000100


Wenn man nun davon aus geht, das es sich um Single-Fließkommazahlen handelt, kann mal das dann folgendermassen zerlegen:
Vorzeichen(1Bit), Mantisse(24 Bit), Exponent(7Bit)

Zahl = (Vorzeichen)* Mantisse * 2^(0x111111-Exponent);

Somit ergeben sich folgende Koordinaten:
ausblenden Quelltext
1:
2:
3:
-0,0427105203270912
0,18777684867382
0,0619561560451984


Wenn das also eine ganze Liste dieser Daten ist, handelt es sich also jeweils um ein Grid-Feld auf deiner Map...

Wie meinst du unterscheiden sich die Koordinaten der beiden Maps ?
kompas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Fr 02.07.10 19:28 
wait one moment, if you would speak about isles hex value, than you need see before this screen shoot.
To give a isle into game, game need 2 files, ISC and ISD files.
ISC data files on down side,and ISD on upper Side.
Upper left side, files coming from Northern ISD Isles example.
and down left side, contain Northern ISC Isles data.


by Northern isle ISD files, you can remark, in files, real coded hex data string, start on hex address 00000110.
and so this make first a loop with this hex string.
Code Start on address 00000110 and make this hex string loop to address 00000DD0.

North ISD files
ausblenden Quelltext
1:
2:
3:
4:
0000C8C200000000000000000000803F
00000000FFFF0100FFFFFF0000000000
0000C8C200000000000000000000803F
00000000FFFF0100FFFFFF0000000000


South ISD Files
ausblenden Quelltext
1:
2:
3:
4:
0000C8C200000000000000000000803F
00000000FFFF0100FFFFFF0000000000
0000C8C200000000000000800000803F
00000000FFFF0100FFFFFF0000000000


but this loop coded hex string, don't are from same size, so it hold it on other hex adress by each Isles isd files .
on North Isles Hex string make this loop from this hex string to adress 00000DD0 and Southern ISD Files the Loop go to adress 00000D70.

So it give here, a difference, on each ISD files, not of contain value of hex string, but on Ending hex adress of this string.

But if we look ISC Files.
Example the isles from we coming hex codes.
So as
ausblenden Quelltext
1:
AE F1 3A 44 40 48 93 42 7D C5 BD 44					


and so, i have search in ISC files from south.
the difference.

ausblenden Quelltext
1:
7B 8A 01 44 00 00 00 00 4C 81 B0 44					


so, the reason that program don't have done this Hex code string, i don't.
Einloggen, um Attachments anzusehen!
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 02.07.10 19:50 
the files look a little bit like XML-Files with all the Tags.

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
kompas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Fr 02.07.10 20:12 
ja hallo elundrill.

And people, don't need to me answer in english language, i can perfect read German language.i have only little problem with write in german language.

Yes, isc files, have a little look of xml format.
but, this isc files, i don't can open it under xmlspy, because, it hold special write caracteristic format.

so under xmlspy program, this done only Ascii Character, not fully Value which are contain in ISC files.
is not more as Cdata code.

see my screenshoot.

But on start, any files from game, was make into xml files format.
Einloggen, um Attachments anzusehen!
kompas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mo 05.07.10 13:49 
So jetzt habe ich eine neue Frage.

What basis setting, should have Borland Delphi Editor?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 05.07.10 13:53 
Moin!

Bitte erstelle für jede deiner Fragen ein separates Topic, da die Diskussion mehrerer Fragen in einem Topic für gewöhnlich für Verwirrung und Durcheinander sorgt. Danke. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.