DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T V

⟦a0c4e261c⟧ TextFile

    Length: 4352 (0x1100)
    Types: TextFile
    Names: »V«

Derivation

└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00
    └─ ⟦0c20f784e⟧ »DATA« 
        └─⟦1abbe589f⟧ 
            └─⟦306851c02⟧ 
                └─⟦this⟧ 

TextFile

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
------------------------------------------------------------------------------

--\f

------------------------------------------------------------------------------
-- 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;

--\f

    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;