[go: up one dir, main page]

File: swutil.c

package info (click to toggle)
sopwith 1.8.4-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,776 kB
  • ctags: 1,428
  • sloc: ansic: 9,906; sh: 2,770; makefile: 80
file content (96 lines) | stat: -rw-r--r-- 2,981 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Emacs style mode select -*- C++ -*-
//---------------------------------------------------------------------------
//
// $Id: swutil.c,v 1.2 2003/06/04 16:02:55 fraggle Exp $
//
// Copyright(C) 1984-2000 David L. Clark
// Copyright(C) 2001-2003 Simon Howard
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version. This program is distributed in the hope that
// it will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details. You should have
// received a copy of the GNU General Public License along with this
// program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place - Suite 330, Boston, MA 02111-1307, USA.
//
//---------------------------------------------------------------------------
//
// Converted ASM Routines
// Some of these arent used (dos specific empty functions)
// Some of them are modified from andrew jenners source functions
// as i cant read x86 asm :(
//
//-----------------------------------------------------------------------

#include "sw.h"
#include "swutil.h"

void movexy(OBJECTS * ob, int *x, int *y)
{
	long pos;
	//long vel;
//      pos = (((long) (ob->ob_x)) << 16) + ob->ob_lx;
//      vel = (((long) (ob->ob_dx)) << 16) + ob->ob_ldx;

        // Adding this to avoid range errors -- Jesse
        if (pos >= ((MAX_X - 10) << 16)) pos = (MAX_X - 10) << 16;
        if (pos < 0) pos = 0;

	pos = (ob->ob_x + ob->ob_dx) << 16;
	ob->ob_x = (short) (pos >> 16);
	ob->ob_lx = (short) pos;
	*x = ob->ob_x;
//      pos = (((long) (ob->ob_y)) << 16) + ob->ob_ly;
//      vel = (((long) (ob->ob_dy)) << 16) + ob->ob_ldy;
	pos = (ob->ob_y + ob->ob_dy) << 16;
	ob->ob_y = (short) (pos >> 16);
	ob->ob_ly = (short) pos;
	*y = ob->ob_y;
}

void setdxdy(OBJECTS * obj, int dx, int dy)
{
	obj->ob_dx = dx >> 8;
	obj->ob_ldx = dx << 8;
	obj->ob_dy = dy >> 8;
	obj->ob_ldy = dy << 8;
}

void swsetblk()
{
	// used by the splatted ox code to colour the screen. ?
}

void swgetjoy()
{
	// joystick
}

void histend()
{
	// demos?
}


//---------------------------------------------------------------------------
//
// $Log: swutil.c,v $
// Revision 1.2  2003/06/04 16:02:55  fraggle
// Remove broken printscreen function
//
// Revision 1.1.1.1  2003/02/14 19:03:22  fraggle
// Initial Sourceforge CVS import
//
//
// sdh 14/2/2003: change license header to GPL
// sdh 16/11/2001: trap14 removed
// sdh 21/10/2001: rearranged headers, added cvs tags
// sdh 18/10/2001: converted all functions to ANSI-style arguments
// sdh ??/10/2001: created this file to hold replacements for the ASM
//                 functions in swutil.asm
//
//---------------------------------------------------------------------------