DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦cb075b02f⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package Board, seg_005352

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Text_Io;

with Xlbt_Arithmetic;  
use Xlbt_Arithmetic;  
with Xlbt_Basic;  
use Xlbt_Basic;  
with Xlbt_Event;  
use Xlbt_Event;

package Board is
------------------------------------------------------------------------------
-- Dragon - a version of Mah-Jongg for X Windows
--
-- Author: Gary E. Barnes        May 1989
--
-- Board - deals with the playing surface
------------------------------------------------------------------------------
-- 05/30/90 GEB  - Translate to Ada
------------------------------------------------------------------------------

--\x0c
    ------------------------------------------------------------------------------
-- Global State
------------------------------------------------------------------------------

    N_Faces : constant := 42;           -- number of distinct tile faces
    N_Tiles : constant :=               -- number of distinct tiles in game
       ((N_Faces - 8) * 4 + 8);  
    N_Rows  : constant := 8            -- number of rows in game
    N_Cols  : constant := 16;           -- number of columns in game
    No_Tile : constant := 0;            -- tile codes are 1..NFACES

---Size of the Board.

    Board_Width  : S_Short := 29 * 15 + 1 + 8;  
    Board_Height : S_Short := 33 * 10 + 1 + 8;  
    Score        : S_Long  := N_Tiles;

----X/Y coordinate of a tile at coord 0,0 of the playing surface.

    Board_Tile0_X : S_Short := 4;  
    Board_Tile0_Y : S_Short := 4 + 2 * 33;

----Actual size of a tile, not counting the border around it.

    Tile_Width  : S_Short := 28;  
    Tile_Height : S_Short := 32;

----X depth and Y width of a shadowed area above/to-the-right-of a tile.

    Shadow_X : S_Short := 28 / 8;  
    Shadow_Y : S_Short := 32 / 8;

-- --X depth and Y width of tile edge below/to-the-left-of a tile.

    Side_X : S_Short := (28 / 10) / 2 * 2;  
    Side_Y : S_Short := (32 / 10) / 2 * 2;

----Each playing tile position is represented by one of these.

    type Board_Position_Rec is  
        record  
            Tiles : U_Char_Array (0 .. 3);  -- at most 4 tiles at one position
            Draw  : Boolean;                -- TRUE if needs drawing
            Level : S_Short;                -- how many tiles do we have
            X     : S_Short;                -- x coord of tile
            Y     : S_Short;                -- x coord of tile
        end record;

    type Board_Position is access Board_Position_Rec;

    type Board_Position_2d is  
       array (S_Short range 0 .. N_Rows - 1,  
              S_Short range 0 .. N_Cols - 1) of Board_Position;

    Board_Tiles : Board_Position_2d := (others =>  
                                           (others => new Board_Position_Rec));

-- #define SPEC1           0)(14        -- farthest right odd tile
    Spec1_Row : constant := 0;          -- farthest right odd tile
    Spec1_Col : constant := 14;         -- farthest right odd tile

-- #define SPEC2               2)(14    -- next farthest right odd tile
    Spec2_Row : constant := 2;          -- next farthest right odd tile
    Spec2_Col : constant := 14;         -- next farthest right odd tile

-- #define SPEC3          4)(14         -- farthest left odd tile
    Spec3_Row : constant := 4;          -- farthest left odd tile
    Spec3_Col : constant := 14;         -- farthest left odd tile

-- #define SPEC4                6)(14   -- center piece tile
    Spec4_Row : constant := 6;          -- center piece tile
    Spec4_Col : constant := 14;         -- center piece tile

-- --Record tile clicks and watch for double clicks.

    One_Button_Hint : Boolean        := False;  
    Click1          : Board_Position := null;  
    Click1_Row      : S_Short;  
    Click1_Col      : S_Short;  
    Click2          : Board_Position := null;  
    Click2_Row      : S_Short;  
    Click2_Col      : S_Short;  
    Click2_Time     : X_Time;

--\x0c
    procedure Hints        (Event : X_Button_Press_Event);  
    procedure Restart_Game (Event : X_Button_Press_Event);  
    procedure Read_Game    (File : Text_Io.File_Type);  
    procedure Write_Game   (File : Text_Io.File_Type);  
    procedure Set_Tile_Controls;  
    procedure Setup_New_Game;  
    procedure Tile_Press   (Event : X_Button_Press_Event);  
    procedure Tile_Release (Event : X_Button_Release_Event);  
    procedure Tile_Remove  (Event : X_Button_Press_Event);

end Board;  

E3 Meta Data

    nblk1=7
    nid=0
    hdr6=e
        [0x00] rec0=1e rec1=00 rec2=01 rec3=036
        [0x01] rec0=00 rec1=00 rec2=07 rec3=002
        [0x02] rec0=1e rec1=00 rec2=02 rec3=04e
        [0x03] rec0=16 rec1=00 rec2=06 rec3=080
        [0x04] rec0=02 rec1=00 rec2=03 rec3=018
        [0x05] rec0=18 rec1=00 rec2=04 rec3=01e
        [0x06] rec0=0b rec1=00 rec2=05 rec3=000
    tail 0x2170088c881978745ec6e 0x42a00088462063203