JazzJackrabbit Community Forums

JazzJackrabbit Community Forums (http://www.jazz2online.com/jcf/index.php)
-   Resolved Issues (http://www.jazz2online.com/jcf/forumdisplay.php?f=50)
-   -   Wontfix a new onDraw variant for jjBEHAVIORINTERFACE (http://www.jazz2online.com/jcf/showthread.php?t=20777)

Zah dud4h Apr 26, 2025 01:31 PM

a new onDraw variant for jjBEHAVIORINTERFACE
 
Unsure how the onDraw(jjOBJ@ obj) hook works internally and if it's possible to have a variant that accepts a second parameter of "jjPLAYER@ play" so you can specify how differently it should draw for a specific player, similar to how the PU blaster monitors and the fast fire pickups work

Example:
Quote:

void onDraw(jjOBJ@ obj,jjPLAYER@ play) {
if (play.currChar == CHAR::JAZZ) {
//draw the sprite for jazz
} else {
// draw the default sprite
}
}

Seren Apr 27, 2025 03:11 AM

All jjDraw* functions take an optional playerID argument that can be used to specify which player the sprite should be drawn for (the default of -1 denoting all). This already enables patterns such as
Code:

void onDraw(jjOBJ@ obj) {
    for (int i = 0; i < jjLocalPlayerCount; i++) {
        const auto@ player = jjLocalPlayers[i];
        // draw the sprite facing the player's direction instead of the object's
        jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame,
                player.direction, playerID: player.playerID);
    }
}

The proposed overload couldn't really do anything more than move this loop outside of the function and into JJ2+ code - which we could do, but this use case comes up rarely enough that it would probably do more harm than good to provide a dedicated shorthand for it.


All times are GMT -8. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
JCF © 2001-Infinity Jazz2Online