Skip to content

API Reference

Gamepiaynmo edited this page Aug 7, 2020 · 2 revisions

API Reference

转到中文

Logging

Sometimes you may want to do some logging so that once something goes wrong you can find what is the problem easier.

BML provides a simple Logger. You can access it by calling GetLogger() function of IMod interface.

This Logger only have 3 functions:

	virtual void Info(const char* fmt, ...);
	virtual void Warn(const char* fmt, ...);
	virtual void Error(const char* fmt, ...);

For different severe level of your log message.

All Available Subscription Messages

Start to load Start Menu & Finish loading Start Menu.

virtual void OnPreStartMenu() {};
virtual void OnPostStartMenu() {};

Exit Game.

virtual void OnExitGame() {};

Start to load a level & Finish loading the level.

virtual void OnPreLoadLevel() {};
virtual void OnPostLoadLevel() {};

Start playing a level.

virtual void OnStartLevel() {};

Start to reset the level & Finish resetting the level.

virtual void OnPreResetLevel() {};
virtual void OnPostResetLevel() {};

Pause & Unpause.

virtual void OnPauseLevel() {};
virtual void OnUnpauseLevel() {};

Start to exit the level & Finished exiting the level.

virtual void OnPreExitLevel() {};
virtual void OnPostExitLevel() {};

Start to load next level & Finished loading next level.

virtual void OnPreNextLevel() {};
virtual void OnPostNextLevel() {};

Game over menu appears.

virtual void OnDead() {};

Arrive Balloon & Level finish menu appears.

virtual void OnPreEndLevel() {};
virtual void OnPostEndLevel() {};

Time score counter active & inactive.

virtual void OnCounterActive() {};
virtual void OnCounterInactive() {};

Ball navigation active & inactive. Whether player can control the ball.

virtual void OnBallNavActive() {};
virtual void OnBallNavInactive() {};

Camera navigation active & inactive. Whether player can rotate the camera.

virtual void OnCamNavActive() {};
virtual void OnCamNavInactive() {};

When ball falls down.

virtual void OnBallOff() {};

Ball reached the check point flame & Finished loading next sector.

virtual void OnPreCheckpointReached() {};
virtual void OnPostCheckpointReached() {};

Arrive the Balloon, before OnPreEndLevel.

virtual void OnLevelFinish() {};

When ball falls down with zero extra lives. After OnBallOff.

virtual void OnGameOver() {};

When ball reaches an extra point ball, both large and small.

virtual void OnExtraPoint() {};

Start to play sub life animation & Finish playing the animation.

virtual void OnPreSubLife() {};
virtual void OnPostSubLife() {};

Start to play life up animation & Finish playing the animation.

virtual void OnPreLifeUp() {};
virtual void OnPostLifeUp() {};

Mod initialization & release.

virtual void OnLoad() {};
virtual void OnUnload() {};

When a configuration entry is modified.

virtual void OnModifyConfig(CKSTRING category, CKSTRING key, IProperty* prop) {};

When Building Block "Object Load" is used to load a new nmo file.

virtual void OnLoadObject(CKSTRING filename, BOOL isMap, CKSTRING masterName,
	CK_CLASSID filterClass, BOOL addtoscene, BOOL reuseMeshes, BOOL reuseMaterials,
	BOOL dynamic, XObjectArray* objArray, CKObject* masterObj) {};
virtual void OnLoadScript(CKSTRING filename, CKBehavior* script) {};

Called in each game loop & render frame.

virtual void OnProcess() {};
virtual void OnRender(CK_RENDER_FLAGS flags) {};

When cheat mode is enabled & disabled.

virtual void OnCheatEnabled(bool enable) {};

All Available Registries

Register a new player ball type.

virtual void RegisterBallType(CKSTRING ballFile, CKSTRING ballId, CKSTRING ballName, CKSTRING objName,
	float friction, float elasticity, float mass, CKSTRING collGroup, float linearDamp, float rotDamp,
	float force, float radius);

Register a new floor type.

virtual void RegisterFloorType(CKSTRING floorName, float friction, float elasticity, float mass,
	CKSTRING collGroup, bool enableColl);

Register a new modul ball type.

virtual void RegisterModulBall(CKSTRING modulName, bool fixed, float friction, float elasticity,
	float mass, CKSTRING collGroup, bool frozen, bool enableColl, bool calcMassCenter, float linearDamp,
	float rotDamp, float radius);

Register a new convex modul (Dome, Paper Ball).

virtual void RegisterModulConvex(CKSTRING modulName, bool fixed, float friction, float elasticity,
	float mass, CKSTRING collGroup, bool frozen, bool enableColl, bool calcMassCenter, float linearDamp,
	float rotDamp);

Register a new ball transformer type.

virtual void RegisterTrafo(CKSTRING modulName);

Register a new modul type.

virtual void RegisterModul(CKSTRING modulName);