bazz1tv / mednafen-graffiti

Bazz's Graffiti Netplay Enhancement for Mednafen
GNU General Public License v2.0
1 stars 3 forks source link

[netplay] Graffiti #1

Open bazz1tv opened 8 years ago

bazz1tv commented 8 years ago

<zeromus> you know what would be fun is if you could draw graffiti on a netplay session

This is a contribution that should be made to the latest official mednafen release (not this repo) - but it's here for posterity.

Impl Notes

looking at the following functions to assist this impl:

MDFNI_NetplayText SendCommand(MDFNNPCMD_TEXT, len, text);

This is the command that is used to send chat messages back and forth between the clients.

These commands are received in netplay.cpp case MDFNNPCMD_TEXT, and add some processing to them.... The draw commands should be prefixed with a non-printable ASCII byte or short sequence to decipher them from normal chat commands and/or allow room for other commands to be reserved. draw commands must not be printed to screen.

Sending commands will be done from input.cpp void Input_Event(const SDL_Event *event) I believe.

One could have a layer specifically for the graffiti that would be drawn last upon other layers that mednafen draws to.

Respond to mouse click and drag events such that pixels are plotted to the screen with random colors (see https://github.com/amatus/sdl-examples/blob/master/paint/paint.c)

/grafitti [on/off] - a command to turn the mode on and off.. this basically enables the SDL surfaces and mouse event handling / msg sending.


Commands

/g toggles on/off (impl'd) /g [on/off] (impl'd) /g clear (impl'd LOCALLY ONLY)


/g color [random | red | green | blue] /g color #000fff /g text wow! /g textsize 12

Other Todo

Iterate through PIDC, iterate through BIC of PIDC, iterate through BC of BIC of PIDC looking at the butt type to see if it's BUTTC_MOUSE

when its enabled, graffiti takes the mouse instead of the zapper

  • sync surfaces when netplay client(s) connect. __ How can I express surface data over the network? Try upscaling surface data to highest surface bit-width .. send over network, downgrade as necessary
  • clear the surface when the session ends (or not..?)
  • clean up "dirty init" (I thought i saw some doodle processing at bootup)
  • refactor "static global" deps (OurNick)
  • fullscreen support
  • show up on video recordings (-qtrecord)

    Notes

    Rypecha is the only mednafen coder

bazz1tv commented 8 years ago

Ryphecha> bazzy: You'll want to create a surface that's nominal_width x nominal_height, or some multiple of that, and (ab)use mouse_scale_x, mouse_scale_y, mouse_offs_x, and mouse_offs_y for coordinate mapping but not all emulated systems set the mouse scaling variables