Skip to content

Commit

Permalink
Merge pull request #421 from ineedbots/master
Browse files Browse the repository at this point in the history
Fix bots with switchtoweapon and setspawnweapon builtins
  • Loading branch information
proxict authored Dec 16, 2023
2 parents 4f07800 + 73f5811 commit 6b9a943
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
run: |
cd C:/
Start-BitsTransfer -Source https://downloads.sourceforge.net/mingw-w64/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z -Destination mingw32.7z
7z x mingw32.7z
7z x -y mingw32.7z
- name: Get NASM
uses: ilammy/setup-nasm@v1
Expand All @@ -90,8 +90,8 @@ jobs:
- name: Get pexports
run: |
Invoke-WebRequest "https://github.com/callofduty4x/CoD4x_Server/raw/master/tools/pexports-0.47-mingw32-bin.tar.xz" -OutFile "pexports.tar.xz"
7z x pexports.tar.xz
7z x pexports.tar
7z x -y pexports.tar.xz
7z x -y pexports.tar
- name: Build
run: |
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
Copy-Item -Path sourcebansplugin/sourcebansplugin.dll -Destination plugins/
Copy-Item -Path warn/warn.dll -Destination plugins/
Copy-Item -Path legacybanlist/legacybanlist.dll -Destination plugins/
7z a plugins_windows.zip plugins/*
7z a -y plugins_windows.zip plugins/*
cd ../
- name: Publish release
Expand Down
6 changes: 6 additions & 0 deletions src/asmsource/_g_weapon.asm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
extern G_FireRocket
extern G_AntiLagRewindClientPos
extern G_AntiLag_RestoreClientPos
extern Bot_SetBotWeapon

;Exports of g_weapon:
global _ZZ11Melee_TraceP9gentity_sP11weaponParmsifffP7trace_tPfE12traceOffsets
Expand Down Expand Up @@ -1090,6 +1091,11 @@ G_SelectWeaponIndex:
mov eax, [ebp+0x8]
mov [esp], eax
call SV_GameSendServerCommand
mov eax, [ebp+0xc]
push eax
mov eax, [ebp+0x8]
push eax
call Bot_SetBotWeapon
leave
ret

Expand Down
5 changes: 5 additions & 0 deletions src/sv_bots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,9 @@ qboolean shouldSpamUseButton(gentity_t *bot)
return is_alive == qfalse && ai->useSpamDelay == 0 ? qtrue : qfalse;
}

void Bot_SetBotWeapon(int clientNum, unsigned int weaponIdx)
{
g_botai[clientNum].weapon = static_cast<::byte>(weaponIdx);
}

}
1 change: 1 addition & 0 deletions src/sv_bots.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extern "C"

void Scr_AddBotsMovement();
qboolean shouldSpamUseButton(gentity_t *bot);
void Bot_SetBotWeapon(int, unsigned int);


#ifdef __cplusplus
Expand Down

0 comments on commit 6b9a943

Please sign in to comment.