Commit Graph

92 Commits (fec9ac268d1a2dad11423e38771dd82f980cbd54)

Author SHA1 Message Date
En Yi fec9ac268d Adjust simple collision function signatures
Remove redundant position argument for the straightforward collision
functions, as the entity would have it alread.

The collision offset check function is not as trivial and requires
some review
2024-04-22 22:31:58 +08:00
En Yi a2c061c5e8 Place position field into Entity
Position is so commonly used that placing it into Entity from the
CTransform components reduces the reference to CTransform.

Void Particle proved that it made development much easier.
2024-04-22 22:15:21 +08:00
En Yi d5c6d05558 Add action to set spawn point 2023-11-23 20:52:51 +08:00
En Yi 05e58677a5 Add angle and rotation range for particle system 2023-11-22 23:18:08 +08:00
En Yi 96d389a69a Fix mistake in ground check 2023-11-22 21:41:06 +08:00
En Yi 1311c2f0b7 Fix ground check
Use line check instead of box check
2023-11-22 21:04:00 +08:00
En Yi 1fa48b2176 Tweak engine config
Internal Changelog:
- Increase max entities
- Increase max active emitters
2023-11-22 00:27:08 +08:00
En Yi 637319cfd0 Fix one-shot stream emitter 2023-11-22 00:12:09 +08:00
En Yi f94ecedc7d Fix aliveness check for emitter
Emitter aliveness should be checked with its finish state

Also update bubbling to re-activate an still alive handle
2023-11-20 22:47:30 +08:00
En Yi ad789329d1 Add emitter component
Also, add funciton to check if emitter handle is still alive
2023-11-20 22:06:58 +08:00
En Yi 8165cd41c2 Rework stream handling function
Changelog:
- Add callback function to stop the emitter
    - This is use to automatically stop the emitter when the condition
      is met
- Update particle test program
2023-11-20 20:48:41 +08:00
En Yi be75263c2c Implement stream-type particle emitter 2023-11-18 19:44:20 +08:00
En Yi cb0a93ee70 Implement feature to start and stop emitter 2023-11-18 15:48:43 +08:00
En Yi 5350c2b761 Refactor particle system for future feature
This is to support persistent emitter later on

Also, re-check the update logic
2023-11-18 12:45:57 +08:00
En Yi 3f5e1648c1 Fix regression in AABB collision 2023-11-16 00:03:26 +08:00
En Yi 7dd4c8413b Add action to toggle grid for sandbox 2023-11-15 23:30:13 +08:00
En Yi 0b5f34b9f3 Modify water upthrust behaviour
Changelog:
- Upthrust now depends on water area overlap with entity
- Fix complete overlap checks
2023-11-14 22:31:28 +08:00
En Yi 72c27ed92e Add more SFX
Also, revert crate ground state behaviour
2023-11-13 14:23:31 +08:00
En Yi 8529a2c934 Use unsigned int for rres Id as per the struct 2023-11-11 13:04:24 +08:00
En Yi 2968172921 Use signed int for water runners 2023-11-11 12:06:19 +08:00
En Yi 15bb9c84ae Remove unused prev_pos in box edge checking 2023-11-11 11:56:08 +08:00
En Yi b150b3ad38 Change to manual init for entity tag map
The entity tag mapping is not that used often enough.

So, change it to manual init.
2023-11-11 11:14:22 +08:00
En Yi d660b4e5a5 Add sound loading from rres file
Also, fixes mistake in raw data size when loading from RRES file
2023-11-07 21:49:15 +08:00
En Yi 4ede1abcc1 Fix crashes in main application
Changelog:
- Fix crash on empty emitter config
- Fix engine de-init order
- Update assets file to load for main application
2023-11-07 20:47:30 +08:00
En Yi 716393e9f4 Replace fmemopen when adding zst from rres
Changelog:
- Modify zst load function to accept buffer containing the zst data.
    - Manually manage the buffer reading
- Reading from zst file will load entire zst in memory first before
  passing into load function.
2023-11-07 20:46:05 +08:00
En Yi 26cc567b7f Add emitter config to asset file loading 2023-11-06 21:36:23 +08:00
En Yi 0c540d5053 Move frame counter out of sprite component
This allows individual animation
2023-11-04 20:32:29 +08:00
En Yi ebecc68941 Add better support for particle system
Changelog:
- Move sprite to emitter itself to allow better reusing emitter config
- Dedicate a function for destroying entity. This is helpful for dealing
  with events that only occurs during entity destruction
