Giter VIP home page Giter VIP logo

botc's People

Contributors

crimsondusk avatar tarcv avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

botc's Issues

memset() is arrayset()

After navigating through Zandronum's source code, I found the following in src/bots.cpp:

                case DH_ARRAYSET:

                        {
                                LONG    lArray;
                                LONG    lVal;
                                LONG    lHighestVal;
//                              LONG    lIdx;

                                lArray = m_ScriptData.alStack[m_ScriptData.lStackPosition - 3];
                                lVal = m_ScriptData.alStack[m_ScriptData.lStackPosition - 2];
                                lHighestVal = m_ScriptData.alStack[m_ScriptData.lStackPosition - 1];

                                if (( lArray < 0 ) || ( lArray >= MAX_SCRIPT_ARRAYS ))
                                        I_Error( "ParseScript: Invalid array index, %d, in command \"arrayset\"!", static_cast<int> (lArray) );
                                if (( lHighestVal < 0 ) || ( lHighestVal >= MAX_SCRIPTARRAY_SIZE ))
                                        I_Error( "ParseScript: Invalid array maximum index, %d, in command \"arrayset\"!", static_cast<int> (lHighestVal) );

                                memset( m_ScriptData.alScriptArrays[lArray], lVal, lHighestVal * sizeof( LONG ));
                                PopStack( );
                                PopStack( );
                                PopStack( );
                        }
                        break;

since DH_ARRAYSET is what we call now memset(), and the error says an error occurred with the command "arrayset", I suggest a renaming of that function, or the creation of an alias for it.

Fix build on Linux

void SkipWhitespace (char*& cp, const char const *end)

should be
void SkipWhitespace (char*& cp, const char *end)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /permissive- -lc++fs")

should be
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /permissive-")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -lc++fs -W -Wall")

should be
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -W -Wall")

DH_ARRAYSET implementation is wrong

I've just went through this issue, I have decided to pick everything necessary from Zandronum's source code to test what happens when the function is called like that. Some things to consider: LONG is an alias for int, bool's size is 1 byte, the memset() below can be translated as memset(array, 1, sizeof(int)*32768), although I am not sure what is the value of lHighestVal in Zandronum's code. What I get from this is that memset() doesn't ever set the value that the modder tells it to even though there is one missing information.

#include <iostream>
#include <cstring>

// Maximum number of global arrays that can be defined in a script.
#define MAX_SCRIPT_ARRAYS                       16

// Maximum number of global arrays that can be defined in a script.
#define MAX_SCRIPTARRAY_SIZE            65536

typedef int LONG;

typedef struct
{
        LONG            alScriptArrays[MAX_SCRIPT_ARRAYS][MAX_SCRIPTARRAY_SIZE];
} SCRIPTDATA_t;

// ===========================================================================//

SCRIPTDATA_t    m_ScriptData;
LONG            lVal            = 1; // value to go into array
LONG            lHighestVal     = 32768;        // Array size?
LONG            lArray          = 1; // equivalent to $globalArray1[]

int main (void)
{
        // same as memset(1, 1, 32768);
        memset( m_ScriptData.alScriptArrays[lArray], lVal, lHighestVal * sizeof( LONG ));
        std::cout << std::hex << m_ScriptData.alScriptArrays[lArray][0] << ", " << m_ScriptData.alScriptArrays[lArray][1] << ", " << m_ScriptData.alScriptArrays[lArray][2] << ", ...\n";
        return 0;
}

Compiled lumps differ in size from debotc output

I have talked to Torr about botc, he seemed happy about this and asked the following:

Quick question: Should it be possible to exactly recreate the compiled bot scripts from zandronum.pk3 with debotc and botc? I tried decompiling and recompiling crashbot.lump, but the result differed from the original crashbot.lump.

Zandronum reports stack size exceeded when Roam() is used (upgrade branch)

Although #14 fixes tarcv-master, that fix doesn't work in the upgrade branch.

Crash entered the game.
bot Crash command: Random
bot Crash command: delay
bot Crash command: ChatSectionExistsInChatLump
bot Crash command: BeginChatting
bot Crash command: Random
bot Crash command: delay
You got the super shotgun!
You got the BFG9000!  Oh, yes.
bot Crash command: SayFromChatLump
Crash: Hey guys ;)
bot Crash command: LookForWeapons
bot Crash command: changestate
bot Crash command: StopChatting
bot Crash command: LookForWeapons
bot Crash command: GetCurrentWeapon
bot Crash command: StringsAreEqual
bot Crash command: Roam
bot Crash command: LookForPowerups
bot Crash command: GetCurrentWeapon
bot Crash command: StringsAreEqual
bot Crash command: Roam
bot Crash command: GetHealth
bot Crash command: GetBaseHealth
bot Crash command: GetCurrentWeapon
bot Crash command: StringsAreEqual
bot Crash command: Roam
bot Crash command: GetArmor
bot Crash command: GetBaseArmor
bot Crash command: LookForBaseArmor
bot Crash command: GetCurrentWeapon
bot Crash command: StringsAreEqual
bot Crash command: Roam
bot Crash command: LookForSuperHealth
bot Crash command: GetCurrentWeapon
bot Crash command: StringsAreEqual
bot Crash command: Roam
bot Crash command: LookForSuperArmor
bot Crash command: GetCurrentWeapon
bot Crash command: StringsAreEqual
bot Crash command: Roam

PushToStack: Stack size exceeded in bot Crash's script!

CI for Mac is broken

The current build script for Mac doesn't work in CI:

set -ex

#touch Brewfile
#echo 'brew "cmake"' >> Brewfile
#echo 'brew "llvm"' >> Brewfile
#brew bundle
brew install cmake || true
brew install llvm || true

export CC=$(brew --prefix llvm)/bin/clang
export CXX=$(brew --prefix llvm)/bin/clang++
export LD_LIBRARY_PATH=$(brew --prefix llvm)/lib

cmake -DCMAKE_POLICY_DEFAULT_CMP0056=NEW -DCMAKE_CXX_FLAGS="-v -stdlib=libc++ -I$(brew --prefix llvm)/include -Wl,-rpath,$LD_LIBRARY_PATH -L$LD_LIBRARY_PATH" .
make

https://dev.azure.com/tarcv/botc/_build/results?buildId=81&view=logs&j=a4f1cc8a-0ccb-5e90-36f4-f06f41d0ce59&t=ca6b548a-c0fd-5f27-176c-c59ec27fafde

bool functions don't work?

zandronum 3.2's latest alpha build has added extra botscript functions which could potentially make this tool more useful, however this is an issue:
image

BotC project license

Looks like the original Botc license is the 3-Clause BSD License.
Although it is modified and mentions only the author instead of "the copyright holder and contributors". So I don't think that exact text can be used for this (or other) forks.
cc: @so-sleepy adding you as you're talking with Torr about using this botc fork in Zandronum build process.

@crimsondusk Hi. Is it ok for you if I change the license text to match 3 clause BSD, or just add copyright holder and project contributors wording to your license text?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.