videoP / jaPRO

Community effort to maintain and improve Jedi Academy + Jedi Outcast released by Raven Software
GNU General Public License v2.0
12 stars 6 forks source link

can't load map if it has a vehicle spawned in it that you don't have #32

Open videoP opened 11 months ago

videoP commented 11 months ago

a fix would be to simply treat the vehicle as a stock vehicle and still let you play the map

videoP commented 11 months ago

possible fix:


void CG_CacheG2AnimInfo(char *modelName)
{
    void *g2 = NULL;
    char *slash;
    char useModel[MAX_QPATH] = {0};
    char useSkin[MAX_QPATH] = {0};
    int animIndex;

    Q_strncpyz(useModel, modelName, sizeof( useModel ) );
    Q_strncpyz(useSkin, modelName, sizeof( useSkin ) );

    if (modelName[0] == '$')
    { //it's a vehicle name actually, let's precache the whole vehicle
        char* vehType = &modelName[1];
        int iVehIndex = BG_VehicleGetIndex(vehType);

        if (iVehIndex == -1) { //Pre-empt a crash and just treat it as a swoop!
            Q_strncpyz(useModel, "$swoop_mp", sizeof(useModel));
            Q_strncpyz(useSkin, "$swoop_mp", sizeof(useSkin));
        }

and

void CG_G2AnimEntModelLoad(centity_t *cent)
{
    const char *cModelName = CG_ConfigString( CS_MODELS+cent->currentState.modelindex );

    if (!cent->npcClient)
    { //have not init'd client yet
        return;
    }

    if (cModelName && cModelName[0])
    {
        char modelName[MAX_QPATH];
        int skinID;
        char *slash;

        strcpy(modelName, cModelName);

        if (cent->currentState.NPC_class == CLASS_VEHICLE && modelName[0] == '$')
        { //vehicles pass their veh names over as model names, then we get the model name from the veh type
            //create a vehicle object clientside for this type
            char* vehType = &modelName[1];
            int iVehIndex = BG_VehicleGetIndex(vehType);

            if (iVehIndex == -1) { //Pre-empt a crash and just treat it as a swoop!
                Q_strncpyz(modelName, "$swoop_mp", sizeof(modelName));
                vehType = &modelName[1];
                iVehIndex = BG_VehicleGetIndex(vehType);
            }