Changeset 3


Ignore:
Timestamp:
Jan 27, 2016, 10:32:48 PM (8 years ago)
Author:
chronos
Message:
  • Added: Classes for decoding MAP, CPS, SHP and ENG file formats.
Location:
trunk
Files:
7 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Dune2.lpi

    r2 r3  
    2727          <SearchPaths>
    2828            <IncludeFiles Value="$(ProjOutDir)"/>
    29             <OtherUnitFiles Value="Packages/TemplateGenerics"/>
     29            <OtherUnitFiles Value="Forms"/>
    3030            <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    3131          </SearchPaths>
     
    8282      </Item4>
    8383    </RequiredPackages>
    84     <Units Count="4">
     84    <Units Count="10">
    8585      <Unit0>
    8686        <Filename Value="Dune2.lpr"/>
     
    9191        <IsPartOfProject Value="True"/>
    9292        <ComponentName Value="FormMain"/>
     93        <HasResources Value="True"/>
    9394        <ResourceBaseClass Value="Form"/>
    9495      </Unit1>
     
    9798        <IsPartOfProject Value="True"/>
    9899        <ComponentName Value="Core"/>
     100        <HasResources Value="True"/>
    99101        <ResourceBaseClass Value="DataModule"/>
    100102      </Unit2>
     
    103105        <IsPartOfProject Value="True"/>
    104106      </Unit3>
     107      <Unit4>
     108        <Filename Value="UGame.pas"/>
     109        <IsPartOfProject Value="True"/>
     110      </Unit4>
     111      <Unit5>
     112        <Filename Value="UFile1.pas"/>
     113        <IsPartOfProject Value="True"/>
     114      </Unit5>
     115      <Unit6>
     116        <Filename Value="UEngFile.pas"/>
     117        <IsPartOfProject Value="True"/>
     118      </Unit6>
     119      <Unit7>
     120        <Filename Value="Forms/UFormLog.pas"/>
     121        <IsPartOfProject Value="True"/>
     122        <ComponentName Value="FormLog"/>
     123        <ResourceBaseClass Value="Form"/>
     124      </Unit7>
     125      <Unit8>
     126        <Filename Value="UShpFile.pas"/>
     127        <IsPartOfProject Value="True"/>
     128      </Unit8>
     129      <Unit9>
     130        <Filename Value="UFormat80.pas"/>
     131        <IsPartOfProject Value="True"/>
     132      </Unit9>
    105133    </Units>
    106134  </ProjectOptions>
     
    117145    <Parsing>
    118146      <SyntaxOptions>
     147        <SyntaxMode Value="Delphi"/>
    119148        <CStyleOperator Value="False"/>
    120149        <IncludeAssertionCode Value="True"/>
  • trunk/Dune2.lpr

    r2 r3  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UCore, UPakFile, CoolStreaming, Common, TemplateGenerics
     10  Forms, UFormMain, UCore, UPakFile, CoolStreaming, Common, TemplateGenerics,
     11  UGame, UFile1, UEngFile, UFormLog, UShpFile, UFormat80
    1112  { you can add units after this };
    1213
     
    1819  Application.CreateForm(TCore, Core);
    1920  Application.CreateForm(TFormMain, FormMain);
     21  Application.CreateForm(TFormLog, FormLog);
    2022  Application.Run;
    2123end.
  • trunk/Forms/UFormMain.lfm

    r2 r3  
    11object FormMain: TFormMain
    2   Left = 578
    3   Height = 646
    4   Top = 309
    5   Width = 985
     2  Left = 333
     3  Height = 1074
     4  Top = 151
     5  Width = 1420
    66  Caption = 'Dune 2'
    7   ClientHeight = 646
    8   ClientWidth = 985
     7  ClientHeight = 1074
     8  ClientWidth = 1420
    99  OnActivate = FormActivate
     10  OnKeyPress = FormKeyPress
    1011  LCLVersion = '1.7'
     12  WindowState = wsMaximized
    1113  object PaintBox1: TPaintBox
    1214    Left = 0
    13     Height = 646
     15    Height = 1074
    1416    Top = 0
    15     Width = 985
     17    Width = 1420
    1618    Align = alClient
    1719    OnClick = PaintBox1Click
     20    OnPaint = PaintBox1Paint
    1821  end
    1922end
  • trunk/Forms/UFormMain.pas

    r2 r3  
    1616    PaintBox1: TPaintBox;
    1717    procedure FormActivate(Sender: TObject);
     18    procedure FormKeyPress(Sender: TObject; var Key: char);
    1819    procedure PaintBox1Click(Sender: TObject);
     20    procedure PaintBox1Paint(Sender: TObject);
    1921  private
    2022    Initialized: Boolean;
     
    4042end;
    4143
     44procedure TFormMain.PaintBox1Paint(Sender: TObject);
     45begin
     46  Core.Game.Paint(PaintBox1.Canvas);
     47end;
     48
    4249procedure TFormMain.FormActivate(Sender: TObject);
    4350begin
     
    4552    Initialized := True;
    4653    Core.Init;
     54  end;
     55end;
     56
     57procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char);
     58begin
     59  Caption := IntToStr(Ord(Key));
     60  if Key = #63 then begin
     61    Inc(Core.Game.IW);
     62    core.Game.LoadData;
     63    PaintBox1.Repaint;
     64  end;
     65  if Key = #41 then begin
     66    Dec(Core.Game.IW);
     67    core.Game.LoadData;
     68    PaintBox1.Repaint;
    4769  end;
    4870end;
  • trunk/Packages/Common

    • Property svn:ignore set to
      lib
  • trunk/Packages/Common/UCommon.pas

    r2 r3  
    1212type
    1313  TArrayOfByte = array of Byte;
     14  TArrayOfInteger = array of Integer;
     15  TArrayOfWord = array of Word;
    1416  TArrayOfString = array of string;
    1517  TExceptionEvent = procedure(Sender: TObject; E: Exception) of object;
  • trunk/Packages/CoolStreaming

    • Property svn:ignore set to
      lib
  • trunk/Packages/CoolStreaming/UStreamHelper.pas

    r2 r3  
    114114  Result := 0;
    115115  FStream.ReadBuffer(Result, SizeOf(Cardinal));
    116   if SwapData then Result := Swap(Result);
     116  if SwapData then Result := SwapEndian(Result);
    117117end;
    118118
     
    121121  Result := 0;
    122122  FStream.ReadBuffer(Result, SizeOf(Int64));
    123   if SwapData then Result := Swap(Result);
     123  if SwapData then Result := SwapEndian(Result);
    124124end;
    125125
     
    298298  Result := 0;
    299299  FStream.ReadBuffer(Result, SizeOf(Word));
    300   if SwapData then Result := Swap(Result);
     300  if SwapData then Result := SwapEndian(Result);
    301301end;
    302302
     
    358358procedure TStreamHelper.WriteCardinal(Data: Cardinal);
    359359begin
    360   if SwapData then Data := Swap(Data);
     360  if SwapData then Data := SwapEndian(Data);
    361361  Write(Data, SizeOf(Cardinal));
    362362end;
     
    364364procedure TStreamHelper.WriteInt64(Data: Int64);
    365365begin
    366   if SwapData then Data := Swap(Data);
     366  if SwapData then Data := SwapEndian(Data);
    367367  Write(Data, SizeOf(Int64));
    368368end;
     
    415415procedure TStreamHelper.WriteWord(Data: Word);
    416416begin
    417   if SwapData then Data := Swap(Data);
     417  if SwapData then Data := SwapEndian(Data);
    418418  Write(Data, SizeOf(Word));
    419419end;
  • trunk/Packages/TemplateGenerics

    • Property svn:ignore set to
      lib
  • trunk/UCore.lfm

    r2 r3  
    11object Core: TCore
    22  OnCreate = DataModuleCreate
     3  OnDestroy = DataModuleDestroy
    34  OldCreateOrder = False
    45  Height = 349
    5   HorizontalOffset = 629
    6   VerticalOffset = 266
     6  HorizontalOffset = 1692
     7  VerticalOffset = 323
    78  Width = 364
    89end
  • trunk/UCore.pas

    r2 r3  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UPakFile, UFindFile;
     8  Classes, SysUtils, FileUtil, UPakFile, UFindFile, UGame;
    99
    1010type
     
    1414  TCore = class(TDataModule)
    1515    procedure DataModuleCreate(Sender: TObject);
     16    procedure DataModuleDestroy(Sender: TObject);
    1617  private
    1718    procedure ExtractPakFiles;
    1819  public
     20    Game: TGame;
    1921    procedure Init;
    2022  end;
     
    3436procedure TCore.DataModuleCreate(Sender: TObject);
    3537begin
     38  Game := TGame.Create;
     39end;
    3640
     41procedure TCore.DataModuleDestroy(Sender: TObject);
     42begin
     43  FreeAndNil(Game);
    3744end;
    3845
     
    6067begin
    6168  // ExtractPakFiles
     69  Game.IW := $20;
     70  Game.LoadData;
    6271end;
    6372
Note: See TracChangeset for help on using the changeset viewer.