table zapper.read int which unecessary because zapper is always controller 2 Reads the zapper coordinates and a click value (1 if clicked, 0 if not, 2 if right click (but this is not used for zapper input)
| 2745 | //int which unecessary because zapper is always controller 2 |
| 2746 | //Reads the zapper coordinates and a click value (1 if clicked, 0 if not, 2 if right click (but this is not used for zapper input) |
| 2747 | static int zapper_read(lua_State *L){ |
| 2748 | |
| 2749 | lua_newtable(L); |
| 2750 | int z = 0; |
| 2751 | extern void GetMouseData(uint32 (&md)[3]); //adelikat: shouldn't this be ifdef'ed for Win32? |
| 2752 | int x,y,click; |
| 2753 | if (FCEUMOV_Mode(MOVIEMODE_PLAY)) |
| 2754 | { |
| 2755 | if (!currFrameCounter) |
| 2756 | z = 0; |
| 2757 | else |
| 2758 | z = currFrameCounter -1; |
| 2759 | |
| 2760 | x = currMovieData.records[z].zappers[1].x; //adelikat: Used hardcoded port 1 since as far as I know, only port 1 is valid for zappers |
| 2761 | y = currMovieData.records[z].zappers[1].y; |
| 2762 | click = currMovieData.records[z].zappers[1].b; |
| 2763 | } |
| 2764 | else |
| 2765 | { |
| 2766 | uint32 MouseData[3]; |
| 2767 | GetMouseData (MouseData); |
| 2768 | x = MouseData[0]; |
| 2769 | y = MouseData[1]; |
| 2770 | click = MouseData[2]; |
| 2771 | if (click > 1) |
| 2772 | click = 1; //adelikat: This is zapper.read() thus should only give valid zapper input (instead of simply mouse input |
| 2773 | } |
| 2774 | lua_pushinteger(L, x); |
| 2775 | lua_setfield(L, -2, "x"); |
| 2776 | lua_pushinteger(L, y); |
| 2777 | lua_setfield(L, -2, "y"); |
| 2778 | lua_pushinteger(L, click); |
| 2779 | lua_setfield(L, -2, "fire"); |
| 2780 | return 1; |
| 2781 | } |
| 2782 | |
| 2783 | // zapper.set(table state) |
| 2784 | // |
nothing calls this directly
no test coverage detected