-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f418d7
commit df35642
Showing
8 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
; client struct array to store player information | ||
tw_clients resb TW_CLIENT_SIZE * MAX_CLIENTS | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; TW_CLIENT_ID_OFFSET equ 0 | ||
; TW_CLIENT_NAME_OFFSET equ TW_CLIENT_ID_OFFSET + 4 | ||
; TW_CLIENT_CLAN_OFFSET equ TW_CLIENT_NAME_OFFSET + MAX_NAME_ARRAY_SIZE | ||
; TW_CLIENT_SIZE equ TW_CLIENT_CLAN_OFFSET + MAX_CLAN_ARRAY_SIZE | ||
|
||
set_client_info: | ||
; set_client_info [rax] [rdi] | ||
; rax = client id | ||
; needs unpacker to be at team field of the SV_CLIENTINFO msg | ||
; https://chillerdragon.github.io/teeworlds-protocol/07/game_messages.html#NETMSGTYPE_SV_CLIENTINFO_team | ||
push_registers | ||
|
||
; rsi is pointer into clients array | ||
mov rbx, rax | ||
imul rbx, TW_CLIENT_SIZE | ||
lea rsi, [tw_clients + rbx] | ||
|
||
; pop team | ||
call get_int | ||
|
||
; name | ||
call get_string | ||
mov rdi, rax | ||
lea rax, [rsi+TW_CLIENT_NAME_OFFSET] | ||
call str_copy | ||
|
||
pop_registers | ||
ret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
on_chat: | ||
; on_chat [rax] | ||
push_registers | ||
|
||
; mode | ||
call get_int | ||
|
||
; client id | ||
call get_int | ||
mov r8, rax | ||
|
||
; target id | ||
call get_int | ||
mov r9, rax | ||
|
||
; message | ||
call get_string | ||
mov r10, rax | ||
|
||
print_label s_chat | ||
|
||
; get author name | ||
mov rbx, r8 | ||
imul rbx, TW_CLIENT_SIZE | ||
lea rsi, [tw_clients + rbx + TW_CLIENT_NAME_OFFSET] | ||
print_c_str rsi | ||
|
||
call print_colon | ||
call print_space | ||
|
||
; print message | ||
print_c_str r10 | ||
|
||
call print_newline | ||
|
||
pop_registers | ||
ret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters