-
Notifications
You must be signed in to change notification settings - Fork 33
API Level 1
Header | JK2MV Version | Supported since |
---|---|---|
Level 1 | 1.1 | 7 Nov 2015 |
SysCalls available with this API-Level.
Declaration | Number | ASM | game | cgame | ui |
---|---|---|---|---|---|
MVAPI_GET_VERSION | 704 | -705 | ☑️ | ☑️ | ☑️ |
MVAPI_CONTROL_FIXES | 703 | -704 | ☑️ | ☑️ | |
MVAPI_GET_CONNECTIONLESSPACKET | 701 | -702 | ☑️ | ||
MVAPI_SEND_CONNECTIONLESSPACKET | 700 | -701 | ☑️ | ||
MVAPI_LOCATE_GAME_DATA | 702 | -703 | ☑️ |
mvversion_t trap_MVAPI_GetVersion(void);
Get the currently running gameversion from the engine. This is only useful if your mod is based on the mvsdk.
qboolean trap_MVAPI_ControlFixes(mvfix_t fixes);
Turns exploit- and bug-fixes in the engine on and off. This can be used to implement better fixes then what is possible from on the engines scope. fixes
is a bitvalue which is expected to be a list of bitwise conjugated mvfix_t
entries. Every call to this function overwrites previous calls. See MVAPI Fixes section for a list of mvfix_t
values.
Returns qfalse on success and qtrue on failure.
Example:
if ( trap_MVAPI_ControlFixes(MVFIX_GALAKING | MVFIX_BROKENMODEL) ) {
G_Printf("Could not control JK2MV fixes.\n");
}
This example code switches off the fixes for galaking and broken models.
qboolean trap_MVAPI_GetConnectionlessPacket(mvaddr_t *addr, char *buf, unsigned int bufsize);
Get the content of a connectionless packet. Only valid during a MVAPI_RECV_CONNECTIONLESSPACKET
VMCall. Returns qfalse
on success and qtrue
on failure.
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
switch ( command ) {
...
case MVAPI_RECV_CONNECTIONLESSPACKET:
MVAPI_ReceiveConnectionlessPacket();
return 0;
}
return -1;
}
void MVAPI_ReceiveConnectionlessPacket(void) {
mvaddr_t addr;
char message[256];
if (trap_MVAPI_GetConnectionlessPacket(&addr, message, sizeof(message))) {
G_Printf("Error receiving connectionless packet.\n");
return;
}
G_Printf("connectionless packet %s received", message);
if (addr.type == MV_IPV4) {
G_Printf(" from %i.%i.%i.%i:%i.\n", (int)addr.ip.v4[0], (int)addr.ip.v4[1], (int)addr.ip.v4[2], (int)addr.ip.v4[3], (int)addr.port);
} else {
G_Printf(".\n");
}
}
qboolean trap_MVAPI_SendConnectionlessPacket(const mvaddr_t *addr, const char *message);
Send a connectionless packet to address addr
.
qboolean trap_MVAPI_LocateGameData(mvsharedEntity_t *mvEnts, int numGEntities, int sizeofmvsharedEntity_t);
Locate an array of mvsharedEntity_t
structs, containing extended game entity data for the engine.
Example:
mvsharedEntity_t mv_entities[MAX_GENTITIES];
void MVAPI_AfterInit(int levelTime, int randomSeed, int restart) {
trap_MVAPI_LocateGameData(mv_entities, level.num_entities, sizeof(mvsharedEntity_t));
}
Number of shared mv entities is always the same as a number of regular shared entities, located by trap_LocateGameData
SysCall. Therefore you don't need to call trap_MVAPI_LocateGameData
again to update the number of shared mv entites and mv_entities
array has to have the same length as g_entities
array.
See mvsharedEntity_t to learn how mv_entities
array can be used.
VMCalls available with this API-Level.
Declaration | Number | game | cgame | ui |
---|---|---|---|---|
MVAPI_RECV_CONNECTIONLESSPACKET | 101 | ☑️ |
See MVAPI_GET_CONNECTIONLESSPACKET
See Cvars page for bug descriptions.
Flag | game | cgame | ui |
---|---|---|---|
MVFIX_NAMECRASH | ☑️ | ||
MVFIX_FORCECRASH | ☑️ | ||
MVFIX_GALAKING | ☑️ | ||
MVFIX_BROKENMODEL | ☑️ | ||
MVFIX_TURRETCRASH | ☑️ | ||
MVFIX_CHARGEJUMP | ☑️ | ||
MVFIX_SPEEDHACK | ☑️ | ||
MVFIX_WPGLOWING | ☑️ |
Each mv shared game entity corresponds to one regular game entity (see MVAPI_LOCATE_GAME_DATA). The corresponding game entity will be called "the entity" from now on.
Field | Description |
---|---|
uint8_t snapshotIgnore[32] |
If array item n is other than 0, the entity will not be broadcasted to client n . For example mv_entities[0].snapshotIgnore[1] = 1; causes player 0 to become invisible for player 1. A much more useful and complex example of "duel invisibility" or "duel clear screen" can be seen in SaberMod source code
|
uint8_t snapshotEnforce[32] |
If array item n is other than 0 and the entity is linked, it will be unconditionally broadcasted to player n . |
JK2MV
Client
Server
Modding
Development