1 // Emacs style mode select -*- C++ -*-
2 //---------------------------------------------------------------------------
3 //
4 // $Id: swutil.c,v 1.2 2003/06/04 16:02:55 fraggle Exp $
5 //
6 // Copyright(C) 1984-2000 David L. Clark
7 // Copyright(C) 2001-2003 Simon Howard
8 //
9 // This program is free software; you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 2 of the License, or (at your
12 // option) any later version. This program is distributed in the hope that
13 // it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 // the GNU General Public License for more details. You should have
16 // received a copy of the GNU General Public License along with this
17 // program; if not, write to the Free Software Foundation, Inc., 59 Temple
18 // Place - Suite 330, Boston, MA 02111-1307, USA.
19 //
20 //---------------------------------------------------------------------------
21 //
22 // Converted ASM Routines
23 // Some of these arent used (dos specific empty functions)
24 // Some of them are modified from andrew jenners source functions
25 // as i cant read x86 asm :(
26 //
27 //-----------------------------------------------------------------------
28 
29 #include "sw.h"
30 #include "swutil.h"
31 
movexy(OBJECTS * ob,int * x,int * y)32 void movexy(OBJECTS * ob, int *x, int *y)
33 {
34 	long pos;
35 	//long vel;
36 //      pos = (((long) (ob->ob_x)) << 16) + ob->ob_lx;
37 //      vel = (((long) (ob->ob_dx)) << 16) + ob->ob_ldx;
38 
39         // Adding this to avoid range errors -- Jesse
40         if (pos >= ((MAX_X - 10) << 16)) pos = (MAX_X - 10) << 16;
41         if (pos < 0) pos = 0;
42 
43 	pos = (ob->ob_x + ob->ob_dx) << 16;
44 	ob->ob_x = (short) (pos >> 16);
45 	ob->ob_lx = (short) pos;
46 	*x = ob->ob_x;
47 //      pos = (((long) (ob->ob_y)) << 16) + ob->ob_ly;
48 //      vel = (((long) (ob->ob_dy)) << 16) + ob->ob_ldy;
49 	pos = (ob->ob_y + ob->ob_dy) << 16;
50 	ob->ob_y = (short) (pos >> 16);
51 	ob->ob_ly = (short) pos;
52 	*y = ob->ob_y;
53 }
54 
setdxdy(OBJECTS * obj,int dx,int dy)55 void setdxdy(OBJECTS * obj, int dx, int dy)
56 {
57 	obj->ob_dx = dx >> 8;
58 	obj->ob_ldx = dx << 8;
59 	obj->ob_dy = dy >> 8;
60 	obj->ob_ldy = dy << 8;
61 }
62 
swsetblk()63 void swsetblk()
64 {
65 	// used by the splatted ox code to colour the screen. ?
66 }
67 
swgetjoy()68 void swgetjoy()
69 {
70 	// joystick
71 }
72 
histend()73 void histend()
74 {
75 	// demos?
76 }
77 
78 
79 //---------------------------------------------------------------------------
80 //
81 // $Log: swutil.c,v $
82 // Revision 1.2  2003/06/04 16:02:55  fraggle
83 // Remove broken printscreen function
84 //
85 // Revision 1.1.1.1  2003/02/14 19:03:22  fraggle
86 // Initial Sourceforge CVS import
87 //
88 //
89 // sdh 14/2/2003: change license header to GPL
90 // sdh 16/11/2001: trap14 removed
91 // sdh 21/10/2001: rearranged headers, added cvs tags
92 // sdh 18/10/2001: converted all functions to ANSI-style arguments
93 // sdh ??/10/2001: created this file to hold replacements for the ASM
94 //                 functions in swutil.asm
95 //
96 //---------------------------------------------------------------------------
97