kts
|
c7f3ac15d3
|
added pack_tiles.c, providing pack_tiles, a program that takes a directory as an argument and creates a new file (directory/directory.tsd) from cleaned files 'doors', 'floors', 'npcs', 'walls', 'equips', 'items', and 'players' in that directory. At the moment it can be used on the xibalba directory to create 'xibalba/xibalba.tsd', which can then be tested with test/t2d.c, providing the internal filename referenced is changed. At the moment the Data system does not properly deal with inventories so any inventory/equipment declaration is ignored.
|
2013-12-21 02:38:08 -08:00 |
kts
|
0005a93d65
|
Implemented Data system fully now (not integrated into ts engine itself yet). In the process added a new Table (hash table) system that matches keys to values. More information pertaining to that in data.h/data.c. Might switch over to a system wherein all Tiles are actually TileData structs (or contain TileData structs). This would increase the processing necessary, as values for properties must be acquired from a string instead of reading from a pre-defined struct, but it would increase the modularity immensely as there is no real limit on the amount of properties a Tile may contain (which will be most important once the interpreter is implemented and used for tile movement, collisions, etc.).
|
2013-12-20 18:24:06 -08:00 |
kts
|
e2e015c76b
|
Added two folders: test/ and xibalba/. Contained within test/ are two test/devel-beds for two systems that will be integrated within ts. The first is script.c, which is the development program for the interpreter system - this interpreter system allows for the setting of variables (both local and global), the creation of new functions, and the definition of default in-game functions such as dice rolling and the like. The second file, t2d.c functions as a basic test utility for Tile Data loading and the like - it interprets a tileset/tile definition file into Data, TileDataSet, and TileData(s) respectively. These structs, as defined in data.c/.h, allow for reference to tiles by TID:ID or simply by name through the use of key=>value pairs. It is from these structs and their accompanying access functions that new Tiles will be created (perhaps later optimized through a basic Tile array that contains semi-populated Tile(s) that can be memcpy'd similar to the current system). Also added the xibalba/ sub-dir that will contain the various data for Xibalba (tile definitions, graphics, map creation, etc.), moving majority of what is in tiles/ into xibalba/.
|
2013-12-17 17:08:37 -08:00 |
kts
|
b3a3831cd2
|
Added EquipTile/EQUIP. This distinguishes equipable items such as weapons, armour, rings, etc., from non-equipables such as keys and the like.
|
2013-11-27 18:31:49 -08:00 |
kts
|
770ad240e2
|
Updated Xcode to include parser.c/.h. Since it was not mentioned in last commit, parser.c/.h contains functions related to parsing slots, adding slots together, doing comparisons between slots, etc.. It is also where dice parsing and stat parsing will go as well.
|
2013-11-26 16:08:13 -08:00 |
kts
|
ef59c0a365
|
Equipping and unequipping items now fully implemented. Uses the player's slots and used_slots properties along with the target item's required slots property. used_slots+required_slots are checked against slots and if less than, used_slots is changed accordingly. Unequipping removes required_slots from used_slots. equipmentContext added for equipping/unequipping as well. interface/sdl.c changed so that the focused UI (being either inventory or equipment) is at a higher opacity than the unfocused UI.
|
2013-11-26 16:02:04 -08:00 |
kts
|
375067aa8a
|
Added some equipment-related code, but it needs to be reworked entirely. Equipment should just be an instance of Inventory, not its own struct.
|
2013-11-25 00:59:08 -08:00 |
kts
|
d368c1efd0
|
Implemented the basic system for slots, stats, and damage wherein the type and amount of slots, stats, or die rolls are defined in their respective Tiles as a string. Although this has computational shortcomings due to parsing, it is the most flexible of all and forces no hard-coding on slot types or stat types. It can later be optimized, of course, as the size of each ItemTile, PlayerTile, and NpcTile has increased by at least 128 bytes. Note that some code is left-over from when the initial slot system was written using structs. Additionally, inventoryContext now handles up and down appropriately, and the inventory display has been improved. Along with the inventory display, an equipment surface is shown, although at the moment it lacks any equipment listing.
|
2013-11-23 03:28:38 -08:00 |
kts
|
d10407fb38
|
Added functions descriptions in various *.c files. Should be in the header files, but for me, having the comments with the code is far better (since it's all in-development). interface/sdl.c should likely be split into multiple files, as it handles netcode, basic graphics operations, user input, and drawing the various UI elements all in one file.
|
2013-11-21 18:20:20 -08:00 |
kts
|
bd67818190
|
Added tile_scale command that calls consoleScaleTiles(const char *string). This then converts the passed arguments of 'float x float y' (e.g., 'tile_scale 1.0 1.0' to scale to 1.0 times) to scaleTiles(float scale_x, float scale_y). If no argument is passed in the string, the default 2.0 scale is used. If the y property is not passed, the value of scale_x is used for scale_y.
|
2013-11-17 17:05:55 -08:00 |
kts
|
4e6f983db8
|
win32/64 uncovered out-of-bounds reading/writing for getpixel/putpixel in interface/sdl.c, so both functions now check if x/y is greater than or equal to 0 and less than or equal to the surface's width/height.
|
2013-11-17 16:37:10 -08:00 |
kts
|
7e7a4bd2fe
|
Added drawScaledSpriteOutline function that (basically) draws an outline of the given sprite from the passed spritesheet. Although this function could later be used for drawing items/players behind tall objects, it is only used to outline the selected item while in the inventory screen at the moment. The function produces many warnings during compile, but they will be fixed later. Most of the draw*Sprite* functions should be combined - that is to say, drawScaledSprite and drawSprite should likely be the same function that chooses which spritesheet to use via a passed flag.
|
2013-11-17 16:02:49 -08:00 |
kts
|
81b566f9c8
|
No real changes, only minor tweaks to the trasparency of the inventory UI.
|
2013-11-16 23:23:43 -08:00 |
kts
|
2776c9a91c
|
Updated devcpp projects to use inventory.c and inventory.h - works ok.
|
2013-11-16 16:22:43 -08:00 |
kts
|
6ad2ae9a5b
|
NULL wasn't declared on non-xcode environment, so string.h was included (over stddef.h, as sprintf was required). Inventory window, such as it is, is created according to the max_slots/slots_per_row properties of the Inventory, thus adjusting for larger inventories. The current item's name is now shown at the center-bottom of the window. Dropping items is also tidier, as the inventory->selected property is adjusted if it is equal to count (i.e., the selected cursor is pushed back when the last item is removed so selected always corresponds to an existing item).
|
2013-11-16 16:15:22 -08:00 |
kts
|
d50282effa
|
We now have a mostly working inventory system. Items can be picked up via ` and dropped using ` within the inventory. Currently using a new playerPickup() function, but it should be abstracted to a tilePickup(struct Tile *tile) function so that npcs, etc., can share in the fun.
|
2013-11-16 04:41:06 -08:00 |
kts
|
4b7e0db3e0
|
Added rudimentary Inventory display, however we must have some way to keep track of the selected item in inventory offset. Perhaps through a global variable or, if it must be done, through a new Inventory struct that contains pertinent information. It should likely be the latter, so the same system can be expanded to chests and the like. Also added the ITEM type in general.
|
2013-11-16 02:15:03 -08:00 |
kts
|
57a1b46db4
|
Created a new Spritesheet struct for loading and managing spritesheets - has two SDL_Surfaces, one scaled, the other original. Also has various properties related to scale size, columns in a row, etc.. Changed interfaceDraw() to use the new system. Also, the tile in front of the player is drawn at partial opacity if it is a WALL or a DOOR. Moved the position of the UI around.
|
2013-11-15 18:19:54 -08:00 |
kts
|
981e0cd2f2
|
Added SDL_image.framework as a framework to include in the produced app, thus allowing timesynk.app to run w/o dependencies.
|
2013-11-15 14:00:26 -08:00 |
kts
|
81c3ea6fdc
|
Moved a portion of the user messages (e.g., 'You open the %s.') to various #define MESSAGE_* in message.h. Also fixed the bug I never looked into where entries in consoleLog would read past the string into neighboring memory - this was due to using strlen(string) for the byte-length in memcpy, as strlen does not count the terminating character '\0'. Fixed by adding +1 to the return value of strlen
|
2013-11-14 16:21:53 -08:00 |
kts
|
23455ccd5c
|
Tidied up interface/sdl.h somewhat. Fixed most of the compiler warnings from interface/sdl.c. Also touched up font_mini.png to make it a bit more readable.
|
2013-11-14 15:15:42 -08:00 |
kts
|
8893eb35d4
|
Did a hack to get transparency working on big endian systems - basically it grabs a portion of the pixel color value and uses that for alpha. This is terrible, but I did not want to waste time trying to figure out what was wrong, as it is more of a tertiary feature. Beyond that, added a new font_mini.png spritesheet that contains an 8x8 ASCII font. This is currently used in the new UI messages system, which is basically a window that is drawn over the map with the current in-games messages. At some point this will be split into two different categories, one from the PC perspective and the other from the player perspective (e.g., 'you bludgeon the nupi' - '4 damage (1d6+1)'). Also added a new Font struct that contains: int width, int height, SDL_Surface *spritesheet, float scale_x, float scale_y, and SDL_Surface *scaled_spritesheet. Helper function added of loadFontFromMemory(struct Font *font, unsigned char *memory, unsigned int length, int font_width, int font_height) - this creates a new SDL_Surface from the passed memory and sets the passed font's surface to it along with the width and height. Also added was a setFontScale(struct Font *font, float scale_x, float scale_y) - this calls interfaceScaleSurface on the font's spritesheet and sets scaled_spritesheet to point to that new surface. For the time being, the new font is used through interfaceDrawStringF and interfaceDrawCharF, two functions that closely match their normal counterparts, but instead use a passed font and its values for drawing. The normal draw char/string functions will likely be replaced with the new ones.
|
2013-11-14 03:03:10 -08:00 |
kts
|
d7ad2c3bd6
|
Added uiInit(), a function that creates ui_hotbar_surface, blits the appropriate ui.png sprites to it, then sets the opacity to 0.75. At the moment, ui.png must be in RGBA format due to my lack of knowledge on alpha blending, etc. - this shall be changed later for optimization. Added the SDL_SetOpacity(SDL_Surface *surface, double opacity) function that sets the alpha layer of the target surface to the desired amount. Along with this is the uiSetOpacity helper, which simply calls SDL_SetOpacity on ui_hotbar_surface. Also added uiSetScale which simply calls interfaceScaleSurface(SDL_Surface *surface, float x, float y) on ui_hotbar_surface. interfaceScaleSurface does a rough up/down-scale of the target surface - has not been thoroughly tested for bugs, so it has the potential to break.
|
2013-11-12 02:41:32 -08:00 |
kts
|
0c24fedfb2
|
Added some rudimentary UI related stuff: ui.png with the first 32x32 section being a hotbar item; uiDraw(), which draws hotbar_count(value to be controlled by amount of items w/ slots the player has (e.g., belt, slotted glove, etc.)) amount of hotbar item images at partial translucency. Also added hitting 'i' to switch to/draw the inventoryContext - at the moment, it does nothing more than cause an SDL_Rect to be drawn and switch to inventoryContext (which does nothing in itself).
|
2013-11-11 02:35:47 -08:00 |
kts
|
639d4b9fcb
|
Added a preprocessor conditional for OS X for SDL_Init, as SDL_INIT_EVENTTHREAD causes the program to become unresponsive (although still tick the world) akin to Win32/64. Fixed a crash when activating a non-existent Tile, as it would simply attempt to read the null tile.
|
2013-11-10 02:48:57 -08:00 |
kts
|
1c6389866b
|
Fixed some leaks and re-enabled freeMap.
|
2013-11-10 02:06:17 -08:00 |
kts
|
cf94f135c6
|
Added tile scaling via interfaceSetScale. This currently modifies the various spritesheet->Surface(s) loaded from tiles.c/pack_tiles, but they should modify live alternatives, so that changes always start from the original surfaces. Also created shading on the rock wall, created a new palisade wall, and also fixed/prettified the current doors.
|
2013-11-10 01:01:07 -08:00 |
kts
|
68beec3d2b
|
sockets now work on windows, also discovered that echo is completely broken between timesynk instances running on multiple systems - telnet works fine still tho. Will have to recode netcode to see what's wrong. Also added sendall function which should guarantee the send()ing of a buffer (no waiting).
|
2013-11-07 01:11:49 -08:00 |
kts
|
7bc43929e0
|
Added much code for the foundation of the netcode. Server automatically starts on port 31337 and runs as a separate thread in the SDL client. This TCP server functions as a basic echo server and can be connected to thru telnet or by typing 'connect 127.0.0.1 31337' in timesynk's console. Once connected, the echo functionality can be tested by using console command 'send my message goes here'. Somewhat buggy and crashses on occasion - suspected cause is consoleLog()ing a string that is not properly nul terminated, resulting in reading memory out of bounds. Curses client does not run the server properly at the moment, probably due to using select on server, clients, and stdin when combined with ncurses - will look into this later.
|
2013-11-06 23:40:19 -08:00 |
kts
|
df73d846d8
|
Both SDL and curses clients work on WIN32/64. The SDL client is fully working, as is expected, but the gameLoop timer/signal system does not work. The code is in place via preprocessor conditions but it would require a fake window to be created so the messaging system can be used.
|
2013-11-04 11:59:49 -08:00 |
kts
|
8fc710f3a2
|
Successfully recoded both SDL and curses client to use a model that ticks the world according to a Tick Event/Signal. How this works in SDL is a simple SDL Timer that pushes an SDL_USEREVENT with a code of EVENT_TICK at some interval in ms. The curses client works by calling setitimer with tickSignal as a callback, triggering whenever a SIGALRM signal is given. This was chosen for maximum cross-compatability for POSIX platforms, even though Linux has excellent timer fd support. Both the SDL and curses interfaces can have their tickrate modified by calling tickrate some_number_in_ms from the console. 0 stops the timer. For all of this to work, main() no longer has the while loop contained in it, but rather calls interfaceLoop() and lets the interface handle it (as this is extremely platform/api specific - some platforms have user input strongly tied into the drawing window (SDL), so we cannot use a monolithic select()-style while loop for all). Much more to be cleaned up, but this sets the foundation for network code.
|
2013-11-04 02:32:07 -08:00 |
kts
|
5edcc76a86
|
interfacePrint is no longer directly called in non-interface contexts, but rather is handled by a messaging system. When one tile wishes to tell another tile a message, whether that be for descriptive purposes such as opening a door or otherwise, messageTile(Tile *sender, Tile *recipient, const char *message) is called. Within that, if the recipient->tid is PLAYER, then it calls interfacePrint. This will later be modified to check if the recipient->data->controller matches the actual user's controller (thus tying messages to particular users only). Also added was the basic struct for controller, but it is thus far unused in actual game code. The Controller will be used once a basic network/game structure is in order.
|
2013-11-03 22:53:13 -08:00 |
kts
|
1f641bb92e
|
Due to various errors on windows, along with much rage, it was decided that it is far more sensible for consoleGetCommand to simply return command[0] as the command string and command[1] as the remainder, leaving the task of distinguishing one argument from another to the function that consoleProcessCommand passes it to. This is, of course, up for remodeling in the future (possibly by using a variable amount of arguments such as in printf), but for now it'll do. Also added C preprocessor conditions for strndup to allow on Win*.
|
2013-10-23 21:05:29 -07:00 |
kts
|
b567be76fd
|
Some minor tweaks made, majority of which I have forgotten already. DoorTile will soon be migrated to a generic TriggerTile type, in which it will exist as a DOOR subtype.
|
2013-10-23 18:58:17 -07:00 |
kts
|
129440ea01
|
changed intptr_t in some console funcs to size_t. The SDL window is now resizable
|
2013-10-22 12:13:48 -07:00 |
kts
|
c28a62d522
|
As per usual, added a bunch of stuff and remember almost none of them. Most importantly, a console interface has been added that can be summoned by pressing the tilde key. Much of the functionality, including the less-than-stellar associative array (that acts as a function pointer) was ripped from the noirchat project. The only important commands are 'quit' and, for SDL, 'set_video widthxheight 0|1', with 0 representing windowed and 1 representing fullscreen. Both the curses and SDL client now have camera offsets, allowing for the center of the screen to always be centered on the player. There are plans to have the camera offset be relative to the distance from the edges of the map (so if the player is 25% from the left-side of the map, the camera offset would be 25% off center). Really in need of code clean-up and reorganization.
|
2013-10-22 02:49:25 -07:00 |
kts
|
675e6862c5
|
Modified the devcpp projects to incorporate the many changes that have occurred since the last devcpp update. Also had to initialize the next and prev properties of Tiles created by newTile, as the generated executable segfaulted due to non-initialized pointers.
|
2013-10-19 23:28:31 -07:00 |
kts
|
29cdd11ec8
|
Added basic NPC/monster functionality as well as a console system. Simply call ConsoleLog(&string) and it'll create a new ConsoleEntry, set the console_last_entry's next to it, set the new entry's prev to console_last_entry, and finally set console_last_entry to point to the new entry (functions very similarly to Tile Chains). This may later be changed to an array form so as to easily pull sections of the log from anywhere.
|
2013-10-19 22:56:46 -07:00 |
kts
|
45ebcfe970
|
Added a temporary font spritesheet and the ability to interfacePrint in SDL with aforementioned font. This simply works by getting the numerical offset of the ASCII character value within the spritesheet (same principle as the rest of the tiles). In the future SDL_ttf will be used, but for the time being this will suffice.
|
2013-10-17 19:38:00 -07:00 |
kts
|
4c204db4f3
|
Added support for doors. A DoorTile is a fairly basic tile - at the moment - sporting a state int to specify its current state via STATE_OPEN, STATE_CLOSED, STATE_BROKEN, or STATE_MISSING. Graphically/ascii-ly, the proper visual appearance is acquired by multiplying the door id by the total door states(4) and adding the current state value to the result. For example, for a door with the id of 0, you would have visual tile 0 for closed, 1 for open, 2 for broken, and 3 for missing. Beyond the doors, the curses tiles were moved from interface/curses.(c/h) to tiles/curses_tiles.(c/h) - they should, at some point, be generated in a similar manner to the tiles for the SDL client (using pack_tiles).
|
2013-10-17 15:11:29 -07:00 |
kts
|
22e2d1c3a8
|
Fixed compiling on XCode via conditional #includes - also removed player_struct as the player is a Tile now
|
2013-10-15 19:51:43 -07:00 |
kts
|
33ab0f2af2
|
Renamed binary_to_c to pack_tiles and made it convert tiles/*.png to various char arrays in tiles/tiles.c and tiles/tiles.h. Added fully functional graphical tiles to the SDL client by using the tile's id and tid to point to the appropriate arrays in tiles.c/tiles.h. Also added proper displaying of multiple tiles on a tile chain, tile movement via gameMoveTile, tile line drawing via drawLine, along with other touch-ups
|
2013-10-15 18:54:23 -07:00 |
kts
|
6e414d9223
|
Who knows what has been added! As far as I recall, *context(s) were tweaked, added compiled-in graphics for the SDL client, and probably some other stuff.
|
2013-10-14 19:21:33 -07:00 |
kts
|
5c7cc7d267
|
Changed how the map is dynamically allocated, thus fixing the SDL client as well as the default client on non-powerpc architectures. Added a current_context function pointer that is called by the interface and governs how events/keypresses are handled in different contexts, such as walking or looking.
|
2013-10-10 01:55:18 -07:00 |
kts
|
e1a32045cf
|
Added a ton of stuff, SDL compile is broken, probably due to malloc issues. Must check over code in different environments.
|
2013-10-08 21:49:38 -07:00 |
kts
|
2d7a45e0b5
|
Map now resides on a multidimensional array titled map_matrix. This stores the Tiles in a Stack structure at each cell - I believe this should instead be changed so that each Tile instead has pointers to the previous and next Tiles, so that the map_matrix only holds Tile pointers rather than Stack structs containing some variable amount of Tile pointers. Also added a visible_matrix that denotes what tiles are visible to the player. This is simply a multi-dimensional array of ints that act as bit fields for various flags (such as TILE_VISIBLE, TILE_CAN_SEE, TILE_LIGHT_ONE, TILE_LIGHT_TWO, etc. - multiple light flags can be concatted to provide a broad array of light levels).
|
2013-09-28 20:50:52 -07:00 |
kts
|
3d1fb1de41
|
Added game.c, game.h, player.c, and player.h to the devcpp projects and successfully tested both the SDL and curses clients on Windows.
|
2013-09-19 23:13:11 -07:00 |
kts
|
1f973fc865
|
Added basic player movement through playerMove(direction, distance). Also added an interface through which player commands are attached to a command id, so as to allow for functions to be called via a command id or, if later implemented, a string. Finally, implemented the moving of an @ in curses or a square in SDL via the arrow keys.
|
2013-09-19 22:45:19 -07:00 |
kts
|
82e63acdc0
|
Added the devcpp/ subdirectory, containing two Dev-C++ projects corresponding to the SDL and PDCurses clients. The PDCurses project assumes curses.h and pdcurses.lib to be in "../../PDCurses/" and the SDL project assumes SDL's lib/ and include/ to be in "../../SDL-1.2.15/". Once either executables are compiled, PDCurses.dll and/or SDL.dll must be copied into the same directory as the corresponding executable.
|
2013-09-18 02:11:19 -07:00 |
kts
|
0c5dc4c822
|
Initial commit, contains a barebones structure with the interface for both (x)curses and SDL. Can be built via the Makefile or via the XCode project in the xcode/ subdirectory
|
2013-09-17 22:37:36 -07:00 |