Commit Graph

83 Commits

Author SHA1 Message Date
d55fb31e21 host.cmake, win9x.cmake: fetch libfixmath if missing 2022-06-30 22:49:35 +02:00
c4a24800b8 menu.c: center play button on screen 2022-06-29 01:01:31 +02:00
391c8958b1 button.c: fail on negative width 2022-06-29 01:01:03 +02:00
cff35e88f5 gui: implement {h,v}centered 2022-06-29 00:39:06 +02:00
23f24016da font: implement font_dim 2022-06-29 00:27:33 +02:00
6d5aa57e6d Deprecate memset(3) for zero-init 2022-06-27 21:56:43 +02:00
a746ecd0b6 human_player_gui.c: fix segfault when selecting one unit
Checking against `sel` is just plain wrong, since it always expected to
be non-NULL, since `h->sel` is an array defined in `struct
human_player`. Instead, `sel->d.i` is the pointer that should be
checked.
2022-06-27 21:43:32 +02:00
e869bfd0f6 human_player: deprecate memset(3) for zero-init 2022-06-26 23:42:48 +02:00
4305732e0a human_player.c: reset deselected instances 2022-06-26 23:42:48 +02:00
7196c6a0cc Fix hp bar not being displayed when carrying 2022-06-26 23:42:34 +02:00
afc554167e ps1/heap.c: bump heap size 2022-06-26 21:51:51 +02:00
c401b7663d Implement main menu 2022-06-26 21:51:47 +02:00
70bc98f96c terrain: fix wrong rendering
The older implementation would leave empty areas on the right side of
the screen.
2022-06-26 20:00:27 +02:00
ad1d6b1f66 font: deprecate font_printf
This function is no longer needed since `gui` was revamped.
2022-06-26 20:00:27 +02:00
7c75118429 Revamp gui component
`gui` was tighly coupled to game logic, and could not be extended for
other purposes. Therefore, a generic GUI implementation, loosely
inspired by well-known GUI frameworks such as GTK, is now provided, with
the following properties:

- Does not depend on dynamic or static memory allocation, only automatic
(i.e., stack) memory allocation required.
- Portable among existing implementations.
- Simple to extend.
- Tiny memory footprint.

`gui` is now composed by GUI elements that can be chained to form a tree
structure. This is useful e.g.: to calculate X/Y coordinates for a given
GUI element given its parent(s).

This commit also refactors the older implementation, moving
game-specific logic into `player` and making use of the new component.
2022-06-26 20:00:27 +02:00
f17c76c400 font: add font_puts 2022-06-26 20:00:27 +02:00
2c5973ee7e peripheral.c: initialize common members only
Other members will be initialized according to peripheral configuration.
2022-06-26 20:00:27 +02:00
f938bb790e Deprecate memset(3) over C99 compound literals for zero-init
Using memset(3) does not ensure pointers are assigned to NULL for all
platforms.
2022-06-26 20:00:27 +02:00
eee1205446 player: limit data sizes for resources and population
- All platforms should allow for the same resources.
- Population is not expected to exceed UCHAR_MAX on any platform.
2022-06-26 19:58:46 +02:00
9da37c198e camera: implement fixed cursor movement
On platforms with PERIPHERAL_TYPE_PAD, navigating through menus and
options can be cumbersome if moving the cursor freely around the
screen.

Therefore, this commit instead defines a list of (X, Y) coordinates that
the cursor can jump to. The implementation also attempts to guess which
direction the cursor should jump to for the previous/next point, and
hence determine which button should be pressed by the user.
2022-06-24 17:45:50 +02:00
8ddea5eef5 camera.c: refactor cursor_init
So that uninitialized members are set to 0.
2022-06-24 17:45:14 +02:00
992e7fb935 peripheral: provide common actions
Whereas some actions are context-specific (e.g.: selecting a player),
some are context-independent and can be executed for all screens
(e.g.: exiting the game).
2022-06-24 17:28:38 +02:00
5ac01ff845 README.md: add copyright notice 2022-06-24 17:20:05 +02:00
d140dcd278 README.md: update according to current status 2022-06-24 17:19:27 +02:00
c831272f29 cmake/ps1.cmake: use add_library for libpsx.a 2022-06-19 03:51:36 +02:00
7c1795401b Deprecate <TARGET>_BUILD in favor of CMAKE_TOOLCHAIN_FILE 2022-06-19 03:09:28 +02:00
3cb276b19f camera: remove dependency against terrain
This will allow using camera for purposes other than showing the game
map.
2022-06-12 23:19:03 +02:00
0f9e2d8958 Split peripheral-related logic into its own component
This has several advantages:

- `camera` no longer needs to define public functions for each
peripheral type.
- Peripheral-related is now no longer tighly coupled to human_player,
so peripheral logic can be reused elsewhere e.g.: on menus.
- Makes camera_update_touch consistent compared to equivalent functions,
since now `pan` has now been moved to `camera` (as it should be).
2022-06-12 23:18:57 +02:00
5794dbf403 CMakeLists.txt: limit libraries linked to by ${PROJECT_NAME}
Old behaviour was linking to all components, but main.c currently only
needs a few of them.
2022-06-12 00:00:56 +02:00
a826c2364d sdl-1.2/sound.c: use SDL_WasInit 2022-06-11 23:42:30 +02:00
3f6bf6aa1a sdl-1.2: return to original dimensions on fullscreen exit 2022-06-11 23:42:30 +02:00
a84a55aa25 Implement button component 2022-06-11 23:42:27 +02:00
9b75ff3c2e res: add btn_{left,mid,right} 2022-06-11 23:41:56 +02:00
c8362184ee res/CMakeLists.txt: do not use transparency for sel_mid_v 2022-06-11 23:11:49 +02:00
5464a50f96 README.md: reflect current status 2022-06-08 01:00:32 +02:00
0517c897c5 win9x.cmake: remove unneeded dependencies 2022-06-08 00:36:26 +02:00
99bb23e194 win9x.cmake: use target commands for SDL and SDL_mixer
Since libSDL.a and libSDL_mixer.a are compiled separately from this
project, some hacks had been used to get the build running. However,
this approach did not make proper use of target-level properties, which
are encouraged according to modern CMake standards over global-level
commands such as include_directories() or link_libraries().

OTOH, Win32 dependencies were being imported using link_libraries(), but
they in fact are SDL dependencies, so target_link_libraries() can be
used instead.
2022-06-08 00:36:26 +02:00
706d299af4 pad/CMakeLists.txt: add missing call to target_link_libraries() 2022-06-08 00:36:23 +02:00
d57cd4ad82 CMakeLists.txt: assume native build by default
This has been decided to make the de-facto standard CMake build process
(shown below) possible.

$ mkdir build
$ cd build/
$ cmake ..
2022-06-08 00:25:17 +02:00
a5f2f1a4ba CMakeLists.txt: build host tools as ExternalProject 2022-06-08 00:21:18 +02:00
787402efcf CMakeLists.txt: move target-specific logic away 2022-06-07 23:32:32 +02:00
9073d82ea6 Split CMakeLists.txt into platform-specific *.cmake 2022-05-24 22:20:04 +02:00
938ab93482 Make gfx_draw return int 2022-05-24 22:20:04 +02:00
132d8c860e Use realloc(3) directly
It is simply not true realloc(3) cannot be used with NULL pointers.
2022-05-24 22:20:04 +02:00
77d16c32cc font.c: avoid several va_list in favor of large buffer 2022-05-24 22:20:04 +02:00
dea345f412 Allow systems without sound support 2022-05-24 22:20:02 +02:00
354034b06b Remove unused minor stuff 2022-03-31 07:30:14 +02:00
b8c30e83e3 resource.c: decouple collbox from sprite dimensions 2022-03-31 07:29:16 +02:00
405819eef9 font*.bmp: Fix transparency on 6 2022-03-31 07:28:21 +02:00
360f14aa24 Fix exit condition 2022-03-31 07:27:22 +02:00