Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label cursor states (and more) #1000

Merged
merged 18 commits into from Apr 7, 2021
Merged

Conversation

eddebaby
Copy link
Contributor

@eddebaby eddebaby commented Apr 6, 2021

Some proposed names for DK fields and values.

Please make suggestions and criticisms.

Read through the complete functions process_dungeon_control_packet_dungeon_control() and process_dungeon_power_hand_state() to get the best idea of the use of these DK fields.

names given to PlayerField454Val enums

and player field_454 and field_455

they are now:
enum PlayerCursorStates {
    CSt_DefaultArrow = 0,
    CSt_PickAxe,
    CSt_Key,
    CSt_PowerHand,
};

and

player.char primary_cursor_state
player.secondary_cursor_state

The new names all seems to make sense
PlaF_Unknown20 becomes PlaF_TaggedForDigging

Pf3F_Unkn01 becomes Pf3F_nothing_to_touch_under_cursor

Pf3F_Unkn02 Pf3F_chosen_subtile_is_not_floor

other guesses added as comments
@eddebaby eddebaby changed the title Label cursor states Label cursor states (and more) Apr 6, 2021
@eddebaby eddebaby requested review from Loobinex and SimLV April 6, 2021 00:04
src/engine_redraw.c Outdated Show resolved Hide resolved
src/packets.c Outdated Show resolved Hide resolved
@eddebaby
Copy link
Contributor Author

eddebaby commented Apr 6, 2021

See the changes to player_data.h for all of the DK fields with new names, or guesses for usage

@eddebaby
Copy link
Contributor Author

eddebaby commented Apr 6, 2021

I should maybe change all instance of player->field_3 |= Pf3F_chosen_subtile_is_not_floor; to set_flag_byte(&player->field_3,Pf3F_chosen_subtile_is_not_floor,true); etc

It makes it clearer that a flag byte is being toggled. [This was not done]

to Pf3F_chosen_subtile_is_high
to Pf3F_nothing_under_power_hand

as it is turned on when player->thing_under_hand == 0

guesses for PlaF_Unknown10 and PlaF_Unknown80 added
Pf3F_Unkn04 is Pf3F_alternate_palette_is_active

and

Pf3F_Unkn08 is Pf3F_lightning_palette_is_active

player.field_7 is player.palette_B
player.palette is player.palette_A
src/player_data.h Outdated Show resolved Hide resolved
src/player_data.h Outdated Show resolved Hide resolved
src/player_data.h Outdated Show resolved Hide resolved
Used the value names from PlayerCursorStates to replace the use of 0-3 being assigned to `context`

also added other notes about cursor states

bugfix (missed a rename of CSt_Key to CSt_DoorKey)
@eddebaby
Copy link
Contributor Author

eddebaby commented Apr 7, 2021

Some nice new finding for the cursor states in 8928e21.
I was trying to find out where the cursor states were set, and I found that this happened in get_player_coords_and_context() in front_input.c with the use of "0", "1", "2", and "3"

eddebaby and others added 10 commits April 7, 2021 14:25
in packets.c `dungeon->task_count` was being compared to 300, this must be MAPTASKS_COUNT which is used to define the size of: `struct MapTask task_list[MAPTASKS_COUNT];` in dungeon_data.h
to PlaF_ChosenSlabHasActiveTask

it is more accurate to its use in the code. Comment expanded to explain the context it which it is used (in KFX codebase)
pckt->additional_packet_values - it uses the flags and values from `enum TbPacketAddValues`
to player.additional_flags and PlayerAdditionalFlags

updated the comments of PlayerAdditionalFlags and formatted the value names correctly.

Added whitespace to player_data.h to improve formatting
to palette_fade_step_pain and palette_fade_step_possession
revert commit 89972b7

and switch the logic of two if statements to achieve the same effect as commit 89972b7 (Screen will turn blue when frozen in possession)
renamed:
Pf3F_Unkn04 (PlaAF_AlternatePaletteIsActive) to PlaAF_FreezePaletteIsActive
player->field_7 (palette_B) to lens_palette
player->palette (palette_A) to main_palette
they are now: PlaF_Unknown10
 -> PlaF_KeyboardInputDisabled
and
PlaF_Unknown80 -> PlaF_MouseInputDisabled
@eddebaby eddebaby marked this pull request as ready for review April 7, 2021 22:25
@eddebaby
Copy link
Contributor Author

eddebaby commented Apr 7, 2021

For reference: commit f4e64df used a reverse-engineer of the original functions to fix the old KFX bug (with showing blue pal in 1st person when hit with freeze).

@Loobinex Loobinex merged commit 4227ba8 into dkfans:master Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants