All pastes #778582 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-17 19:04 UTC
rendered paste body
// =====================================================================================================================
// main.c (Latest change: Nov 17, 2007)
// =====================================================================================================================

// =====================================================================================================================
//    Name:            C-adventure Editor (Caed)
//    Version:        0.0.1
//    Author:            Jose Alvaro Dominguez - [Ilgrim]
//    Homepage:        http://ilgrim.homelinux.org
//    E-mail:            ilgrim@gmail.com
//    Description:    Adventure interpreter, developed in GNU ANSI C.
// =====================================================================================================================

// Copyright (c) 2007, Ilgrim, BSD License.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//  * Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//  * Neither the name of Ilgrim nor the names of its contributors may
//    be used to endorse or promote products derived from this software
//    without specific prior written permission.
//
// This software is provided by the copyright holders and contributors
// "as is" and any express or implied warranties, including, but not
// limited to, the implied warranties of merchantability and fitness for
// a particular purpose are disclaimed. in no event shall the copyright owner or
// contributors be liable for any direct, indirect, incidental, special,
// exemplary, or consequential damages (including, but not limited to,
// procurement of substitute goods or services; loss of use, data, or
// profits; or business interruption) however caused and on any theory of
// liability, whether in contract, strict liability, or tort (including
// negligence or otherwise) arising in any way out of the use of this
// software, even if advised of the possibility of such damage.

// =====================================================================================================================
// Libraries.
// =====================================================================================================================

#include <stdio.h>

// =====================================================================================================================
// Data structures.
// =====================================================================================================================

// Room exits structure layout:
// As directions (keypad):      As height:                Other cases:
// - room_exit[8] -> North      - room_exit[1] -> Down.   - room_exit[7] -> No exit.
// - room_exit[4] -> West       - room_exit[3] -> Up      - room_exit[9] -> Special case.
// - room_exit[6] -> East
// - room_exit[2] -> South

typedef struct {
 int  room_id;          // Identifier.
 int* room_exit[1024];  // Exit layout. (array, there could be more than one exit)
 int* room_flag[1024];  // Flags set. (Hidden room, accesable, introduction...)
 char room_name[1024];  // Name that will be displayed.
 char room_desc[1024];  // Description that match the current room.
} room;

typedef struct {
 int  item_id;          // Identifier.
 int* item_flag[1024];  // Flags set. (Hidden object, can be carried, weight, value...)
 int* item_locs[1024];  // Locations. (Item can exists in more than one location...)
 int* item_interaction;    // ¿ can it be used by the player ?

 char item_desc;        // Description.
 char item_name;        // Name.
} item;