2023-11-04 14:36:59 +08:00
En Yi e4bd3fdcab Update Cmake files
Changelog:
- Add Wextra compilation
- Update libzstd link directory
2023-11-02 23:11:28 +08:00
En Yi a8b62f5aec Integrate particle system into scenes
Changelog:
- Each scene will have its own particle system to maintain
- Crate destruction now emits particles
- Draw particles during screen renders
    - May want to make this configurable
    - Should be in general scene render
2023-11-02 22:44:52 +08:00
En Yi 43aa821c18 Refactor particle system
Changelog:
- Config should contain constants that determine the spawning of an
  emitter.
- Move user_data and update_func to emitter, since these values can
  change depending on the scene.
- Assets now load in Emitter Configs
2023-11-02 22:42:18 +08:00
En Yi 7939b8753e Add particle emitter to assets 2023-11-02 21:44:25 +08:00
En Yi ad421d724a Add sprite rotation 2023-11-02 21:18:47 +08:00
En Yi dc0fcc381c Add size support for particle 2023-11-01 22:36:44 +08:00
En Yi edf78412dc Improve particle system
Add support for texture and rotation
2023-11-01 22:18:40 +08:00
En Yi 7c86e0b3c5 Implement initial particle system
Changelog:
- Can only to one-shot burst emitter
- Add test for it
2023-10-21 14:37:54 +08:00
En Yi 290dafdf86 Rework scene rendering function
Split off- and on-screen rendering. Off-screen rendering would be a
system now
2023-10-21 10:48:21 +08:00
En Yi 7b2c48524d Add skeleton for particle system 2023-10-18 21:45:19 +08:00
En Yi 7dc66945da Add in engine configuration
All engine constants now sits in a single header file for easy tweaking
Also, SFX list fields is now an array rather than a pointer instead.
2023-10-13 21:55:30 +08:00
En Yi b9b0c11524 Separate out engine from scenes
This creates stronger separation the engine stuff from game
implementations.

way overdue tbh
2023-10-13 21:26:42 +08:00
En Yi 7b3685b792 Refactor for better separation of concern
Changelog:
- Separate out engine-specific stuff vs game-specific stuff
2023-05-16 21:09:38 +08:00
En Yi ee4313adbb Add a sprite for player 2023-05-15 20:48:56 +08:00
En Yi bafb32501f Replace mempools free list data struct
Changelog:
- Use circular buffer instead of sc_queue
    - The size is already known beforehand. So circular buffer seems
      to be more appropriate
2023-05-13 15:14:05 +08:00
En Yi 64c3532305 Replace method to get Scene specific data
Changelog:
- Use CONTAINER_OF macros to get scene specific data
- Remove unnecessary scene_data from Scene_t
- Still use pointer to scene specific data as these data could be
  quite heavy on memory
2023-05-07 21:04:24 +08:00
En Yi 49b5a19cad Fix Out of buffer access in tilemap
Others:
- Change HUD BG colour to lightgray
- Use CONTAINER_OF macros to access specific scene data in editor scene
2023-05-07 19:29:35 +08:00
En Yi cd71dae730 Add camera and game viewport
Changelog:
- Add 2D camera to level scene
- Add camera update system to level systems
- Add viewport to draw the level
    - This allows larger level to fit inside the window
- Update mouse handling to account for camera and viewport
2023-05-07 19:15:15 +08:00
En Yi d4dfe01182 Slightly rework scene rendering
Changelog:
- Draw calls are now in rendering function of a scene
    - This is to allow flexibility on how a scene is rendered
- Modify level scene to render level using RenderTexture
    - This is to prepare for camera implementation later
- CloseWindow is called after all de-init functions is called
2023-05-07 16:25:03 +08:00
En Yi 9eb46d0e57 Implement ladder mechanics
Changelog:
- Change ladder to be in player state component
- Add ladder state transition
    - Hold up or down to enter ladder when overlap with ladder
    - On ground, ladder has to be on foot
    - Either jump or exit a ladder to exit ladder state
- Ignore external forces during ladder state
    - Ladder uses velocity instead of acceleration to move player
- Reduce jump speed if not on ground (such as on ladder)
- Make water transparent, finally
2023-05-06 18:39:10 +08:00
En Yi c44696c1f8 Fix ladder spawning solid issue
Changelog:
- Add checks for ladder's solidity when spawning/despawning ladders
- Move crouch state check into player movement system
- Add ladder state for later implementation
2023-05-06 12:19:15 +08:00
En Yi b9a0bfe7b1 Add ladder toggling
Changelog:
Ladder acts as one-way platform on top, not solid otherwise
2023-05-06 11:49:12 +08:00